MP4 video reverse playing device and method

By designing an MP4 video reversal device including a pre-read module, a video read module and a streaming media player, the problems of inefficient reversal of MP4 files and difficulty in precise positioning in the prior art are solved, efficient and smooth video reversal is achieved, and hardware costs are reduced.

CN119893224APending Publication Date: 2025-04-25WUHAN HONGXIN TECH SERVICE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510033428.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-09
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

In the prior art, servers based on IP-SAN storage are difficult to support efficient rewind of MP4 files, resulting in low efficiency, lag and inability to accurately locate keyframes.

Method used

An MP4 video reversal device is designed, including a pre-read module, a video read module and a streaming media player. Through a pre-read module and a video read module running in parallel with two threads, video read modules can realize the video readout and acquisition of keyframe index information. The streaming media player performs reverse rendering and playback based on the keyframe index information.

Benefits of technology

It realizes efficient reversal of MP4 video recording, improves the smoothness and stability of video playback, reduces memory usage, and reduces hardware costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119893224A_ABST
    Figure CN119893224A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an MP4 video reverse playing device and method, which are applied to a playing system of IP-SAN (Internet Protocol-Storage Area Network) storage, and the device comprises the following steps: a pre-reading module responds to a video reverse playing instruction to obtain a start frame and an end frame of a video clip and reads a data segment at a preset time interval before the end frame to obtain key frame index information; and the video reading module locates a timestamp of a target key frame from the video clip according to the key frame index information and then selects to-be-played data frames in sequence to obtain target video clip stream data and send the target video clip stream data to the streaming media player. And the streaming media player selects to-be-played video frames from the target video clip in sequence, performs caching according to the key frame index information of the to-be-played video frames to obtain the GOP unit group, and performs rendering playing according to the GOP unit group in a reverse order. The position of the key frame is pre-read by an independent thread, the rate of a normal code stream reading module is not influenced, and smoothness and stability of video reading are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information processing technology, and in particular to an MP4 video playback device and method. Background Art

[0002] IP-SAN: It is a SAN storage architecture based on IP Ethernet network. It uses iSCSI protocol to transmit data and stores directly on IP network. It connects servers and storage devices through network switches, is not limited by distance, is easy to deploy, easy to expand, and has low cost. IP-SAN is often used in large-scale centralized storage together with streaming media servers.

[0003] When reading MP4 files, due to its encapsulation characteristics, the key frame data of the specified timestamp can be quickly located, but the timestamps of all key frames cannot be quickly and accurately obtained. Currently, the market often uses the method of traversing all frames to filter out key frames.

[0004] Video playback is an indispensable function in security monitoring, and the reverse playback function is also needed in certain scenarios. In current technology, most servers based on IP-SAN storage do not support reverse playback of MP4 files, or the reverse playback function only supports playback of key frames, making it difficult to achieve frame-by-frame reverse playback. Existing video playback devices often have problems such as low efficiency, freezes, and inability to accurately locate key frames when processing MP4 video reverse playback. Summary of the invention

[0005] In view of the above problems, embodiments of the present application are proposed to provide an MP4 video playback method, an MP4 video playback device, a corresponding electronic device and a corresponding computer storage medium that overcome the above problems or at least partially solve the above problems.

[0006] The embodiment of the present application discloses an MP4 video reversing device, which is applied to a playback system stored in an IP-SAN. The device comprises a pre-reading module, a video reading module and a streaming media player. The pre-reading module and the video reading module are operated in parallel using dual threads.

[0007] The pre-reading module is used to obtain the start frame and the end frame of the video segment in response to the video reverse playback instruction and perform video pre-reading, wherein the video pre-reading includes: reading a data segment of a preset time interval before the end frame to obtain key frame index information;

[0008] The video reading module is used to locate the timestamp of the target key frame from the video segment according to the key frame index information, select the data frame to be played in order, obtain the target video segment stream data and send it to the streaming media player;

[0009] The streaming media player is used to select video frames to be played from the target video segment in sequence, cache the key frame index information of the video frames to be played to obtain a GOP unit group, and render and play in reverse order according to the GOP unit group, wherein there is a one-to-one correspondence between the key frames and the GOP unit groups.

