A video playing method and device
By analyzing the FPS of the video stream and dynamically adjusting the buffer space and playback speed, the problem of video stuttering and latency caused by fixed buffer space being unable to adapt to network fluctuations is solved, achieving smooth and real-time video playback.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHEJIANG DAHUA TECH CO LTD
- Filing Date
- 2023-10-11
- Publication Date
- 2026-06-23
AI Technical Summary
In existing technologies, the fixed data cache space setting cannot adapt to network fluctuations, causing video playback to stutter or be delayed when the network fluctuates, affecting the user experience.
By receiving the video stream and analyzing the current and target frame rates per second (FPS), the transmission deviation is determined, and the cache space and playback speed are dynamically adjusted according to adaptive caching rules to achieve precise caching.
Under network fluctuations, the video playback stuttering issue has been resolved, while maintaining real-time video playback and improving user experience.
Smart Images

Figure CN117395463B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a video playback method and apparatus. Background Technology
[0002] In the internet age, multimedia data, especially video data, consumes a significant amount of bandwidth. In public network environments, network fluctuations are widespread, and users are highly sensitive to the smoothness of streaming video playback. Therefore, ensuring smooth video playback is a crucial issue.
[0003] To ensure smooth video playback, related technologies typically employ a fixed data buffer space. Specifically, received video data is first cached in a fixed buffer space, and then the video data is retrieved from the buffer space for decoding and playback. This reduces the impact of network jitter and improves video playback smoothness.
[0004] However, since the data cache space is a pre-set fixed space, setting the data cache space too large will not only consume the playback device's memory space and affect performance, but will also cause serious video latency; setting the data cache space too small will cause serious video stuttering when the network fluctuates greatly, affecting the experience. Summary of the Invention
[0005] This invention provides a video playback method and apparatus to improve the smoothness of video playback while also ensuring its real-time performance.
[0006] In a first aspect, embodiments of the present invention provide a video playback method, the method comprising:
[0007] Receive the video stream to be played and parse the video stream to obtain multiple frames of video data, the current frame rate per second (FPS), and the target frame rate per second (FPS) carried in the video stream;
[0008] Based on the current frame rate per second (FPS) and the target frame rate per second (FPS), determine the transmission deviation; and based on the transmission deviation and the preset adaptive caching rules, determine the cache size of the target cache space, and cache the multi-frame video data into the target cache space.
[0009] Based on the cache size of the target cache space, the current data cache size, and the cache playback interval rules, the playback speed of the multi-frame video data is determined, and the multi-frame video data is played at the specified playback speed.
[0010] In one possible implementation, determining the transmission deviation based on the current frames per second (FPS) and the target frames per second (FPS) includes:
[0011] The current frame rate (FPS) is determined based on the reception time of the current frame of the video data and the reception time of the previous frame.
[0012] The absolute value of the difference between the current frame rate per second (FPS) and the target frame rate per second (FPS) is used as the transmission deviation.
[0013] In one possible implementation, determining the cache size of the target cache space based on the transmission offset and a preset adaptive caching rule includes:
[0014] The product of the first weight value and the transmission deviation is used as the transmission ratio value; the transmission ratio value is used to indicate the degree of influence of network fluctuations on the video stream playback.
[0015] The difference between the transmission deviation of the previous frame and the transmission deviation is determined, and the product of the difference and the second weight value is used as the differential control value; the differential control value is used to indicate the degree of jitter in buffer control.
[0016] The cache size of the target cache space is determined based on the transmission ratio value, the differential control value, and the cache space adjustment rule; wherein, the cache space adjustment rule includes the correspondence between the transmission ratio value, the differential control value, and the cache size.
[0017] In one possible implementation, determining the playback speed of the multi-frame video data based on the cache size of the target cache space, the current data cache size, and cache playback interval rules includes:
[0018] Determine the proportion of the current data cached amount in the cached amount of the target cache space;
[0019] According to the cached playback interval rules, target playback intervals that match the percentage value are selected, and the playback speed corresponding to the target playback interval is used as the playback speed of the multi-frame video data.
[0020] In a second aspect, embodiments of the present invention provide a video playback device, the device comprising:
[0021] The parsing unit is used to receive the video stream to be played and parse the video stream to obtain multi-frame video data, the current frame rate per second (FPS), and the target frame rate per second (FPS) carried in the video stream.
[0022] An adaptive caching control unit is used to determine the transmission deviation based on the current frame rate per second (FPS) and the target frame rate per second (FPS); and to determine the cache size of the target cache space based on the transmission deviation and a preset adaptive caching rule, and to cache the multi-frame video data into the target cache space.
[0023] The playback unit is used to determine the playback speed of the multi-frame video data based on the cache size of the target cache space, the current data cache size, and the cache playback interval rules, and to play the multi-frame video data at the playback speed.
[0024] In one possible implementation, the adaptive cache control unit is specifically used for:
[0025] The current frame rate (FPS) is determined based on the reception time of the current frame of the video data and the reception time of the previous frame.
[0026] The absolute value of the difference between the current frame rate per second (FPS) and the target frame rate per second (FPS) is used as the transmission deviation.
[0027] In one possible implementation, the adaptive cache control unit is specifically used for:
[0028] The product of the first weight value and the transmission deviation is used as the transmission ratio value; the transmission ratio value is used to indicate the degree of influence of network fluctuations on the video stream playback.
[0029] The difference between the transmission deviation of the previous frame and the transmission deviation is determined, and the product of the difference and the second weight value is used as the differential control value; the differential control value is used to indicate the degree of jitter in buffer control.
[0030] The cache size of the target cache space is determined based on the transmission ratio value, the differential control value, and the cache space adjustment rule; wherein, the cache space adjustment rule includes the correspondence between the transmission ratio value, the differential control value, and the cache size.
[0031] In one possible implementation, the playback unit is specifically used for:
[0032] Determine the proportion of the current data cached amount in the cached amount of the target cache space;
[0033] According to the cached playback interval rules, target playback intervals that match the percentage value are selected, and the playback speed corresponding to the target playback interval is used as the playback speed of the multi-frame video data.
[0034] Thirdly, embodiments of the present invention provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps included in any of the methods in the first aspect.
[0035] Fourthly, embodiments of the present invention provide a computer-readable storage medium including program code, which, when the program product is run on an electronic device, causes the electronic device to perform the steps included in any of the methods in the first aspect.
[0036] Fifthly, embodiments of the present invention provide a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the steps included in any of the methods in the first aspect.
[0037] The technical solutions provided by the embodiments of the present invention bring at least the following beneficial effects:
[0038] In this embodiment of the invention, a video stream to be played can be received and parsed to obtain multiple frames of video data, the current frame rate per second (FPS), and the target frame rate per second (FPS) carried in the video stream. Based on the current and target FPS, a transmission deviation is determined. Then, based on the transmission deviation and a preset adaptive caching rule, the cache size of the target cache space is determined, and the multiple frames of video data are cached in the target cache space. In other words, this embodiment of the invention can determine network fluctuations based on the current and target FPS obtained from video stream parsing. This allows for accurate and rapid determination of the appropriate target cache size for caching the video stream. Furthermore, based on the target cache size, the current cache size, and cache playback interval rules, the playback speed of the multiple frames of video data is determined, and the multiple frames of video data are played at this speed. This solves the problem of audio and video playback stuttering under network fluctuations while maintaining real-time video playback and improving the user experience.
[0039] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practice. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in the written description, claims, and drawings.
[0040] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit the invention. Attached Figure Description
[0041] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention, but do not constitute an undue limitation of the invention.
[0042] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present invention;
[0043] Figure 2 A flowchart of a video playback method provided in an embodiment of the present invention;
[0044] Figure 3 A schematic diagram illustrating the principle of determining the cache size of a target cache space according to an embodiment of the present invention;
[0045] Figure 4 A schematic diagram of a buffer playback range provided in an embodiment of the present invention;
[0046] Figure 5 This is a structural block diagram of a video playback device provided in an embodiment of the present invention;
[0047] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0048] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this invention, and not all of them. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention. Unless otherwise specified, the embodiments and features in the embodiments of this invention can be arbitrarily combined with each other. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than that shown here.
[0049] The terms "first" and "second" in the specification, claims, and accompanying drawings of this invention are used to distinguish different objects and not to describe a specific order. Furthermore, the term "comprising" and any variations thereof are intended to cover non-exclusive protection. For example, a process, method, system, product, or apparatus that comprises a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0050] As mentioned earlier, in the existing technology, a fixed data cache space is preset. Therefore, when the data cache space is set too large, it not only consumes the memory space of the playback device and affects performance, but also causes serious video latency. When the data cache space is set too small, the video will stutter severely when there are large network fluctuations, affecting the experience.
[0051] In view of this, the present invention provides a video playback method. This method receives a video stream to be played, parses the video stream to obtain multiple frames of video data, the current frame rate per second (FPS), and the target FPS carried in the video stream. Based on the current and target FPS, a transmission deviation is determined. Then, based on the transmission deviation and a preset adaptive caching rule, the cache size of the target cache space is determined, and the multiple frames of video data are cached in the target cache space. In other words, in this embodiment of the invention, the network fluctuation can be determined based on the current and target FPS obtained from video stream parsing. This allows for accurate and rapid determination of the appropriate target cache size for caching the video stream. Based on the target cache size, the current cache size, and cache playback interval rules, the playback speed of the multiple frames of video data is determined, and the multiple frames of video data are played at this speed. This solves the problem of audio and video playback stuttering under network fluctuations while maintaining real-time video playback and improving the user experience.
[0052] After introducing the design concept of the embodiments of the present invention, the following is a brief introduction to the application scenarios applicable to the technical solutions of the embodiments of the present invention. It should be noted that the application scenarios described in the embodiments of the present invention are for the purpose of more clearly illustrating the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. As those skilled in the art will know, with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems.
[0053] Please see Figure 1 The diagram illustrates a scenario to which the invention's embodiments can be applied. This scenario includes a computer device 101 and an electronic device 102. The video playback method of this embodiment can be... Figure 1 The computer device 101 and the electronic device 102 work together to achieve this. The electronic device 102 may include one or more processors 1021, memory 1022, and I / O interface 1023 for interacting with the computer device 101.
[0054] In this embodiment of the invention, the aforementioned computer device 101 can generate a video stream. After generating the video stream, the computer device 101 can send the video stream to the electronic device 102 via the network 103. The electronic device 102 can receive the video stream sent by the computer device 101 through the I / O interface 1023, and then use the processor 1021 to parse the video stream to obtain multiple frames of video data, the current frame rate per second (FPS), and the target frame rate per second (FPS) carried in the video stream; based on the current frame rate per second (FPS) and the target frame rate per second (FPS), a transmission deviation is determined; and based on the transmission deviation and a preset adaptive caching rule, the cache size of the target cache space is determined, and the multiple frames of video data are cached in the target cache space. Further, the playback speed of the multiple frames of video data can be determined based on the cache size of the target cache space, the current data cache size, and the cache playback interval rule, and the multiple frames of video data are played at the playback speed.
[0055] In specific implementation, multiple electronic devices 102 may interact with multiple computer devices 101, one electronic device 102 may interact with multiple computer devices 101, or one electronic device 102 may interact with one computer device 101. No limitation is made in this embodiment of the invention. Figure 1 The example shown is an interaction between an electronic device 102 and a computer device 101.
[0056] In this embodiment of the invention, the electronic device 102 may be, for example, a tablet computer (PAD), a personal computer (PC), a smartphone, a smart TV, a smart in-vehicle device, or a wearable device that can receive and play audio and video. This embodiment of the invention does not limit the scope of the invention.
[0057] In this embodiment of the invention, the computer device 101 may be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDN), and big data and artificial intelligence platforms, or it may be a physical server, but it is not limited to these.
[0058] The computer device 101 and the electronic device 102 can communicate with each other through one or more networks 103. The network 103 can be a wired network or a wireless network. For example, the wireless network can be a mobile cellular network or a Wi-Fi (Wi-Fi) network. Of course, it can also be other possible networks. This embodiment of the invention does not limit the types of networks.
[0059] Of course, the method provided in the embodiments of the present invention is not limited to... Figure 1 The application scenarios shown can also be used in other possible scenarios, such as implementing video playback methods only on electronic devices; the embodiments of the present invention do not impose limitations. Figure 1 The functions that each device in the application scenario shown can achieve will be described in subsequent method embodiments, and will not be elaborated on here.
[0060] To further illustrate the video playback method provided in the embodiments of the present invention, a detailed description is provided below in conjunction with the accompanying drawings and specific implementation methods. Although the embodiments of the present invention provide method operation steps as shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on conventional or non-inventive methods. In steps where there is no logically necessary causal relationship, the execution order of these steps is not limited to the execution order provided in the embodiments of the present invention. In actual processing or when the device executes the method, it may be executed in the order shown in the embodiments or drawings, or in parallel (e.g., in an application environment with parallel processors or multi-threaded processing).
[0061] The following combination Figure 2 The flowchart shown illustrates the video playback method in this embodiment of the invention. The method can be executed by an electronic device, which can be the aforementioned terminal device. The specific implementation flow of the method is as follows:
[0062] Step 201: Receive the video stream to be played and parse the video stream to obtain multi-frame video data, the current frame rate per second (FPS), and the target frame rate per second (FPS) carried in the video stream.
[0063] In this embodiment of the invention, the electronic device can receive a video stream transmitted over a network, then parse the video stream to obtain complete multi-frame video data, the current frames per second (FPS), and the target FPS carried in the video stream. For example, the current FPS is 5 frames per second, and the target FPS is 15 frames per second.
[0064] The video stream can be a video with a duration of less than 5 minutes (e.g., short videos in the prior art); it can also be a video with a duration of more than 5 minutes (e.g., long videos in the prior art); the video stream can also be a video generated in a live broadcast room or conference room. In this embodiment of the invention, the source and content of the video stream are not limited. It should be noted that the video stream in this embodiment of the invention can be understood as an information stream including both audio and video.
[0065] Step 202: Determine the transmission deviation based on the current frame rate per second (FPS) and the target frame rate per second (FPS); and determine the cache size of the target cache space based on the transmission deviation and the preset adaptive caching rules, and cache multiple frames of video data into the target cache space.
[0066] In this embodiment of the invention, after obtaining the current frame rate per second (FPS) and the target frame rate per second (FPS), the transmission deviation can be determined using, but is not limited to, the following steps:
[0067] Step A: Determine the current frame rate (FPS) based on the reception time of the current frame of the received video data and the reception time of the previous frame;
[0068] Step B: Take the absolute value of the difference between the current frame rate per second (FPS) and the target frame rate per second (FPS) as the transmission deviation.
[0069] If t is used n The time of reception of the current frame is represented by t. n-1 When the previous frame of the current frame was received, the current frame rate (FPS) is F. net (n)=1 / (t n -t n-1 Furthermore, the transmission deviation can be determined to be e. FPS (n)=|F n (n)-F net (n)|。 Where, F n (n) is used to represent the target's frames per second (FPS), e FPS (n) is used to represent the transmission deviation, and n is used to represent the number of frames.
[0070] In this embodiment of the invention, after obtaining the transmission deviation, the cache size of the target cache space is determined based on the transmission deviation and the preset adaptive caching rules.
[0071] In this embodiment of the invention, the electronic device can use the product of a first weight value and a transmission deviation as a transmission ratio value; the transmission ratio value is used to indicate the degree of influence of network fluctuations on video stream playback; the difference between the transmission deviation of the previous frame and the transmission deviation of the current frame is determined, and the product of the difference and the second weight value is used as a differential control value; the differential control value is used to indicate the degree of jitter in buffer control. The first weight value and the second weight value are preset values that can be set and updated according to actual implementation. The transmission deviation of the previous frame can be determined based on the previous frame's frames per second (FPS) and the target frame per second (FPS). Then, the buffer size of the target buffer space can be determined according to the transmission ratio value, the differential control value, and the buffer space adjustment rules; wherein the buffer space adjustment rules include the correspondence between the transmission ratio value, the differential control value, and the buffer size.
[0072] For example, the transmission ratio value in the correspondence has 5 first range intervals, and the differential control value has 5 second range intervals. Any first range interval and any second range interval are combined to form a set of interval combinations, and each interval combination corresponds to a buffer size. In this way, the transmission ratio value of the current frame is in the first range interval 1, and the differential control value is in the second range interval 2. Thus, the buffer size corresponding to the first range interval 1 and the second range interval 2 can be determined, and this buffer size is used as the buffer size of the target buffer space.
[0073] For example, in the correspondence, the sum of the transmission ratio value and the differential control value is used as the buffer size to determine the buffer size of the target buffer space.
[0074] Optionally, considering the mutual influence and coordination between the transmission ratio value and the differential control value, this example can also perform an overall judgment process on the differential control value and the transmission ratio value based on certain rules to determine an overall control value. The cache space adjustment rules can then include a correspondence between the overall control value and the cache size. For example, in this correspondence, the overall control value corresponds to five range intervals, and each range interval corresponds to a cache size. Thus, the cache size of the target cache space can be determined based on the range interval in which the overall control value falls. Alternatively, in the comparison relationship, the overall control value can be used as the cache size to obtain the cache size of the target cache space.
[0075] In this embodiment of the invention, the overall control value is determined based on the differential control value and the transmission ratio value. For example, please refer to... Figure 3 The overall control value can be expressed as:
[0076] u(n) = K p e FPS (n)+K d (e FPS (n)-e FPS(n-1))
[0077] Where u(n) represents the overall control value, K P Used to represent the first weight value, K d The second weight value is used to characterize the second weight value, and n represents the frame order of the frame image. For example, when n is 3, it represents the 3rd frame obtained after parsing the video stream.
[0078] It can be seen that when F n (n)>F real When (n), it means that the current frame rate per second (FPS) of the video stream data sent from the network to the electronic device is greater than the target frame rate per second (FPS) of the video stream, and it can be determined that the buffer size needs to be increased to receive the influx of video streams. When F n (n) < F real When (n), it indicates that the current frame rate (FPS) of the video stream data sent from the network to the electronic device is less than the target frame rate (FPS) of the video stream. Therefore, the buffer size needs to be increased; otherwise, the buffered video data will be consumed quickly, leading to stuttering due to a lack of video data for decoding and rendering. When F... n (n)=F real (n) is e FPS When (n) = 0, it means that the current frame rate per second (FPS) of the video stream data sent from the network to the electronic device is consistent with the target frame rate per second (FPS) of the video stream. In this case, real-time performance is guaranteed and no buffering is required.
[0079] In this embodiment of the invention, considering the severe network jitter, it is assumed that controlling the buffer size solely based on proportional control would be inaccurate. Therefore, this embodiment of the invention also introduces a differential control value, wherein when e... FPS (n)>e FPS (n-1) indicates that the cache size is expanding, so its expansion can be reduced. FPS (n) < e FPS When (n-1), it indicates that the cache size is decreasing, so this decrease can be mitigated. When e FPS (n)=e FPS When K = (n-1), it means the video stream sent by the network is jitter-free, and the differential control value has no effect. d Take the negative value.
[0080] In this embodiment of the invention, considering that the cache size cannot be infinite, a maximum cache value Y needs to be set externally. MAX When the network condition is optimal, the cache size can be 0, which is the real-time state with zero cache. Therefore, the executor y(n) that ultimately adjusts the cache size can be described as:
[0081]
[0082] In other words, in this embodiment of the invention, a maximum cache size can be set, and then the cache size of the target cache space can be dynamically adjusted within the maximum value range according to the overall control value and cache space adjustment rules.
[0083] Step 203: Determine the playback speed of the multi-frame video data based on the cache size of the target cache space, the current data cache size, and the cache playback interval rules, and play the multi-frame video data at the playback speed.
[0084] In this embodiment of the invention, the electronic device can determine the proportion of the current data cache size within the target cache space; according to the cache playback interval rule, it filters the target playback interval that matches the proportion value, and uses the playback speed corresponding to the target playback interval as the playback speed of the multi-frame video data. The cache playback interval rule is used to indicate the target playback interval to be matched based on the interval where the proportion value is located.
[0085] For example, please see Figure 4 , Figure 4 This is a diagram illustrating the buffer playback intervals. Specifically, the target buffer space can be divided according to a ratio of slow-motion buffer interval: normal speed buffer interval: fast buffer interval = 0.2:0.6:0.2.
[0086] Optionally, if the target playback interval that matches the proportion value is determined to be the fast-forward buffer interval of the currently calculated theoretical buffer (i.e. Figure 4 When the video data is in the normal speed buffer range (in the fast-forward buffer range), the video decoding and playback module in the electronic device needs to be fine-tuned and the video frames consumed at 1.2 times speed so that the currently buffered video data falls into the normal speed buffer range for playback as soon as possible.
[0087] Optionally, if the target playback interval that matches the proportion value is determined to be the constant speed buffer interval of the currently calculated theoretical buffer (i.e. Figure 4 When the constant speed buffer interval is reached, the video decoding and playback module in the electronic device is fine-tuned and video frames are consumed at 1.0 times.
[0088] Optionally, if the target playback interval that matches the proportion value is determined to be the currently calculated theoretical buffer slow-motion theoretical buffer interval (i.e. Figure 4 When the frame rate is slowed down (in the slow-motion buffer interval), it indicates that the delay needs to be increased. At this time, the video decoding and playback module in the electronic device can be fine-tuned and the video frames can be played at 0.8 times speed to reduce frame consumption.
[0089] In this way, no matter how the buffer size is adjusted, the video playback speed will be brought back to the range of normal buffer playback speed, thereby improving the smoothness of video stream playback.
[0090] In the embodiments of the invention, the network fluctuation can be determined based on the current number of frames transmitted per second and the target number of frames transmitted per second obtained from the parsing of the video stream, thereby enabling accurate and rapid determination of the actual applicable target cache space for caching the video stream.
[0091] Based on the same inventive concept, embodiments of the present invention provide a video playback device capable of implementing the functions corresponding to the aforementioned video playback method. This video playback device can be a hardware structure, a software module, or a hardware structure plus a software module. The video playback device can be implemented using a chip system, which can consist of chips or include chips and other discrete components. Please refer to [link to previous text]. Figure 5 As shown, the video playback device includes: a parsing unit 501, an adaptive buffer control unit 502, and a playback unit 503, wherein:
[0092] The parsing unit 501 is used to receive the video stream to be played and parse the video stream to obtain multi-frame video data, the current frame rate per second (FPS) and the target frame rate per second (FPS) carried in the video stream.
[0093] The adaptive caching control unit 502 is used to determine the transmission deviation based on the current frame rate per second (FPS) and the target frame rate per second (FPS); and to determine the cache size of the target cache space based on the transmission deviation and a preset adaptive caching rule, and to cache the multi-frame video data into the target cache space.
[0094] The playback unit 503 is used to determine the playback speed of the multi-frame video data based on the cache size of the target cache space, the current data cache size, and the cache playback interval rules, and to play the multi-frame video data at the playback speed.
[0095] In one possible implementation, the adaptive cache control unit 502 is specifically used for:
[0096] The current frame rate (FPS) is determined based on the reception time of the current frame of the video data and the reception time of the previous frame.
[0097] The absolute value of the difference between the current frame rate per second (FPS) and the target frame rate per second (FPS) is used as the transmission deviation.
[0098] In one possible implementation, the adaptive cache control unit 502 is specifically used for:
[0099] The product of the first weight value and the transmission deviation is used as the transmission ratio value; the transmission ratio value is used to indicate the degree of influence of network fluctuations on the video stream playback.
[0100] The difference between the transmission deviation of the previous frame and the transmission deviation is determined, and the product of the difference and the second weight value is used as the differential control value; the differential control value is used to indicate the degree of jitter in buffer control.
[0101] The cache size of the target cache space is determined based on the transmission ratio value, the differential control value, and the cache space adjustment rule; wherein, the cache space adjustment rule includes the correspondence between the transmission ratio value, the differential control value, and the cache size.
[0102] In one possible implementation, the playback unit 503 is specifically used for:
[0103] Determine the proportion of the current data cached amount in the cached amount of the target cache space;
[0104] According to the cached playback interval rules, target playback intervals that match the percentage value are selected, and the playback speed corresponding to the target playback interval is used as the playback speed of the multi-frame video data.
[0105] All relevant content of each step involved in the aforementioned video playback method embodiments can be referenced to the functional description of the corresponding functional module of the video playback device in the embodiments of the present invention, and will not be repeated here.
[0106] The module division in this embodiment of the invention is illustrative and represents only one logical functional division. In actual implementation, other division methods may be used. Furthermore, the functional modules in the various embodiments of the invention can be integrated into a single controller, exist as separate physical entities, or be integrated into a single module. The integrated modules described above can be implemented in hardware or as software functional modules.
[0107] Based on the same inventive concept, embodiments of the present invention provide an electronic device, please refer to... Figure 6 As shown, the electronic device includes at least one processor 601 and a memory 602 connected to the at least one processor. In this embodiment of the invention, the specific connection medium between the processor 601 and the memory 602 is not limited. Figure 6 Taking the connection between processor 601 and memory 602 via bus 600 as an example, bus 600 in... Figure 6 The connections between other components are indicated by thick lines and are for illustrative purposes only, not as limiting information. The 600 bus can be divided into address bus, data bus, control bus, etc., for ease of representation. Figure 6The bus is represented by only one thick line, but this does not mean that there is only one bus or one type of bus. In addition, the video playback device also includes a communication interface 603 for receiving or sending data.
[0108] In this embodiment of the invention, the memory 602 stores instructions that can be executed by at least one processor 601. By executing the instructions stored in the memory 602, at least one processor 601 can perform the steps included in the aforementioned video playback method.
[0109] The processor 601 is the control center of the electronic device. It can connect to various parts of the electronic device through various interfaces and lines. By running or executing instructions stored in the memory 602 and calling data stored in the memory 602, it can monitor the various functions and data processing of the electronic device as a whole.
[0110] Optionally, processor 601 may include one or more processing units. Processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into processor 601. In some embodiments, processor 601 and memory 602 may be implemented on the same chip; in some embodiments, they may be implemented separately on independent chips.
[0111] Processor 601 can be a general-purpose processor, such as a central processing unit (CPU), digital signal processor, application-specific integrated circuit, field-programmable gate array or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component, capable of implementing or executing the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as being executed by a hardware processor, or executed by a combination of hardware and software modules within the processor.
[0112] Memory 602, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules. Memory 602 may include at least one type of storage medium, such as flash memory, hard disk, multimedia card, card-type memory, random access memory (RAM), static random access memory (SRAM), programmable read-only memory (PROM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), magnetic storage, magnetic disk, optical disk, etc. Memory 602 can be any other medium capable of carrying or storing desired program code in the form of instructions or data structures that can be accessed by a computer, but is not limited thereto. In embodiments of the present invention, memory 602 can also be a circuit or any other device capable of implementing storage functions for storing program instructions and / or data.
[0113] By designing and programming the processor 601, the code corresponding to the video playback method described in the foregoing embodiments can be embedded into the chip, thereby enabling the chip to execute the steps of the aforementioned video playback method during operation. How to design and program the processor 601 is a technique known to those skilled in the art, and will not be elaborated here.
[0114] Based on the same inventive concept, embodiments of the present invention also provide a computer-readable storage medium including program code, which, when the program product is run on an electronic device, is used to cause the electronic device to perform the steps of the video playback method described above.
[0115] In some possible implementations, various aspects of the video playback method provided by the present invention can also be implemented as a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the steps of the video playback method according to various exemplary embodiments of the present invention described above.
[0116] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0117] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0118] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0119] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0120] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of the claims of this invention and their equivalents, this invention also intends to include these modifications and variations.
Claims
1. A video playback method, characterized in that, The method includes: Receive the video stream to be played and parse the video stream to obtain multiple frames of video data, the current frame rate per second (FPS), and the target frame rate per second (FPS) carried in the video stream; Based on the current frame rate per second (FPS) and the target frame rate per second (FPS), determine the transmission deviation; and based on the transmission deviation and the preset adaptive caching rules, determine the cache size of the target cache space, and cache the multi-frame video data into the target cache space. Based on the cache size of the target cache space, the current data cache size, and the cache playback interval rules, the playback speed of the multi-frame video data is determined, and the multi-frame video data is played at the specified playback speed. The step of determining the cache size of the target cache space based on the transmission deviation and the preset adaptive caching rules includes: The product of the first weight value and the transmission deviation is used as the transmission ratio value; wherein, the transmission ratio value is used to indicate the degree of influence of network fluctuations on the video stream playback; The difference between the transmission deviation of the previous frame and the current frame is determined, and the product of the difference and the second weight value is used as the differential control value; wherein, the differential control value is used to indicate the degree of jitter in buffer control; The cache size of the target cache space is determined based on the transmission ratio value, the differential control value, and the cache space adjustment rule; wherein, the cache space adjustment rule includes the correspondence between the transmission ratio value, the differential control value, and the cache size.
2. The method as described in claim 1, characterized in that, Based on the current frames per second (FPS) and the target frames per second (FPS), the transmission deviation is determined, including: The current frame rate (FPS) is determined based on the reception time of the current frame of the video data and the reception time of the previous frame. The absolute value of the difference between the current frame rate per second (FPS) and the target frame rate per second (FPS) is used as the transmission deviation.
3. The method as described in claim 1 or 2, characterized in that, The playback speed of the multi-frame video data is determined based on the cache size of the target cache space, the current data cache size, and the cache playback interval rules, including: Determine the proportion of the current data cached amount in the cached amount of the target cache space; According to the cached playback interval rules, target playback intervals that match the percentage value are selected, and the playback speed corresponding to the target playback interval is used as the playback speed of the multi-frame video data.
4. A video playback device, characterized in that, The device includes: The parsing unit is used to receive the video stream to be played and parse the video stream to obtain multi-frame video data, the current frame rate per second (FPS), and the target frame rate per second (FPS) carried in the video stream. An adaptive caching control unit is used to determine the transmission deviation based on the current frame rate per second (FPS) and the target frame rate per second (FPS); and to determine the cache size of the target cache space based on the transmission deviation and a preset adaptive caching rule, and to cache the multi-frame video data into the target cache space. The playback unit is used to determine the playback speed of the multi-frame video data based on the cache size of the target cache space, the current data cache size, and the cache playback interval rules, and to play the multi-frame video data at the playback speed. Specifically, the adaptive cache control unit is used for: The product of the first weight value and the transmission deviation is used as the transmission ratio value; wherein, the transmission ratio value is used to indicate the degree of influence of network fluctuations on the video stream playback; The difference between the transmission deviation of the previous frame and the current frame is determined, and the product of the difference and the second weight value is used as the differential control value; wherein, the differential control value is used to indicate the degree of jitter in buffer control; The cache size of the target cache space is determined based on the transmission ratio value, the differential control value, and the cache space adjustment rule; wherein, the cache space adjustment rule includes the correspondence between the transmission ratio value, the differential control value, and the cache size.
5. The apparatus as described in claim 4, characterized in that, The adaptive cache control unit is specifically used for: The current frame rate (FPS) is determined based on the reception time of the current frame of the video data and the reception time of the previous frame. The absolute value of the difference between the current frame rate per second (FPS) and the target frame rate per second (FPS) is used as the transmission deviation.
6. The apparatus as claimed in claim 4 or 5, characterized in that, The playback unit is specifically used for: Determine the proportion of the current data cached amount in the cached amount of the target cache space; According to the cached playback interval rules, target playback intervals that match the percentage value are selected, and the playback speed corresponding to the target playback interval is used as the playback speed of the multi-frame video data.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1-3.
8. A computer-readable storage medium, characterized in that, It includes program code that, when the program product is run on an electronic device, causes the electronic device to perform the steps of the method described in any one of claims 1-3.