Video playback method and system, device, and storage medium
Patent Information
- Application Number
- PCT/CN2025/077180
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-06
- Filing Date
- 2025-02-13
- Publication Date
- 2025-10-02
AI Technical Summary
In real-time streaming scenarios such as live broadcasting or surveillance, long video playback delays and slow loading times in the initial stages of playback affect the user experience.
The acquisition end determines the key frame position and original playback parameters of the cached video frame, adjusts them to the target playback parameters, generates the target bitstream, and sends it to the streaming server for decoding and playback by the playback end; the playback end controls the bitstream decoding and playback based on the custom protocol data and playback parameters, and adjusts the display timestamp to match the frame rate.
It achieves seamless fast-forwarding of video images, reduces video delay, improves premiere speed and user experience, and reduces the computing pressure on streaming media servers.
Smart Images

Figure CN2025077180_02102025_PF_FP_ABST
Abstract
Description
Video playback method, system, device, and storage medium
[0001] CROSS-REFERENCE TO RELATED APPLICATIONS
[0002] The present disclosure claims priority from application number 202410257163.1, application date March 6, 2024, and invention title: Video Playback Method and System, Device, and Storage Medium. The entire contents of the Chinese patent application are incorporated herein by reference. Technical Field
[0003] The present disclosure relates to the field of streaming media technology, and in particular to a video playback method and system, device, and storage medium. Background Art
[0004] In real-time streaming scenarios such as live broadcasts or surveillance, video data is mostly stored in streaming servers. When playing the video on the playback end, the playback end pulls the data from the streaming server and decompresses it for playback. This method results in large playback delays and poor user experience due to the large time difference between the pulled streaming data and the real-time image. In addition, when the data volume is large, due to the resource limitations of the streaming server, it is easy to cause slow loading in the initial stage of playback, affecting the user experience.
[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute prior art known to ordinary technicians in the field. Summary of the Invention
[0006] According to a first aspect of the present disclosure, a video playback method is provided, which is applied to an acquisition end and includes:
[0007] In response to receiving a video playback request, determining a key frame position and original playback parameters of a currently cached video frame; the original playback parameters being determined based on a configured frame rate;
[0008] According to the key frame position, adjusting the original playback parameters to obtain target playback parameters;
[0009] generating a target bitstream for the cached video frame according to the target playback parameters;
[0010] The target code stream is sent to the streaming media server, so that the playback terminal pulls the target code stream from the streaming media server and decodes and plays the target code stream based on the target playback parameters.
[0011] Optionally, the method further includes:
[0012] Acquire original video frames in real time, and encode the original video stream to obtain corresponding encoded video data;
[0013] Starting from the key frame in the encoded video data, a specified number of video frames are cached to obtain the cached video frames.
[0014] Optionally, the method further includes:
[0015] In response to acquiring a new key frame, the cached video frame is updated using the new key frame.
[0016] Optionally, adjusting the original playback parameters to obtain target playback parameters according to the key frame position includes:
[0017] In response to the key frame not being the current cache frame, the original playback parameters are adjusted according to the distance between the current cache frame and the key frame to obtain the target playback parameters.
[0018] Optionally, the method further includes:
[0019] In response to the key frame being the current cache frame, an original code stream generated based on the current cache frame is sent to the streaming server, so that the playback terminal pulls the original code stream from the streaming server and decodes and plays it based on the original playback parameters.
[0020] Optionally, the method further includes:
[0021] Determine a corresponding playback mode according to playback parameters; the playback parameters are original playback parameters or target playback parameters;
[0022] Using the playback mode as a custom field to generate custom protocol data;
[0023] Encapsulate the custom protocol data according to a preset format to obtain a custom array;
[0024] The custom array is inserted into a target position of a standard bitstream to obtain a transmission bitstream, where the target position is a position before a key frame in the standard bitstream, and the standard bitstream is generated based on the cached video frame and a standard protocol.
[0025] According to a second aspect of the present disclosure, a video playback method is provided, which is applied to a playback terminal and includes:
[0026] In response to receiving a target pull address sent by a streaming media server, pulling a to-be-played stream corresponding to the target pull address from the streaming media server, the to-be-played stream including custom protocol data and playback parameters, the custom protocol data being used to indicate a playback mode of the to-be-played stream;
[0027] Controlling the decoding and playback of the to-be-played code stream according to the playback parameters and the playback mode;
[0028] The playback parameters include target playback parameters, which are obtained by the acquisition end by adjusting original playback parameters according to the key frame position of the currently cached cached video frame, and the original playback parameters are determined by the acquisition end based on the configured frame rate.
[0029] Optionally, when the playback mode is the first playback mode and the playback parameter is a target playback parameter, controlling the decoding and playback of the to-be-played code stream according to the playback parameter and the playback mode includes:
[0030] According to the target playback parameters, the decoding and playback of the to-be-played code stream is controlled in accordance with the first playback mode.
[0031] Optionally, controlling the decoding and playback of the to-be-played code stream according to the first playback mode based on the target playback parameter includes:
[0032] Determining the original display time of each video frame in the to-be-played code stream according to the target playback parameter;
[0033] For the first video frame in the stream to be played, the original display time is used as the actual display time;
[0034] For a video frame other than the first video frame in the to-be-played code stream, determining an actual display time of the current frame according to a difference in original display time between the current frame and a previous frame and an actual display time of the previous frame;
[0035] The playback of the to-be-played code stream is controlled according to the actual display time corresponding to each video frame.
[0036] Optionally, when the playback mode is the second playback mode and the playback parameters are original playback parameters, the method further includes:
[0037] According to the original playback parameters, the decoding and playback of the to-be-played code stream is controlled in accordance with the second playback mode.
[0038] Optionally, controlling the decoding and playback of the to-be-played code stream according to the second playback mode based on the original playback parameters includes:
[0039] Determining the original display time of each video frame in the to-be-played code stream according to the original playback parameters;
[0040] For the first video frame in the stream to be played, the original display time is used as the actual display time;
[0041] For a video frame other than the first video frame in the to-be-played code stream, determining an actual display time of the current frame according to the frame rate and the frame order of the current frame in the to-be-played code stream;
[0042] The playback of the to-be-played code stream is controlled according to the actual display time corresponding to each video frame.
[0043] According to a third aspect of the present disclosure, a video acquisition terminal device is provided, comprising:
[0044] a parameter determination module, in response to receiving a video playback request, determining a key frame position and original playback parameters of a currently cached video frame; the original playback parameters being determined based on a configured frame rate;
[0045] A parameter adjustment module, adjusting the original playback parameters according to the key frame position to obtain target playback parameters;
[0046] A stream generation module, which generates a target stream for the cached video frame according to the target playback parameters;
[0047] The push stream module sends the target code stream to the streaming media server, so that the playback terminal pulls the target code stream from the streaming media server and decodes and plays it based on the target playback parameters.
[0048] According to a fourth aspect of the present disclosure, a video playback device is provided, comprising:
[0049] a stream pulling module configured to, in response to receiving a target pull address sent by a streaming media server, pull a to-be-played stream corresponding to the target pull address from the streaming media server, wherein the to-be-played stream includes custom protocol data and playback parameters, wherein the custom protocol data is used to indicate a playback mode of the to-be-played stream;
[0050] A playback control module is configured to control the decoding and playback of the to-be-played code stream according to the playback parameters and the playback mode;
[0051] The playback parameters include target playback parameters, which are obtained by the acquisition end by adjusting original playback parameters according to the key frame position of the currently cached cached video frame, and the original playback parameters are determined by the acquisition end based on the configured frame rate.
[0052] According to a fifth aspect of the present disclosure, a video playback system is provided, comprising at least one of the video acquisition end device and the video playback end device in the above embodiments.
[0053] According to a sixth aspect of the present disclosure, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the video playback method in the above embodiment is implemented.
[0054] According to the seventh aspect of the present disclosure, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the video playback method as in the above-mentioned embodiment.
[0055] According to an eighth aspect of the present disclosure, a computer program product is provided. When the product is run on a computer, the computer program product includes a software code portion for executing the steps of the video playback method of any of the above embodiments.
[0056] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] The accompanying drawings are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification, are used to explain the principles of the present disclosure. Obviously, the drawings described below are only some embodiments of the present disclosure, and those skilled in the art can derive other drawings based on these drawings without inventive effort.
[0058] FIG1 schematically shows a system architecture diagram of a video playback method according to an embodiment of the present disclosure.
[0059] FIG2 schematically shows one of the flow charts of a video playback method according to an embodiment of the present disclosure.
[0060] FIG3 schematically shows a schematic diagram of buffering video frames according to an embodiment of the present disclosure.
[0061] FIG4 schematically shows a schematic diagram of a case where the current frame is the last frame of a buffered video frame according to an embodiment of the present disclosure.
[0062] FIG5 schematically shows a schematic diagram of the decoding time and display time of each frame in the cached video frames according to an embodiment of the present disclosure.
[0063] FIG6 schematically shows a schematic diagram of a code stream generation process according to an embodiment of the present disclosure.
[0064] FIG. 7 schematically shows a second flowchart of a video playback method according to an embodiment of the present disclosure.
[0065] FIG8 schematically shows a third flowchart of a video playback method according to an embodiment of the present disclosure.
[0066] FIG9 schematically shows a structural block diagram of a video acquisition terminal device according to an embodiment of the present disclosure.
[0067] FIG10 schematically shows a structural block diagram of a video playback terminal device according to an embodiment of the present disclosure.
[0068] FIG11 schematically shows a module diagram of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0069] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be embodied in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
[0070] In addition, the accompanying drawings are merely schematic illustrations of the present disclosure and are not necessarily drawn to scale. Identical reference numerals in the figures denote identical or similar parts, and thus repetitive descriptions thereof will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities that do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in software, in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0071] In live video streaming or video surveillance scenarios, due to the delay between the video acquisition and playback ends, the playback end often encounters problems such as slow loading and long video delays due to video caching. Since fast video start-up and low latency are key system performance requirements, this may cause the system to fail to meet these standards. Furthermore, this playback method provides a poor user experience. To address these issues in real-time media streaming scenarios, the present disclosure provides a video playback method.
[0072] FIG1 shows an exemplary system architecture diagram to which the video playback method of the embodiment of the present disclosure can be applied. As shown in FIG1 , the system architecture may include: an acquisition terminal device 110, a server 120, and a playback terminal device 130, etc. Among them, the acquisition terminal device 110 may be a device with video acquisition and video processing functions, such as a camera / camcorder with data processing functions, a smart phone, or other smart terminals with camera functions, etc. The server 120 may be a streaming media server, which may be used for bitrate control, IO processing, and contention processing, etc. The playback terminal device 130 is a terminal device that can play and display videos, for example, the playback terminal device 130 may be a monitor in a monitoring room, a mobile terminal (such as a smart phone, tablet, computer), or a smart display screen, etc.
[0073] In one embodiment of the present disclosure, a video playback method is proposed. FIG2 shows a flow chart of the video playback method. As shown in FIG2 , the video playback method can be applied to an acquisition end and includes at least the following steps:
[0074] Step S210 , in response to receiving a video playback request, determining a key frame position and original playback parameters of a currently cached video frame; the original playback parameters are determined based on a configured frame rate.
[0075] Step S220: adjusting the original playback parameters according to the key frame positions to obtain target playback parameters.
[0076] Step S230: generating a target bitstream for the buffered video frames according to the target playback parameters.
[0077] Step S240: sending the target code stream to the streaming server, so that the player can pull the target code stream from the streaming server and decode and play it based on the target playback parameters.
[0078] The video playback method of the embodiment of the present disclosure can determine the key frame position of the cached video frame currently cached and the original playback parameters determined based on the configured frame rate when receiving a video playback request; adjust the original playback parameters according to the key frame position to obtain the target playback parameters, and generate a target code stream for the cached video frame according to the target playback parameters; send the target code stream to the streaming media server so that the playback end pulls the target code stream from the streaming media server and decodes and plays based on the target playback parameters. On the one hand, the playback parameters can be adjusted according to the position of the key frame in the cached video frame so that the playback frame of the playback end can reach the real-time encoding frame at the current moment as soon as possible, thereby achieving a senseless fast forward of the video picture. While reducing the video delay, the user will not notice the obvious fast forward of the video picture, thereby improving the user experience. On the other hand, by performing video caching and playback parameter adjustment on the acquisition end, the pressure on the streaming media server is relieved. When the video playback volume is large, the computing pressure of the streaming media server is dispersed to different acquisition end devices, thereby solving the problem of slow loading in the initial stage of playback caused by the instantaneous burst of computing power of the streaming media server, improving the first broadcast speed, and achieving fast video playback.
[0079] In order to make the technical solution of the present disclosure clearer, each step of the video playback method is described below.
[0080] In step S210 , in response to receiving a video playback request, a key frame position and original playback parameters of a currently cached video frame are determined.
[0081] In this exemplary embodiment, the video playback request may be a request for the video stream address of a target video. The video playback request may include information such as the target video identifier and user identifier (e.g., username and password). The playback end may send a video playback request to a streaming media server. After authentication by the streaming media server (determining whether the current user has permission to play the target video), the video playback request is sent to the acquisition end. Upon receiving the video playback request, the acquisition end determines the key frame position and original playback parameters of the current cached video frame. The key frame position may be the positional relationship between the key frame and the current frame, for example, whether the key frame is the current frame. If so, the key frame position is 1, otherwise it is 0.
[0082] In this exemplary embodiment, the original playback parameters refer to the playback parameters determined during the video encoding process. During the video encoding process, I, P, and B frames are obtained. The decoding conditions of each video frame are different, which may cause the decoding order and playback order of each encoded frame to be inconsistent. For example, the video frame decoded first may be played later, while the video frame decoded later may be played earlier. Therefore, the playback parameters may include decoding time and display time. For example, the playback parameters may include a decoding timestamp DTS and a display timestamp PTS. DTS is used to enable the playback end to decode the frame data at the corresponding time, and PTS is used to enable the playback end to display the frame data at the corresponding time. The decoding time of each frame can be determined by the decoding time of the first frame and the decoding time increment of the adjacent frames, and the display time of each frame can be determined by the display time of the first frame and the display time increment of the adjacent frames. Therefore, the playback parameters may include the decoding time, display time, decoding time increment, and display time increment of the first frame. The current moment can be used as the decoding time and display time of the first frame. The original playback parameters are playback parameters generated during the encoding process based on the configured frame rate (the playback parameters are the inverse of the frame rate). They are stored in a data structure and sent to the playback end so that the playback end controls the decoding and display of each frame based on the DTS and PTS. Exemplarily, the playback parameters include the decoding time interval between adjacent frames (i.e., the decoding timestamp increment ΔDTS) and the display time interval (i.e., the display timestamp increment ΔPTS). For example, when the configured video frame rate is 25fps, the original playback parameter ΔDTS = ΔPTS = 40ms.
[0083] In this example implementation, cached video frames can be stored in a target cache on the capture end. The encoded results of the real-time captured raw video stream can be cached. Video frame caching occurs in real time, meaning it continues in real time regardless of whether a video playback request is received. The size of the cached video frames can be set based on the storage and computing resources available at the capture end, as well as the available transmission bandwidth. Because key frames are crucial for image analysis, the cached video frames must include at least one key frame.
[0084] In some embodiments, the acquisition end obtains the original video stream from the acquisition device in real time, encodes the original video stream, and obtains corresponding encoded video data; starting from the key frame in the encoded video data, a specified number of video frames are cached to obtain cached video frames.
[0085] In this exemplary embodiment, the acquisition end may include an acquisition unit and a processing unit. The acquisition unit acquires a real-time raw video stream (real-time images, such as YUV video data) and sends the raw video stream to the processing unit. The processing unit encodes the raw video stream according to a preset video coding standard (such as H264 or H265 coding) to obtain encoded video data. The acquisition unit and the processing unit can be integrated into the same terminal device or provided on different interconnected devices, which is not limited in this example. As shown in Figure 3, the encoded video data after encoding may include I frames, P frames, and B frames. I frames represent key frames. Generally, decoding I frame data can parse an image. P frames represent predicted frames. During decoding, the decoded image of the current frame is superimposed on the image buffered by the previous I frame or P frame to generate a complete image. B frames refer to the previous I frame or P frame and the next P frame to generate a complete image. P frames can improve compression efficiency and image quality, while B frames can increase the compression ratio.
[0086] Considering that only key frames can be immediately decoded to produce corresponding images for playback, this example starts caching video frames from the key frames, so that the playback end can quickly start playback based on the first decoded frame; the key frame and a specified number of video frames thereafter can be cached. Considering the bandwidth occupancy problem in the process of caching video frames, the specified number can be no more than the number of frames in a GOP (Group of Pictures) group (i.e., 1-2 seconds of video) to avoid playback stuttering in the event of a large traffic burst. For example, as shown in FIG3 , a GOP of encoded video data can be cached starting from the key frame. This example caches the video starting from the latest I frame, so that the first frame of the cached video frame is an I frame, thereby ensuring that the first frame of the video frame sent to the playback end is an I frame, thereby achieving rapid playback startup on the playback end.
[0087] Exemplarily, in response to acquiring a new key frame, the cached video frame is updated using the new key frame.
[0088] In this exemplary embodiment, the cached video frames are stored in the target cache at the acquisition end, and only the most recent key frame is stored in the target cache. When a new key frame is obtained, the key frame can be used to update the cached video frames in the target cache. For example, the cached video frames in the target cache can be cleared and the new key frame can be stored in the target cache. In this example, when a new key frame appears, the cached video frames are updated with the new key frame, so that the cached video frames always have the most recent key frame, which can reduce the playback delay to a certain extent.
[0089] In step S220 , the original playback parameters are adjusted according to the key frame positions to obtain target playback parameters.
[0090] In this exemplary embodiment, taking into account the situation where different positional relationships between key frames and current frames lead to different delays at the playback end, playback parameters can be adjusted for the positional relationships between different key frames and current frames. For example, when the key frame is the current frame, the playback end can immediately decode and play. At this time, there is no playback delay due to the key frame, and playback parameter adjustment is not required. When the key frame is not the current frame, there will be a certain delay at the playback end, and playback parameter adjustment can be performed to alleviate the playback delay problem at the playback end. The maximum playback delay is related to the number of cached video frames in the target cache. As shown in Figure 4, when the current frame is the last frame of a GOP, the playback end is still playing an I-frame picture, which will generate a delay of nearly 1 GOP. At this time, the original playback parameters can be adjusted to adjust the playback time of the playback end and reduce the playback delay.
[0091] Exemplarily, in response to the key frame not being the current cached frame, the original playback parameters are adjusted according to the distance between the position of the current cached frame and the position of the key frame to obtain the target playback parameters.
[0092] In this exemplary embodiment, when the current cached frame is not a key frame, it indicates that there is a delay on the playback end. The decoding time and display time of each frame can be adjusted according to the distance between the key frame and the current frame to accelerate decoding and display, so that the playback end reaches the current real-time encoded frame as soon as possible. Exemplarily, the playback parameter adjustment can be performed by adjusting the inter-frame decoding timestamp increment and the display timestamp increment. For example, as the distance between the current frame and the key frame increases, both ΔDTS and ΔPTS can be gradually reduced proportionally, that is, the two are inversely correlated. Considering issues such as frame rate matching and audio and video matching, a lower limit or maximum adjustment amount for parameter adjustment can be set to avoid screen jumps and audio and video synchronization problems caused by transition adjustment. For example, the lower limit of adjustment can be set to 1 / 3 of the original playback parameters (i.e., 1 / 3*ΔDTS and 1 / 3*ΔPTS), or the maximum adjustment amount can be set to 2 / 3 of the original playback parameters (i.e., 2 / 3*ΔDTS and 2 / 3*ΔPTS). The adjustment amounts of ΔDTS and ΔPTS can be the same or different, and this example does not limit this. It is also possible to proportionally reduce and then increase ΔDTS and ΔPTS as the distance between the current frame and the key frame increases, that is, the changes in ΔDTS and ΔPTS show a "V"-shaped trend, so as to avoid frame rate mismatch or audio and video asynchrony problems when the current frame is far away from the key frame.
[0093] In some embodiments, in response to the key frame being the current cached frame, an original code stream generated based on the current cached frame is sent to the streaming server, so that the playback terminal pulls the original code stream from the streaming server and decodes and plays it based on the original playback parameters.
[0094] In this exemplary embodiment, the current frame is a key frame, so there is no delay on the playback end, and decoding and playback can be performed according to the original playback parameters, thereby ensuring the real-time performance of the playback end.
[0095] For example, as shown in Figure 5, the configured video frame rate is 25fps, then the decoding timestamp increment ΔDTS and the display timestamp increment ΔPTS between adjacent frames are both 40 milliseconds (original playback parameters). If the acquisition end receives a video playback request when the I frame is encoded (such as position 1 in Figure 5), the cached video frames in the target cache have been cleared at this time, and there are only real-time newly encoded I frames in the target cache. In this way, there is no need to modify the playback parameters, and the original playback parameters are sent to the playback end for instant decoding and display. If the acquisition end receives a stream request in the middle of encoding 1 GOP (such as position 2 in Figure 5), it means that there is video frame data of nearly 1 / 2 GOP in the cache, then the timestamp increments ΔDTS and ΔPTS between frames can be adjusted to 15 milliseconds, so that the playback end can accelerate decoding and display when playing the cached video frames to reach the current real-time encoded frame as soon as possible. If the acquisition end receives a stream request at the end of a coded GOP (as shown in position 3 in Figure 5), it means that there is nearly 1 GOP of video frame data in the cache. In order to avoid skipping or audio and video synchronization problems, the timestamp increments ΔDTS and ΔPTS between frames can be adjusted to 20 milliseconds to ensure that the playback end can accelerate the decoding and display of cached frames more quickly and reach the current real-time coded frame as soon as possible.
[0096] The above exemplary embodiments adjust the playback time by adjusting the time interval between adjacent frames to ensure that the playback speed of the video matches the frame rate of the video, and also ensure synchronization of audio and video.
[0097] In step S230 , a target bitstream for the buffered video frames is generated according to the target playback parameters.
[0098] In this exemplary embodiment, the acquisition end may generate a target bitstream using a standard protocol according to the target playback parameters after the playback parameters are adjusted and the cached video frames, so as to respond to the video playback request.
[0099] Exemplarily, referring to FIG6 , a transport stream may be generated according to the following steps. The transport stream may be an original stream or a target stream:
[0100] Step S610: Determine the corresponding playback mode according to the playback parameters.
[0101] In this exemplary embodiment, the playback parameters are original playback parameters or target playback parameters. When the playback parameters are target playback parameters, it indicates that the playback parameters have changed, that is, the inter-frame time increment has changed, resulting in a change in the frame rate, which corresponds to the first playback mode (variable frame rate playback mode). When the playback parameters are original playback parameters, it indicates that the playback parameters have not changed, and the frame rate is fixed, which corresponds to the second playback mode (fixed frame rate playback mode).
[0102] Step S620: Use the play mode as a custom field to generate custom protocol data.
[0103] In this exemplary embodiment, a custom field is used to distinguish different playback modes, as long as the corresponding playback mode can be determined through the custom field. For example, the custom field can be Fixed Frame Rate (corresponding to a fixed frame rate) or Variable Frame Rate (corresponding to a variable frame rate). Custom protocol data can be generated based on a predetermined format, for example, in the format of name, data, and length.
[0104] Step S630: encapsulate the custom protocol data according to a preset format to obtain a custom array.
[0105] In this exemplary embodiment, data encapsulation can be performed according to the coding standard so that the custom array can be inserted into the coded stream without affecting its parsing process. For example, the custom protocol data can be encapsulated into the SEI field general format, and the custom encapsulation format is shown in Table 1:
[0106] Table 1
[0107] In Table 1, start code represents the start code of each NALU (Network Abstraction Layer) unit, NRI indicates that the first bit of the upper four bits is the prohibit bit 0, which is used to determine whether the NALU unit is valid; the middle two bits of the upper four bits represent the importance of the NALU unit, and the NALU unit is parsed or discarded according to this value during decoding. The last bit of the upper four bits and the lower four bits constitute the NALU unit identification code, and 06 indicates that the unit is a SEI field. Payload type 05 indicates that the encoding format of the SEI field complies with the H264 standard format; UUID represents a user-defined identification code, which is 16 bytes long and cannot conflict with the Start code; custom data length indicates that two bytes are used to represent the length of the encapsulated custom data, and the value is used for verification during decoding; custom data indicates that the position is user-defined data, the type is unsigned char, the length is N, N is greater than 1, and the corresponding field of the playback mode can be placed in this position, such as the corresponding field of the first playback mode is Variable Frame Rate, and the corresponding field of the second playback mode is Fixed Frame Rate. When parsing the H264 code stream, the player determines whether it is custom protocol data based on the start code and NRI identification code, and extracts the custom data for decoding and playback.
[0108] Step S640: insert the custom array into the target position of the standard code stream to obtain a transmission code stream.
[0109] In this exemplary embodiment, the target position is the position before the key frame in the standard bitstream, which is generated based on cached video frames and the standard protocol. Custom protocol data can be encapsulated into the SEI field's universal format according to the format shown in Table 1 and then inserted into the H.264 standard bitstream to obtain a transport stream. When the inserted custom data is at a variable frame rate, the transport stream is the target stream; when the inserted custom data is at a fixed frame rate, the transport stream is the original stream.
[0110] In the technical solution of the embodiment shown in Figure 6 above, the playback parameter adjustment status of the acquisition end can be inserted into the code stream in the form of custom data, so that the playback end can be informed of the playback parameter adjustment status and decode and play based on the adjustment status. Without affecting the decoding and playback of the playback end, the playback end can be informed of the playback parameter adjustment status of the acquisition end, and the playback strategy can be switched dynamically in real time based on this to ensure the playback effect.
[0111] In step S240, the target code stream is sent to the streaming server, so that the playback terminal pulls the target code stream from the streaming server and decodes and plays it based on the target playback parameters.
[0112] In this exemplary embodiment, after the acquisition end generates the target code stream, it pushes the target code stream to the streaming media server. The streaming media server can return the corresponding stream pulling address to the playback end. The playback end pulls the corresponding target code stream from the streaming media server according to the stream pulling address, parses the target code stream, obtains the target playback parameters, and decodes and plays based on the target playback parameters.
[0113] Referring to FIG7 , an embodiment of the present disclosure provides a video playback method that can be applied to a playback terminal. As shown in FIG7 , the video playback method can include at least the following steps:
[0114] Step S710: In response to receiving the target pull address sent by the streaming media server, pull the to-be-played stream corresponding to the target pull address from the streaming media server, where the to-be-played stream includes custom protocol data and playback parameters, where the custom protocol data is used to indicate a playback mode of the to-be-played stream;
[0115] Step S720, controlling the decoding and playback of the stream to be played according to the playback parameters and the playback mode;
[0116] The playback parameters include target playback parameters, which are obtained by the acquisition end by adjusting original playback parameters according to the key frame position of the currently cached cached video frame, and the original playback parameters are determined by the acquisition end based on the configured frame rate.
[0117] In this exemplary embodiment, the stream to be played can be the target stream or the original stream. The playback parameters corresponding to the original stream are the original playback parameters, and the playback parameters corresponding to the target stream are the target playback parameters. The playback parameters may include the decoding timestamp increment and the display timestamp increment between adjacent frames. The playback end may decode and play the stream to be played based on the playback parameters and playback mode obtained through decoding. In this example, the playback end may quickly decode and display the stream to be played based on the target playback parameters and playback mode, reaching the current real-time encoding frame as quickly as possible, thereby achieving a seamless fast-forward of the video image, thereby reducing video latency while preventing the naked eye from perceiving the obvious fast-forward of the video image.
[0118] Exemplarily, when the playback mode is the first playback mode and the playback parameter is the target playback parameter, the decoding and playback of the code stream to be played is controlled according to the playback parameter and the playback mode, including: according to the target playback parameter, the decoding and playback of the code stream to be played is controlled according to the first playback mode.
[0119] In this exemplary embodiment, the first playback mode corresponds to a variable frame rate playback mode. Due to the change in frame rate, a mismatch between the display time and the frame rate may occur, necessitating a redetermination of the display time. Specifically, the original display time can be determined based on target playback parameters, and the actual display time can be determined based on the original display time. This allows the player to reach the current encoded frame as quickly as possible based on the target playback parameters while ensuring that the playback speed and frame rate are closely matched.
[0120] Exemplarily, the actual display time of each frame may be determined by the following steps:
[0121] The first step is to determine the original display time of each video frame in the stream to be played based on the target playback parameters;
[0122] Step 2: For the first video frame in the stream to be played, the original display time is used as the actual display time;
[0123] Step 3: For each video frame other than the first video frame in the stream to be played, determine the actual display time of the current frame based on the difference in original display time between the current frame and the previous frame and the actual display time of the previous frame;
[0124] The fourth step is to control the playback of the stream to be played according to the actual display time corresponding to each video frame.
[0125] In this exemplary embodiment, the target playback parameters are the parameters adjusted by the acquisition end before sending the code stream. The target playback parameters may include the decoding time and display time of the first frame of the decoded code stream to be played, as well as the adjusted decoding timestamp increment and display timestamp increment between adjacent frames. The original display time is the display time of each frame determined based on the display time of the first frame and the adjusted display timestamp increment. For example, the original display time of the second frame is the display time of the first frame plus the adjusted display timestamp increment. Because the frame rate changes due to the modification of the display timestamp, the display time interval of each frame of the video may be different. Therefore, a display delay needs to be calculated for each frame to accommodate the change in frame rate. Specifically, the difference in the original display time between adjacent frames can be used as the corresponding display delay. For example, the display delay of frame n is the original display time T1 of frame n minus the original display time T2 of frame n-1. The display delay of frame n is then T1-T2. For each video frame except the first frame, the corresponding display delay is added to its original display time before the frame is displayed. For example, the actual display time of frame n is T1 + (T1 - T2). Finally, the display of each frame is controlled based on the display delay. When the player decodes a video frame, the actual display time of that frame is calculated and the display of each frame is controlled based on the actual display time. This example can precisely control the display time of each frame to match the playback speed with the changing frame rate, thereby ensuring video playback quality under varying frame rates.
[0126] Exemplarily, when the playback mode is the second playback mode and the playback parameters are original playback parameters, the method further includes: controlling the decoding and playback of the to-be-played code stream according to the second playback mode based on the original playback parameters.
[0127] In this example implementation, the second playback mode corresponds to a fixed frame rate playback mode. This fixed frame rate can be used to simplify timestamp processing. A fixed frame rate means that each frame is displayed at a fixed interval, which is the inverse of the frame rate. This example simplifies timestamp processing and reduces the computational burden on the playback end.
[0128] Exemplarily, the decoding and playing process can be controlled according to the second playing mode according to the following steps:
[0129] The first step is to determine the original display time of each video frame in the stream to be played based on the original playback parameters;
[0130] Step 2: For the first video frame in the stream to be played, the original display time is used as the actual display time;
[0131] Step 3: For a video frame other than the first video frame in the stream to be played, determine the actual display time of the current frame according to the frame rate and the frame order of the current frame in the stream to be played;
[0132] The fourth step is to control the playback of the stream to be played according to the actual display time corresponding to each video frame.
[0133] In this example implementation, the original playback parameters are the decoding time and display time of the first frame determined by the acquisition end during the encoding process, as well as the decoding timestamp increment and display timestamp increment between adjacent frames. The original display time is the display time of each frame determined based on the display time and display timestamp increment of the first frame. For example, the display time of the second frame is the display time of the first frame plus the display timestamp increment. The actual display time of the first video frame is used as the reference time T, and the actual display time of subsequent video frames is T+n / f, where n is the frame order of the current frame. For example, if the current frame is the 5th frame, then n=5, and f is the frame rate. Finally, each frame can be displayed according to the calculated actual display time. This example can evenly display different frames according to their own frame order based on the frame rate to ensure that the playback speed of the video matches the frame rate of the video.
[0134] In the embodiment shown in FIG7 , the display time of the video frames is adjusted accordingly to accommodate the adjustment of the playback parameters so that the playback speed matches the frame rate. However, the decoding time does not need to be adjusted, that is, decoding can be performed according to the playback parameters carried in the bitstream.
[0135] 8 , a video playback method in an embodiment provided by the present disclosure may be performed between a capture terminal, a streaming media server, and a playback terminal, and specifically includes the following steps:
[0136] Step S801: The acquisition terminal obtains the video data (original video stream) collected in real time by the camera device.
[0137] Step S802: The acquisition end encodes the original video stream to obtain corresponding encoded video data.
[0138] Step S803 : The acquisition end caches video frames of a GOP starting from the key frames in the encoded video data to obtain cached video frames.
[0139] Step S804: When the acquisition end obtains a new key frame, it clears the current cached video frame and caches the new key frame.
[0140] Step S805: The player sends a video playback request to the streaming media server;
[0141] Step S806: After parsing the request, the streaming media server sends a video play request to the corresponding acquisition terminal.
[0142] Step S807 : The acquisition end determines the key frame position and original playback parameters of the currently cached video frame in response to receiving the video playback request sent by the streaming media server.
[0143] Step S808: When the key frame is the current frame, the acquisition end generates an original bit stream based on the original playback parameters.
[0144] Step S809: When the key frame is not the current frame, the acquisition end adjusts the original playback parameters to obtain target playback parameters, and generates a target bitstream based on the target playback parameters.
[0145] Step S810: The acquisition end pushes the original code stream or the target code stream to the streaming media server.
[0146] Step S811: The streaming media server returns the streaming address to the player.
[0147] Step S812: The player obtains the corresponding code stream from the streaming server based on the pull stream address.
[0148] Step S813: The playback end decodes and plays the pulled code stream.
[0149] In the embodiment shown in FIG8 , the processes S801 to S804 are continuously performed in real time, and the processes S805 to S813 are started based on a request from the player end and continue until the player end stops playing.
[0150] The video playback method provided by the present disclosure, on the one hand, by caching video frames starting from the key frame, makes it possible for the playback end to pull the video stream, and the first frame of the video stream is the key frame, which can be decoded and played immediately. On the other hand, by adjusting the playback parameters, the playback end does not need to actively fast-forward when playing the cached frame, and can directly decode and play; for the case where the current frame is not a key frame, by adjusting the inter-frame timestamp increment, faster decoding and display can be achieved, so that the playback end can reach the real-time encoding frame as soon as possible, and the video picture can be fast-forwarded without feeling. In addition, by adjusting the display time at the playback end, the video playback speed is matched with the frame rate to ensure the playback quality.
[0151] The following describes a system embodiment of the present disclosure, which can be used to execute the video playback method described above. For details not disclosed in the system embodiment of the present disclosure, please refer to the embodiment of the video playback method described above.
[0152] Referring to FIG9 , the present disclosure further provides a video acquisition terminal device 900 , which may include:
[0153] The parameter determination module 910 determines the key frame position and original playback parameters of the currently cached video frame in response to receiving the video playback request; the original playback parameters are determined based on the configured frame rate;
[0154] The parameter adjustment module 920 adjusts the original playback parameters according to the key frame position to obtain the target playback parameters;
[0155] The stream generation module 930 generates a target stream for the cached video frames according to the target playback parameters;
[0156] The streaming module 940 sends the target code stream to the streaming server, so that the playback terminal pulls the target code stream from the streaming server and decodes and plays it based on the target playback parameters.
[0157] In some embodiments of the present disclosure, based on the aforementioned solution, the device 900 further includes a frame buffer module, which is configured to:
[0158] Obtain original video frames in real time, and encode the original video stream to obtain corresponding encoded video data;
[0159] Starting from a key frame in the encoded video data, a specified number of video frames are cached to obtain cached video frames.
[0160] In some embodiments of the present disclosure, based on the aforementioned solution, the frame buffer module is further configured to:
[0161] In response to acquiring a new key frame, the cached video frame is updated using the new key frame.
[0162] In some embodiments of the present disclosure, based on the aforementioned solution, the parameter adjustment module 920 is configured to:
[0163] In response to the key frame not being the current cached frame, the original playback parameters are adjusted according to the distance between the current cached frame and the key frame to obtain the target playback parameters.
[0164] In some embodiments of the present disclosure, based on the above solution, the streaming module 940 is further configured to:
[0165] In response to the key frame being the current cached frame, an original code stream generated based on the current cached frame is sent to the streaming server, so that the playback terminal pulls the original code stream from the streaming server and decodes and plays it based on the original playback parameters.
[0166] In some embodiments of the present disclosure, based on the aforementioned solution, the flow generation module 930 is configured to:
[0167] Determine the corresponding playback mode according to the playback parameters; the playback parameters are the original playback parameters or the target playback parameters;
[0168] Use the playback mode as a custom field to generate custom protocol data;
[0169] Encapsulate the custom protocol data according to the preset format to obtain a custom array;
[0170] Insert the custom array into the target position of the standard bitstream to obtain the transmission bitstream. The target position is the position before the key frame in the standard bitstream. The standard bitstream is generated based on the cached video frames and the standard protocol.
[0171] The specific details of each module / unit in the above-mentioned video acquisition terminal devices have been described in detail in the corresponding video playback method, so they will not be repeated here.
[0172] Referring to FIG10 , the present disclosure further provides a video playback terminal device 1000 , which may include:
[0173] The stream pulling module 1010 is configured to pull a to-be-played stream corresponding to the target pull address from the streaming media server in response to receiving the target pull address sent by the streaming media server, where the to-be-played stream includes custom protocol data and playback parameters, where the custom protocol data is used to indicate a playback mode of the to-be-played stream;
[0174] The playback control module 1020 is configured to control the decoding and playback of the stream to be played according to the playback parameters and playback mode;
[0175] The playback parameters include target playback parameters, which are obtained by the acquisition end by adjusting original playback parameters according to the key frame position of the currently cached cached video frame, and the original playback parameters are determined by the acquisition end based on the configured frame rate.
[0176] In some embodiments of the present disclosure, based on the aforementioned solution, when the playback mode is the first playback mode and the playback parameter is the target playback parameter, the playback control module 1020 is configured to:
[0177] According to the target playback parameters, the decoding and playback of the code stream to be played is controlled in accordance with the first playback mode.
[0178] In some embodiments of the present disclosure, based on the aforementioned solution, the playback control module 1020 performs the following steps to control the decoding and playback of the to-be-played stream according to the first playback mode based on the target playback parameters:
[0179] Determine the original display time of each video frame in the stream to be played based on the target playback parameters;
[0180] For the first video frame in the stream to be played, the original display time is used as the actual display time;
[0181] For a video frame other than the first video frame in the stream to be played, determining the actual display time of the current frame based on the difference between the original display time of the current frame and the previous frame and the actual display time of the previous frame;
[0182] The playback of the stream to be played is controlled according to the actual display time corresponding to each video frame.
[0183] In some embodiments of the present disclosure, based on the aforementioned solution, when the playback mode is the second playback mode and the playback parameters are the original playback parameters, the playback control module 1020 is configured to:
[0184] According to the original playback parameters, the decoding and playback of the code stream to be played is controlled in accordance with the second playback mode.
[0185] In some embodiments of the present disclosure, based on the aforementioned solution, the playback control module 1020 implements the following steps to control the decoding and playback of the to-be-played stream according to the second playback mode based on the original playback parameters:
[0186] Determine the original display time of each video frame in the stream to be played based on the original playback parameters;
[0187] For the first video frame in the stream to be played, the original display time is used as the actual display time;
[0188] For a video frame other than the first video frame in the stream to be played, determining the actual display time of the current frame according to the frame rate and the frame order of the current frame in the stream to be played;
[0189] The playback of the stream to be played is controlled according to the actual display time corresponding to each video frame.
[0190] The specific details of each module or unit in the above-mentioned video playback terminal devices have been described in detail in the corresponding video playback method, so they will not be repeated here.
[0191] The embodiment of the present disclosure also provides a video playback system, including the video acquisition terminal device and / or the video playback terminal device of any of the aforementioned embodiments, and may also include a streaming media server. Video playback can be performed through a system composed of the acquisition terminal device, the playback terminal device, and the streaming media server.
[0192] It should be noted that although several modules or units of the device for execution are mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0193] In this exemplary embodiment, an electronic device capable of implementing the above method is also provided.
[0194] Those skilled in the art will appreciate that various aspects of the present invention may be implemented as systems, methods, or program products. Therefore, various aspects of the present invention may be implemented in the following forms: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which may be collectively referred to herein as "circuits," "modules," or "systems."
[0195] The electronic device 1100 according to this embodiment of the present invention is described below with reference to Figure 11. The electronic device 1100 shown in Figure 11 is merely an example and should not limit the functions and scope of use of the embodiments of the present invention.
[0196] As shown in FIG11 , electronic device 1100 is implemented as a general-purpose computing device. Components of electronic device 1100 may include, but are not limited to, the aforementioned at least one processing unit 1110, the aforementioned at least one storage unit 1120, a bus 1130 connecting various system components (including storage unit 1120 and processing unit 1110), and a display unit 1140.
[0197] The storage unit stores program code, and the program code can be executed by the processing unit 1110, so that the processing unit 1110 performs the steps of various exemplary embodiments of the present invention described in the above-mentioned video playback method of this specification. For example, the processing unit 1110 can execute step S210 as shown in Figure 2: in response to receiving a video playback request, determining the key frame position and original playback parameters of the currently cached cached video frame; the original playback parameters are determined based on the configured frame rate; step S220: adjusting the original playback parameters according to the key frame position to obtain target playback parameters; step S230, generating a target code stream for the cached video frame according to the target playback parameters; step S240, sending the target code stream to the streaming server, so that the playback end pulls the target code stream from the streaming server and decodes and plays based on the target playback parameters.
[0198] The storage unit 1120 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 11201 and / or a cache memory unit 11202 , and may further include a read-only memory unit (ROM) 11203 .
[0199] The storage unit 1120 may also include a program / utility 11204 having a set (at least one) of program modules 11205, such program modules 11205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0200] The bus 1130 may represent one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0201] Electronic device 1100 can also communicate with one or more external devices (e.g., a keyboard, pointing device, Bluetooth device, etc.), one or more devices that enable a viewer to interact with electronic device 1100, and / or any device that enables electronic device 1100 to communicate with one or more other computing devices (e.g., a router, modem, etc.). Such communication can occur via input / output (I / O) interface 1150. Furthermore, electronic device 1100 can communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via network adapter 1160. As shown, network adapter 1160 communicates with other modules of electronic device 1100 via bus 1130. It should be understood that, although not shown, other hardware and / or software modules can be used in conjunction with electronic device 1100, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0202] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
[0203] In this exemplary embodiment, a computer-readable storage medium is also provided, storing a program product capable of implementing the methods described above. In some possible implementations, various aspects of the present invention may also be implemented in the form of a program product comprising program code. When the program product is executed on a terminal device, the program code is configured to cause the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the "Exemplary Methods" section above.
[0204] According to an embodiment of the present invention, a program product for implementing the above-mentioned method can be a portable compact disc read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, and the program can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0205] The program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples (a non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0206] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a readable storage medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0207] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0208] The program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, and the like, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a stand-alone software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0209] Furthermore, the figures above are merely illustrative of the processes included in the methods according to exemplary embodiments of the present disclosure and are not intended to be limiting. It is readily understood that the processes illustrated in the figures above do not indicate or limit the temporal order of these processes. Furthermore, it is readily understood that these processes may be executed synchronously or asynchronously, for example, in multiple modules.
[0210] Other embodiments of the present disclosure will readily occur to those skilled in the art after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow from the general principles of the present disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered as exemplary only, with the true scope and spirit of the present disclosure being indicated by the claims.
[0211] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A video playback method, applied to a capture end, comprising: In response to receiving a video playback request, determining a key frame position and original playback parameters of a currently cached cached video frame; The original playback parameters are determined based on the configured frame rate; According to the key frame position, adjusting the original playback parameters to obtain target playback parameters; generating a target bitstream for the cached video frame according to the target playback parameters; The target code stream is sent to the streaming server, so that the playback terminal pulls the target code stream from the streaming server and decodes and plays it based on the target playback parameters.
2. The method according to claim 1, characterized in that The method further comprises: Acquire original video frames in real time, and encode the original video stream to obtain corresponding encoded video data; Starting from the key frame in the encoded video data, a specified number of video frames are cached to obtain the cached video frames.
3. The method according to claim 2, characterized in that The method further comprises: In response to acquiring a new key frame, the cached video frame is updated using the new key frame.
4. The method according to claim 3, characterized in that Adjusting the original playback parameters according to the key frame position to obtain target playback parameters includes: In response to the key frame not being the current cache frame, the original playback parameters are adjusted according to a distance between the current cache frame and the key frame to obtain the target playback parameters.
5. The method according to claim 4, characterized in that The method further comprises: In response to the key frame being the current cache frame, an original code stream generated based on the current cache frame is sent to the streaming server, so that the playback terminal pulls the original code stream from the streaming server and decodes and plays it based on the original playback parameters.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Determine a corresponding playback mode according to playback parameters; the playback parameters are original playback parameters or target playback parameters; Using the playback mode as a custom field to generate custom protocol data; Encapsulate the custom protocol data according to a preset format to obtain a custom array; The custom array is inserted into a target position of a standard bitstream to obtain a transmission bitstream, where the target position is a position before a key frame in the standard bitstream, and the standard bitstream is generated based on the cached video frame and a standard protocol.
7. A video playback method, applied to a playback terminal, comprising: In response to receiving a target pull address sent by a streaming media server, pulling a to-be-played stream corresponding to the target pull address from the streaming media server, the to-be-played stream including custom protocol data and playback parameters, the custom protocol data being used to indicate a playback mode of the to-be-played stream; Controlling the decoding and playback of the to-be-played code stream according to the playback parameters and the playback mode; The playback parameters include target playback parameters, which are obtained by the acquisition end by adjusting original playback parameters according to the key frame position of the currently cached cached video frame, and the original playback parameters are determined by the acquisition end based on the configured frame rate.
8. The method according to claim 7, characterized in that When the playback mode is the first playback mode and the playback parameter is a target playback parameter, controlling the decoding and playback of the to-be-played code stream according to the playback parameter and the playback mode includes: According to the target playback parameters, the decoding and playback of the to-be-played code stream is controlled in accordance with the first playback mode.
9. The method according to claim 8, characterized in that According to the target playback parameter, controlling the decoding and playback of the to-be-played code stream in accordance with the first playback mode includes: Determining the original display time of each video frame in the to-be-played code stream according to the target playback parameter; For the first video frame in the stream to be played, the original display time is used as the actual display time; For a video frame other than the first video frame in the to-be-played code stream, determining an actual display time of the current frame according to a difference in original display time between the current frame and a previous frame and an actual display time of the previous frame; The playback of the to-be-played code stream is controlled according to the actual display time corresponding to each video frame.
10. The method according to claim 7, characterized in that When the playback mode is the second playback mode and the playback parameters are original playback parameters, the method further includes: According to the original playback parameters, the decoding and playback of the to-be-played code stream is controlled in accordance with the second playback mode.
11. The method according to claim 10, characterized in that Controlling the decoding and playback of the to-be-played code stream according to the second playback mode according to the original playback parameters includes: Determining the original display time of each video frame in the to-be-played code stream according to the original playback parameters; For the first video frame in the stream to be played, the original display time is used as the actual display time; For a video frame other than the first video frame in the to-be-played code stream, determining an actual display time of the current frame according to the frame rate and the frame order of the current frame in the to-be-played code stream; The playback of the to-be-played code stream is controlled according to the actual display time corresponding to each video frame.
12. A video acquisition terminal device, comprising: a parameter determination module, in response to receiving a video playback request, determining a key frame position and original playback parameters of a currently cached cached video frame; The original playback parameters are determined based on the configured frame rate; A parameter adjustment module, adjusting the original playback parameters according to the key frame position to obtain target playback parameters; A stream generation module, which generates a target stream for the cached video frame according to the target playback parameters; The push stream module sends the target code stream to the streaming media server, so that the playback terminal pulls the target code stream from the streaming media server and decodes and plays it based on the target playback parameters.
13. A video playback device, comprising: a stream pulling module configured to, in response to receiving a target pull address sent by a streaming media server, pull a to-be-played stream corresponding to the target pull address from the streaming media server, wherein the to-be-played stream includes custom protocol data and playback parameters, wherein the custom protocol data is used to indicate a playback mode of the to-be-played stream; A playback control module is configured to control the decoding and playback of the to-be-played code stream according to the playback parameters and the playback mode; The playback parameters include target playback parameters, which are obtained by the acquisition end by adjusting original playback parameters according to the key frame position of the currently cached cached video frame, and the original playback parameters are determined by the acquisition end based on the configured frame rate.
14. A video playback system, comprising: The device of at least one of claims 12 and 13.
15. An electronic device comprising: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, causes the one or more processors to implement the method according to any one of claims 1 to 11. 16 . A computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method according to claim 1 is implemented.