[0010] According to the MP4 video reversing device, the pre-reading module is also used to update the timestamp of the end frame of the video segment to the timestamp of the end frame of the preset interval time and perform the video pre-reading when the number of queue elements in the cache queue is less than a preset threshold.

[0011] According to the MP4 video reversing device, the pre-reading module includes: a key frame reading unit and a buffer queue;

[0012] The key frame reading unit is used to read the key frames of a preset time interval before the specified end time frame by frame to obtain key frame index information and store it in the first cache queue; the key frame index information includes the timestamp information and position information of the key frame;

[0013] The buffer queue is used to record the key frame index information of all key frames read, and cache them after sorting them from large to small according to the timestamp information.

[0014] According to the MP4 video reversing device, the video reading module includes: a key frame reading unit and a segment buffer unit;

[0015] The key frame reading unit is used to retrieve the key frame index information of the target key frame from the first cache queue, locate the timestamp of the target key frame, and select the data frame to be played from the video clips in the ascending order of the timestamp information;

[0016] The segment buffer unit is used to read the streaming media data from the data frames to be played in reverse order from large to small according to a preset rate.

[0017] According to the MP4 video reversing device, the streaming media player includes: a cache reading module and a data assembly module;

[0018] The cache reading module is used to select the video frames to be played from the target video segment according to the timestamp and in the order of timestamp information from small to large, and cache the video frames to be played according to the key frame index information to obtain the GOP unit group;

[0019] The data assembly module is used to render and play according to the GOP unit group in reverse order of time points.

[0020] According to a second aspect of the present invention, there is also provided an MP4 video reverse playback method, which is applied to a playback system stored in an IP-SAN, comprising:

[0021] Receive a video rewind instruction, obtain a start frame and an end frame of a video segment in response to the video rewind instruction and perform video pre-reading; the video pre-reading includes: reading a data segment of a preset time interval before the end frame to obtain key frame index information;

[0022] Locating the timestamp of the target key frame from the video segment according to the key frame index information, and then selecting the data frames to be played in order to obtain the target video segment stream data;

[0023] Select the video frames to be played from the target video segment in order, cache the key frame index information of the video frames to be played to obtain a GOP unit group, and render and play them in reverse order according to the GOP unit group, wherein the key frames correspond to the GOP unit group one by one.

[0024] According to the MP4 video playback method, after obtaining the start frame and the end frame of the video segment in response to the video playback instruction and performing video pre-reading, the method further includes:

[0025] When the number of queue elements in the cache queue is less than a preset threshold, the timestamp of the end frame of the video segment is updated to the timestamp of the end frame of the preset interval time and the video pre-reading is performed.

[0026] An embodiment of the present application also discloses an electronic device, including: a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program implements any step of the MP4 video playback method when executed by the processor.

[0027] The embodiment of the present application further discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of any one of the MP4 video playback methods are implemented.

[0028] The embodiment of the present application has the following advantages: the present invention obtains the start frame and the end frame of the video clip in response to the video reverse playback instruction through the pre-reading module and executes the data segment of the preset time interval before the end frame to obtain the key frame index information. The video reading module locates the timestamp of the target key frame from the video clip according to the key frame index information and selects the data frame to be played in sequence to obtain the target video clip stream data and sends it to the streaming media player. The streaming media player selects the video frame to be played from the target video clip in sequence, caches the GOP unit group according to the key frame index information of the video frame to be played, and renders and plays it in reverse order according to the GOP unit group. Through the collaborative work of the pre-reading module, the video reading module and the streaming media player, the key frame position can be pre-read by an independent thread without affecting the rate of the normal code stream reading module, ensuring the smoothness and stability of the video reading. At the same time, different from the traditional pre-reading, only the timestamp information and position information in the key frame index information are cached after reading here, instead of caching the entire GOP data frame, which can efficiently manage and utilize the key frame index information, improve the speed and accuracy of video reverse playback, and greatly reduce the memory usage on the server side.

[0029] The present invention assigns the decoding task to the front-end player, which occupies very little resources of the streaming media server and can greatly reduce the hardware cost. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 This is one of the structural schematic diagrams of an embodiment of an MP4 video playback device of the present application;

[0031] Figure 2 This is the second structural diagram of an MP4 video playback device embodiment of the present application;

[0032] Figure 3 It is a structural diagram of an operation embodiment of a streaming media player provided in an embodiment of the present application;

[0033] Figure 4 It is a flowchart of an embodiment of an MP4 video playback method of the present application. DETAILED DESCRIPTION

[0034] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0035] Currently, most servers based on IP-SAN storage do not support reverse playback of MP4 files, or the reverse playback function only supports playback of key frames, making it difficult to achieve frame-by-frame playback. Existing playback systems based on IP-SAN storage often have problems such as low efficiency, lag, and inability to accurately locate key frames when processing reverse playback of MP4 recordings.

[0036] Reference Figure 1 , shows one of the structural schematic diagrams of an MP4 video reversal device embodiment of the present application, which is applied to a playback system stored in an IP-SAN. The device specifically includes: a pre-reading module 404, a video reading module 406 and a streaming media player 408.

[0037] The pre-reading module 404 is used to obtain the start frame and the end frame of the video segment in response to the video reverse playback instruction and perform video pre-reading, which includes: reading the data segment at a preset time interval before the end frame to obtain key frame index information.

[0038] The video reading module 406 is used to locate the timestamp of the target key frame from the video segment according to the key frame index information, select the data frame to be played in order, obtain the target video segment stream data and send it to the streaming media player 408;

[0039] The streaming media player 408 is used to select the video frames to be played from the target video segment in sequence, cache the key frame index information of the video frames to be played to obtain GOP unit groups, and render and play them in reverse order according to the GOP unit groups, wherein there is a one-to-one correspondence between the key frames and the GOP unit groups.

[0040] Reference Figure 2 , shows a second structural schematic diagram of an MP4 video playback device embodiment of the present application, such as Figure 2 As shown, the pre-reading module 404 and the video reading module 406 are operated in parallel using dual threads. After receiving the video rewinding instruction, the pre-reading module 404 undertakes the key task of obtaining the start frame and the end frame of the video clip and performing video pre-reading. The core is to obtain the key frame index information by reading the data segment of the preset time interval before the end frame. For example, in a video clip with a duration of 60 seconds, the preset time interval can be set to 10 seconds. When the rewinding instruction is received and it is determined that the end frame is at the 60th second, the pre-reading module 404 will read the data segment from the 50th second to the 60th second to extract the key frame index information.

[0041] The video reading module 406 accurately locates the timestamp of the target key frame from the video clip according to the key frame index information obtained by the pre-reading module 404, and then selects the data frames to be played in sequence, and finally forms the target video clip stream data and sends it to the streaming media player 408. For example, after receiving the key frame index information from the pre-reading module 404, if the timestamp of the target key frame is the 45th second, the video reading module 406 will start from the 45th second in the video clip, and select the subsequent data frames in sequence, such as the data frames of the 46th second, the 47th second, etc., to form the target video clip stream data.

[0042] Based on the contents disclosed in the above embodiments, the present application proposes an optional streaming media player in an MP4 video reversing device, including: a cache reading module and a data assembly module; the cache reading module is used to select video frames to be played from the target video segment according to the timestamp and in an ascending order according to the timestamp information, and cache the key frame index information of the video frames to be played to obtain a GOP unit group; the data assembly module is used to render and play according to the GOP unit group in reverse order of time points.

[0043] Reference Figure 3 , shows a schematic diagram of the structure of a streaming media player operating embodiment of the present application, such as Figure 3 The streaming media player 408 first selects the video frames to be played from the target video segment according to the timestamp and in ascending order of the timestamp information, and then caches the key frame index information of the video frames to be played to obtain a GOP unit group, which is video data in the form of a GOP (Group Of Pictures) package.

[0044] Finally, the GOP unit groups are sent to the front-end player for rendering and playback in reverse order of time points from large to small. For example, after obtaining the target video segment stream data, the streaming media player 408 will first filter out the video frames to be played, such as the video frames at the 30th second, the 31st second, etc., and then cache these video frames as GOP unit groups according to their key frame index information. Assuming that a GOP unit group contains a series of video frames from a key frame to before the next key frame, these GOP unit groups are finally sent to the front-end player in reverse order, such as starting from the last GOP unit group, for rendering and playback, so as to achieve the reverse playback effect of the video.

[0045] Based on the contents disclosed in the above embodiments, the present application proposes an optional pre-reading module 404 in an MP4 video reversing device, which is also used to update the timestamp of the end frame of the video clip to the timestamp of the end frame of the preset interval time and perform the video pre-reading when the number of queue elements in the cache queue is less than a preset threshold.

[0046] Specifically, when the number of queue elements in the cache queue is less than a preset threshold, the pre-reading module 404 also has the function of updating the timestamp of the end frame of the video clip to the timestamp of the end frame of the preset interval time and performing video pre-reading again. For example, if the preset threshold is 5 queue elements, the current cache queue has only 3 elements, and the timestamp of the end frame of the original video clip is the 80th second, and the end frame corresponding to the preset interval time is the 70th second, then the pre-reading module 404 will update the timestamp of the end frame of the current video clip to the 70th second, and then re-execute the video pre-reading operation to ensure the smoothness of the subsequent reverse playback.

[0047] In one embodiment, the pre-reading module includes a key frame reading unit and a buffer queue. The key frame reading unit is responsible for reading the key frames of a preset time interval before the specified end time frame by frame. For example, when reading the key frames in the last 20 seconds of a video, each key frame is accurately identified, and its timestamp information and position information are stored as key frame index information in the first cache queue. The buffer queue is used to record all the key frame index information read, and cache them in order from large to small timestamp information, so as to quickly locate and call the key frames later.

[0048] Based on the contents disclosed in the above embodiments, the present application proposes an optional MP4 video reversing device in which the video reading module includes a key frame reading unit and a segmented cache unit. After the key frame reading unit takes out the key frame index information of the target key frame from the first cache queue, it can quickly locate the timestamp of the target key frame, and select the data frame to be played from the video clip in the order of the timestamp information from small to large. The segmented cache unit reads the streaming media data from the data frame to be played at a preset rate. For example, the preset rate is to read 20 frames of data per second. The segmented cache unit will stably read the data at this rate to ensure stable transmission and processing of the data.

[0049] Conventional mechanical disk IO read rate is usually 100MB / s. It can read about 5MB of 10s data of 4Mb / s bit rate in 0.05s. SSD is faster. The effect of disk reading on I frame positioning during reverse playback can be ignored. The difference is that in network storage environment, the bandwidth usually does not exceed 1000M. Even in many enterprise production environments, the network bandwidth is less than 100M. In addition, the bandwidth that can be allocated to a single channel of audio and video is limited to meet the needs of multi-channel reading. Therefore, it takes a long time to find I frames when reading data. For example, it takes about 0.5s to read 10 seconds of 4Mb / s bit rate in a 100M bandwidth environment.

[0050] Through the collaborative work of the above-mentioned pre-reading module, the video reading module and the streaming media player, the present invention can realize the pre-reading of the I frame (key frame) position by an independent thread, without affecting the rate of the normal code stream reading module, thereby ensuring the smoothness and stability of the video reading. At the same time, different from the traditional pre-reading, only the timestamp information and position information in the key frame index information are cached after reading here, instead of caching the entire GOP data frame, which greatly reduces the memory usage on the server side.

[0051] At present, conventional video recording platforms decode the files to be played back, re-encode them in reverse order, and then distribute them. Since encoding and decoding greatly occupies hardware resources, the number of simultaneous reverse playback streams cannot be too large. The present invention assigns the decoding task to the front-end player, which occupies very little resources of the streaming media server and can greatly reduce hardware costs.

[0052] Furthermore, by distributing playback streams through streaming media, only one read input is needed for the same playback stream, and the picture coordination of multiple clients can be achieved, that is, one person can order and multiple people can watch.

[0053] The following describes the working process of the MP4 video reversing device of this solution with a specific embodiment.

[0054] S1: The front-end player sends a reverse playback instruction, specifying the start time Ts and end time Te of the video segment to be reversed.

[0055] S2: The pre-reading module 404 receives the reverse playback instruction and responds to the video reverse playback instruction to obtain the start frame and the end frame of the video clip, opens the video and locates to the N seconds before the specified end time Te (for example, 10 seconds), reads frame by frame to the end time Te, and records the timestamp information and position information of all the key frames read, sorts the timestamp information from large to small and inputs it into the cache queue. It should be noted that the cache queue of the video reading module 406 of the present invention only caches the key frame index, including the timestamp information and position information therein, but does not cache the frame data.

[0056] S3: The video reading module 406 takes out the first key frame timestamp from the cache queue, locates the timestamp after opening the video, reads the data frames one by one in sequence until the next key frame or the end of the file, and passes the read data to the streaming media.

[0057] The pre-reading module 404 and the video reading module 406 are operated in parallel using dual threads.

[0058] Furthermore, the preset threshold of the cache queue elements in the pre-reading module 404 is set to A. When the number of queue elements is less than A, the pre-reading module 404 updates the Te value to Te-N and restarts step 2.

[0059] S4: The streaming media distributes the streaming media data transmitted in S3 to the front-end player in sequence.

[0060] S5: After receiving the streaming data distributed by the streaming media, the streaming media player 408 decodes the data in sequence, and caches the data from one key frame to the next key frame (excluding the key frame) in sequence as a GOP unit group after decoding.

[0061] When the data cache of a GOP unit group is completed, the data of the next unit group is cached to a new GOP unit group, and the data of the previous group is rendered and played in reverse order.

[0062] According to the second aspect of the present application, a method for reversing an MP4 video is also provided, referring to Figure 4 , shows a flow chart of an embodiment of an MP4 video playback method of the present application, which is applied to a playback system stored in an IP-SAN;

[0063] Step S102: receiving a video rewind instruction, obtaining a start frame and an end frame of a video segment in response to the video rewind instruction and performing video pre-reading; the video pre-reading includes: reading a data segment of a preset time interval before the end frame to obtain key frame index information;

[0064] Step S104: locating the timestamp of the target key frame from the video segment according to the key frame index information and selecting the data frames to be played in order to obtain the target video segment stream data;

[0065] Step S106: Selecting video frames to be played from the target video segment in order, caching them according to key frame index information of the video frames to be played to obtain GOP unit groups, and rendering and playing them in reverse order according to the GOP unit groups.

[0066] There is a one-to-one correspondence between the key frames and the GOP unit groups.

[0067] Specifically, after responding to the video rewind instruction, the start frame and the end frame of the video segment are obtained, and a video pre-reading operation is performed. The specific process of video pre-reading is: reading data segments at a preset time interval before the end frame, and extracting key frame index information from these data segments.

[0068] Then, the timestamp of the target key frame is located from the video segment according to the key frame index information provided by the pre-reading module 404, and the data frames to be played are selected in the order of the timestamp information from small to large. These data frames to be played are combined into the target video segment stream data.

[0069] After receiving the target video clip stream data, select the video frames to be played in ascending order according to the timestamp information, and cache them according to the key frame index information of these video frames to obtain the GOP unit group. Finally, render and play them according to the reverse time point order according to the GOP unit group to achieve the reverse playback effect of the video.

[0070] Based on the contents disclosed in the above embodiments, the MP4 video reversing device proposed in the present application further includes, after obtaining the start frame and the end frame of the video segment in response to the video reversing instruction and performing video pre-reading:

[0071] When the number of queue elements in the cache queue is less than a preset threshold, the timestamp of the end frame of the video segment is updated to the timestamp of the end frame of the preset interval time and the video pre-reading is performed.

[0072] The key frame index information includes the timestamp information and position information of the key frame, which provides a basis for subsequent positioning and playback.

[0073] Specifically, when the number of queue elements in the cache queue is less than a preset threshold, the end frame timestamp of the video segment is updated to the end frame timestamp of the preset interval time, and a new video pre-reading operation is performed. This can ensure that when the cache data is insufficient, new key frame index information is added in time to ensure the smoothness of video playback.

[0074] As for the method embodiment, since it is basically similar to the device embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the device embodiment.

[0075] The present application also provides an electronic device, including:

[0076] It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned MP4 video reverse playback method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0077] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, each process of the above-mentioned MP4 video reverse playback method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0078] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0079] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0080] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0081] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0082] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable terminal device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0083] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0084] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0085] The above is a detailed introduction to an MP4 video reversal method, an MP4 video reversal device, a corresponding electronic device and a corresponding computer storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for a person skilled in the art, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. An MP4 video playback device, characterized in that: The device is applied to a playback system stored in IP-SAN, and includes a pre-reading module, a video reading module and a streaming media player; the pre-reading module and the video reading module are operated in parallel using dual threads; The pre-reading module is used to obtain the start frame and the end frame of the video segment in response to the video reverse playback instruction and perform video pre-reading, wherein the video pre-reading includes: reading a data segment of a preset time interval before the end frame to obtain key frame index information; The video reading module is used to locate the timestamp of the target key frame from the video segment according to the key frame index information, select the data frame to be played in order, obtain the target video segment stream data and send it to the streaming media player; The streaming media player is used to select video frames to be played from the target video segment in sequence, cache the key frame index information of the video frames to be played to obtain a GOP unit group, and render and play in reverse order according to the GOP unit group, wherein there is a one-to-one correspondence between the key frames and the GOP unit groups.

2. The MP4 video playback device according to claim 1, characterized in that: The pre-reading module is also used to update the timestamp of the end frame of the video segment to the timestamp of the end frame of the preset interval time and perform the video pre-reading when the number of queue elements in the cache queue is less than a preset threshold.

3. The MP4 video playback device according to claim 1, characterized in that: The pre-reading module includes: a key frame reading unit and a buffer queue; The key frame reading unit is used to read the key frames of a preset time interval before the specified end time frame by frame to obtain key frame index information and store it in the first cache queue; the key frame index information includes the timestamp information and position information of the key frame; The buffer queue is used to record the key frame index information of all key frames read, and cache them after sorting them from large to small according to the timestamp information.

4. The MP4 video playback device according to claim 3, characterized in that: The video reading module includes: a key frame reading unit and a segment buffer unit; The key frame reading unit is used to retrieve the key frame index information of the target key frame from the first cache queue, locate the timestamp of the target key frame, and select the data frame to be played from the video clips in the ascending order of the timestamp information; The segment buffer unit is used to read the streaming media data from the data frames to be played in reverse order from large to small according to a preset rate.

5. The MP4 video playback device according to claim 1, characterized in that: The streaming media player comprises: a cache reading module and a data assembling module; The cache reading module is used to select the video frames to be played from the target video segment according to the timestamp and in the order of timestamp information from small to large, and cache the video frames to be played according to the key frame index information to obtain the GOP unit group; The data assembly module is used to render and play according to the GOP unit group in reverse order of time points.

6. A method for reverse playback of MP4 video, characterized in that: The playback system applied to IP-SAN storage includes: Receive a video rewind instruction, obtain a start frame and an end frame of a video segment in response to the video rewind instruction and perform video pre-reading; the video pre-reading includes: reading a data segment of a preset time interval before the end frame to obtain key frame index information; Locating the timestamp of the target key frame from the video segment according to the key frame index information, and then selecting the data frames to be played in order to obtain the target video segment stream data; Select the video frames to be played from the target video segment in order, cache the key frame index information of the video frames to be played to obtain a GOP unit group, and render and play them in reverse order according to the GOP unit group, wherein the key frames correspond to the GOP unit group one by one.

7. The MP4 video playback method according to claim 6, characterized in that: After acquiring the start frame and the end frame of the video segment in response to the video rewind instruction and performing video pre-reading, the method further includes: When the number of queue elements in the cache queue is less than a preset threshold, the timestamp of the end frame of the video segment is updated to the timestamp of the end frame of the preset interval time and the video pre-reading is performed.

8. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the steps of the MP4 video reversal playback method as described in any one of claims 6 to 7 are implemented.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the MP4 video playback method as described in any one of claims 6 to 7 are implemented.