Video multi-data stream recording and playback method and device and electronic equipment

By calculating the target video encoding time of image frames and metadata frames in the video data stream, the problem of being unable to synchronize multiple data streams in the existing technology is solved, and synchronous recording and playback of multiple data streams is realized, ensuring time consistency and Data integrity.

CN118714366AActive Publication Date: 2024-09-27DIANYUN TECH (SHENZHEN) CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410721030.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2024-09-27
Estimated Expiration
2044-06-05

AI Technical Summary

Technical Problem

Existing cameras and webcams cannot synchronize the data streams of multiple cameras, cannot recover sensor data and metadata information, and limit the recording and playback functions of multiple data streams.

Method used

By calculating the target video encoding time corresponding to the image frame and the metadata frame in the video data stream, writing it into the metadata stream, and recording and playback based on the video data stream, metadata files and other data streams to achieve multi-data Stream synchronization.

Benefits of technology

It achieves precise synchronization of multiple data streams, ensures time consistency and data integrity, allows video stream parameters to be adjusted during the recording process without affecting recording and playback, and improves the convenience of data management and backup and recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118714366A
    Figure CN118714366A
Patent Text Reader

Abstract

The invention provides a video multi-data stream recording and playback method and device and electronic equipment, and relates to the field of data processing. The video multi-data stream recording and playback method comprises the following steps: calculating target video coding time of a target image frame according to a plurality of image frames in a video data stream and a plurality of metadata frames respectively corresponding to the plurality of image frames in an original metadata stream; writing the target video coding time into the original metadata stream to obtain a metadata file; video is recorded and played back based on the video data streams, metadata files, and other data streams. By using the video multi-data stream recording and playback method provided by the embodiment of the invention, recording and playback can be performed on a camera with multiple lenses and an attached sensor, and playback of multiple data streams can be synchronized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to a field, and in particular to a method, device and electronic device for recording and replaying multiple video data streams. Background Art

[0002] Video recording and playback are widely used in monitoring, creation, learning, and entertainment. The recording and playback functions of cameras and webcams are realized by saving video data to local files. During recording, the video is captured, compressed, and stored in real time; during playback, the video is reproduced by reading, decoding, and displaying.

[0003] However, the recording and playback functions of existing cameras and webcams can only operate on the video data of a single camera, and cannot recover other sensor data and metadata information transmitted in the camera. In addition, for cameras with multiple camera sensors (for example, ordinary RGB camera sensors and special camera sensors such as ToF sensors or LiDAR sensors) with multiple data streams, current playback recording technology cannot synchronize the data streams of multiple cameras. Summary of the invention

[0004] The purpose of the embodiments of the present application is to provide a method, device and electronic device for recording and playing back multiple video data streams, which can realize synchronous playback of multiple data streams by recording and playing back a camera with multiple lenses and accompanying sensors.

[0005] In a first aspect, an embodiment of the present application provides a method for recording and playing back multiple video data streams, the method comprising: calculating a target video encoding time of a target image frame based on multiple image frames in a video data stream and multiple metadata frames in an original metadata stream that respectively correspond to the multiple image frames; writing the target video encoding time into the original metadata stream to obtain a metadata file; and recording and playing back the video based on the video data stream, the metadata file and other data streams.

[0006] In the above implementation process, the video multi-stream recording and playback method provided by the embodiment of the present application calculates the target video encoding time of the target image frame, writes it into the original metadata stream, and performs recording and playback operations based on the video data stream, metadata file and other data streams. The video multi-stream data recording and playback method provided by the embodiment of the present application realizes the precise synchronization of multiple data streams, ensuring the time consistency during the multi-stream recording and playback process.

[0007] According to multiple image frames in a video data stream and multiple metadata frames in an original metadata stream respectively corresponding to the multiple image frames, a target video encoding time of a target image frame is calculated, including: obtaining a target recording timestamp and a previous recording timestamp from metadata frames corresponding to the target frame and a previous frame of the target frame, and a previous video encoding time corresponding to the previous frame of the target frame, respectively; wherein an initial value of the video encoding time is 0; calculating a time difference between the target recording timestamp and the previous recording timestamp; and adding the time difference to the previous video encoding time to obtain a target video encoding time.

[0008] In the above implementation process, the recording and playback method of video multiple data streams provided in the embodiment of the present application can calculate the target video encoding time of the target image frame based on multiple image frames in the video data stream and multiple metadata frames corresponding to these image frames in the original metadata stream; the calculated target video encoding time corresponds to the recording timestamp of the image frame, thereby achieving time synchronization between the image frames in the video data stream and the metadata frames in the original metadata stream, and the relevant information of each image frame can be accurately obtained during the playback operation.

[0009] Optionally, in an embodiment of the present application, the target video encoding time is written into the original metadata stream to obtain a metadata file, including: for each metadata frame in the original metadata stream, each metadata frame is divided into a metadata header and metadata for storage; the video encoding time corresponding to each metadata frame is written into the corresponding metadata header to obtain a metadata file in which the metadata header and metadata are alternately stored.

[0010] In the above implementation process, the recording and playback method of video multi-stream data provided by the embodiment of the present application realizes writing the target video encoding time into the original metadata stream, and finally generates a metadata file containing time information. It realizes binding the image frame with the corresponding metadata, and the relevant information of each image frame can be accurately obtained during playback.

[0011] Optionally, in an embodiment of the present application, based on the video data stream, metadata file and other data streams, video is recorded and played back, including: storing the video data stream as a video file including image frames, and storing other data streams as other data files including other recording timestamps; storing metadata files, video files and other data files to complete the recording of the video.

[0012] In the above implementation process, the recording and playback method of video multiple data streams provided by the embodiment of the present application completes the recording of the video by storing the video data stream as a video file including image frames, and storing other data streams as other data files including other recording timestamps. In this process, the original metadata is written into the encoding time, corresponding to the image frame one by one, forming a metadata file. In addition, the sensor data and control data are directly saved in the corresponding binary file to ensure the integrity and consistency of the data. During the playback process, the synchronous playback of multiple data streams is achieved through the synchronization principle of the recording time and the current time flow rate, and even if the stream is changed, it will not affect the normal synchronization. In addition, due to the dynamic adaptability of the scheme, real-time processing capability and correct association with metadata, it is also allowed to adjust the video stream during the recording process, such as modifying the resolution and format, without affecting the normal recording and playback.

[0013] Optionally, in an embodiment of the present application, the video data stream is stored as a video file including image frames, including: performing image compression, graphic encoding and image multiplexing on the image frames, and storing the video data stream as multiple video files including image frames; and separately storing the metadata files corresponding to the image frames in each video file to establish a video file and metadata file pair.

[0014] In the above implementation process, multiple image frames in each video file are stored separately with the corresponding metadata files, which can ensure the continuity of timestamps during playback. Even if special circumstances occur during recording, the smoothness and accuracy of playback can be ensured. When dealing with abnormal situations, data management and processing can be more convenient, and data backup and recovery can also be achieved more easily.

[0015] Optionally, in an embodiment of the present application, recording and playing back videos based on video data streams, metadata files and other data streams also includes: reading other recording timestamps in other data files; determining the recording timestamps of image frames and the metadata corresponding to the image frames in the metadata files according to the video encoding time of the image frames in the video data stream; synchronizing the recording timestamps of the image frames with the image frames, metadata and other data corresponding to the other timestamps to play back the video.

[0016] In the above implementation process, the video multi-data stream recording and playback method provided in the embodiment of the present application can accurately obtain the recording timestamps of the image frames in the video data stream and the timestamps in other data streams during the playback process, and match and synchronize them; make the time between different data streams consistent, so that the video playback process has temporal coherence, and the image frames and data frames in other data streams are correctly matched in time order, so that the video playback process has data accuracy.

[0017] Optionally, in an embodiment of the present application, the recording timestamp of the image frame and the image frames, metadata and other data corresponding to other timestamps are synchronized for video playback, including: calculating the simulated recording time based on the actual time and the recording start time; when the recording timestamp reaches the simulated recording time, the image frames, metadata and other data corresponding to the recording timestamp are transmitted for video playback.

[0018] In the above implementation process, when obtaining metadata, the recording timestamp and the encoding time of the image frame can be obtained at the same time. In this way, a set of corresponding frames and metadata are obtained, with the recording timestamp. By repeating this process, all image streams can be obtained. At the same time, when reading sensor data frames and control data frames, their recording timestamps can also be directly obtained. When the recording timestamp reaches the analog recording time, the data is transmitted, thereby achieving synchronization of the data stream; even if the rates of each stream are different, it will not be affected.

[0019] In a second aspect, an embodiment of the present application provides a recording and playback device for multiple video data streams, and the recording and playback device for multiple video data streams includes: a data processing module and a recording and playback module; the data processing module is used to calculate the target video encoding time of the target image frame according to multiple image frames in the video data stream and multiple metadata frames in the original metadata stream that respectively correspond to the multiple image frames; the data processing module is also used to write the target video encoding time into the original metadata stream to obtain a metadata file; the recording and playback module is used to record and play back the video based on the video data stream, the metadata file and other data streams.

[0020] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory and a processor, wherein the memory stores program instructions, and when the processor reads and runs the program instructions, it executes the steps in any of the above implementation methods.

[0021] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer program instructions, and when the computer program instructions are read and executed by a processor, the steps in any of the above-mentioned implementation methods are executed. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0023] Figure 1Provided for the embodiment of the present application is a flowchart of a method for recording and replaying multiple video data streams;

[0024] Figure 2 A schematic diagram of data transmission provided in an embodiment of the present application;

[0025] Figure 3 A flow chart for calculating the video encoding time provided in an embodiment of the present application;

[0026] Figure 4 A schematic diagram of the metadata file structure provided in the embodiment of the present application;

[0027] Figure 5 A schematic diagram of storing multi-stream data provided in an embodiment of the present application;

[0028] Figure 6 A schematic diagram of the sensor data file structure provided in an embodiment of the present application;

[0029] Figure 7 A schematic diagram of a file pair provided for an embodiment of the present application;

[0030] Figure 8 Flowchart of video playback provided for implementation of this application;

[0031] Fig. 9 A schematic diagram of video playback provided in an embodiment of the present application;

[0032] Fig.10 A schematic diagram of calculating the simulated recording time provided in an embodiment of the present application;

[0033] Fig.11 A flow chart for calculating the simulated recording time provided in an embodiment of the present application;

[0034] Fig.12 A schematic diagram of a module of a video multi-stream recording and playback device provided in an embodiment of the present application;

[0035] Fig.13 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0036] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings in the embodiments of the present application. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architectures, functions and operations of the systems, methods and computer program products according to multiple embodiments of the present invention. In this regard, each box in the flowchart or block diagram may represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they may sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or the flowchart, and the combination of boxes in the block diagram and / or the flowchart, can be implemented by a dedicated hardware-based system that performs a specified function or action, or can be implemented by a combination of dedicated hardware and computer instructions. In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist separately, or two or more modules can be integrated to form an independent part.

[0037] Video recording and playback refers to the process of capturing video data through a camera or webcam and saving it to a local storage device so that it can be read, decoded, and displayed later. During the recording process, the video is captured, compressed, and stored in real time; during playback, the video content is reproduced and reviewed by reading, decoding, and displaying the video. Video recording and playback are widely used in many fields such as monitoring, creation, learning, and entertainment.

[0038] The inventors have found that the recording and playback functions of existing cameras and network cameras can only operate on the video data of a single camera, and are unable to recover other sensor data and metadata information transmitted in the camera.

[0039] In addition, current technology cannot synchronize the data streams of multiple camera sensors, such as devices with both ordinary RGB camera sensors and special camera sensors (such as ToF sensors or LiDAR sensors). This results in the inability to synchronize multiple data streams, integrate multiple data types, and effectively recover sensor data and metadata information during recording and playback.

[0040] Therefore, although the recording and playback functions of existing cameras and webcams perform well in capturing and playing back single video data, there are still significant limitations and challenges when facing the needs of multi-sensor data and metadata information.

[0041] Based on this, the present application proposes a method, device and electronic device for recording and replaying multiple video data streams. The method for recording and replaying multiple video data streams binds the time of each frame of the video to the recording time in the corresponding metadata during recording; during playback, the corresponding image is found through a frame of metadata; and the principle that the recording time is the same as the current time flow rate is used to achieve synchronous playback of multiple data streams.

[0042] Please see Figure 1 , Figure 1 The embodiment of the present application provides a flowchart of a method for recording and replaying a video multi-data stream; the present application provides a method for recording and replaying a video multi-data stream, which can be recorded and replayed by Fig.13 electronic devices to perform.

[0043] The video multi-stream recording and playback method provided in the embodiment of the present application includes the following steps:

[0044] Step S100: Calculate a target video encoding time of a target image frame according to a plurality of image frames in a video data stream and a plurality of metadata frames in an original metadata stream respectively corresponding to the plurality of image frames.

[0045] In step S100, it is first necessary to obtain an image frame and a metadata frame corresponding to the image frame, so as to encode the time of a certain image frame in the recorded video to obtain the video encoding time.

[0046] It should be understood that a video is composed of a series of image frames played continuously, usually played at a certain speed (frame rate) to form a dynamic visual effect. The main purpose of the video multi-stream recording and playback method provided in the embodiment of the present application is to synchronize image frames, metadata and other data streams.

[0047] The video data stream in the embodiment of the present application may include RGB data stream and other image data streams, such as infrared (IR) image data stream, thermal imaging data stream, laser radar (LiDAR) data stream, ultrasonic data stream, etc.; wherein the infrared (IR) image data stream corresponds to infrared image frames, the thermal imaging data stream corresponds to thermal image frames, the laser radar (LiDAR) data stream corresponds to point cloud data, the ultrasonic data stream corresponds to ultrasonic image frames, etc.

[0048] The metadata of a camera is additional information describing the images or videos captured by the camera, which usually includes shooting time, shooting location, camera model, exposure parameters (such as aperture, shutter speed, ISO), focal length, white balance settings, focus information, etc. In the embodiment of the present application, stream synchronization is achieved by binding the time of the image frame in the video (video encoding time) and the recording time (the actual recording time recorded in the metadata).

[0049] That is to say, the target video encoding time in the embodiment of the present application is the time of the target image frame in the recorded video, and this time corresponds to the actual recording time in the metadata corresponding to the target image frame.

[0050] Step S200: writing the target video encoding time into the original metadata stream to obtain a metadata file.

[0051] In the above step S200, after obtaining the target video encoding time of the target image frame in the recorded video, the target video encoding time is further written into the original metadata stream, thereby obtaining a metadata file. During playback, the corresponding image frame can be found through the metadata in the metadata file to achieve time alignment.

[0052] Step S300: Record and play back the video based on the video data stream, metadata file and other data streams.

[0053] In the above step S300, based on the obtained video data stream (including several image frames), metadata file (including target video encoding time), and other data streams, the video is recorded, and the video can be played back based on the recorded file.

[0054] It should be noted that the other data streams in the embodiments of the present application may be data detected by various sensors in the camera, that is, sensor data streams, such as temperature sensors, jitter sensors, etc. Since the image may change during the transmission process when the video is recorded as the algorithm is added, the other data streams in the embodiments of the present application may also be control data streams corresponding to the control operations of the camera.

[0055] Please Figure 1 See on the basis of Figure 2 , Figure 2 A data transmission diagram provided for an embodiment of the present application; the camera includes RGB data streams, special image data streams, and data streams of various sensors. The host may have some operations on the camera, corresponding to the control streams; these data streams are stored in the host (can also be stored in the camera), and after being processed through multiple data streams, when playing the video on the display device, both the real-time images transmitted from the camera and processed by the host can be played, and the recorded videos previously saved in the host storage space can be played.

[0056] pass Figure 1 and Figure 2It can be seen that the video multi-stream recording and playback method provided in the embodiment of the present application calculates the target video encoding time of the target image frame, writes it into the original metadata stream, and performs recording and playback operations based on the video data stream, metadata file and other data streams. The video multi-stream data recording and playback method provided in the embodiment of the present application realizes the precise synchronization of multiple data streams and ensures the time consistency during the multi-stream recording and playback process.

[0057] Please see Figure 3 , Figure 3 A flow chart for calculating the video encoding time provided in an embodiment of the present application; in an optional implementation of an embodiment of the present application, the above step S100 calculates the target video encoding time of the target image frame according to the multiple image frames in the video data stream and the multiple metadata frames in the original metadata stream respectively corresponding to the multiple image frames, which can be implemented by the following steps:

[0058] Step S110: acquiring a target recording timestamp and a previous recording timestamp from the target frame and metadata frames corresponding to the previous frame of the target frame, and a previous video encoding time corresponding to the previous frame of the target frame, respectively.

[0059] In the above step S110, the target recording timestamp and the previous recording timestamp, as well as the previous video encoding time corresponding to the previous frame, are obtained from the metadata frame corresponding to the target frame and the previous frame. The target video encoding time of the target frame can be calculated by the recording timestamp of the target frame and the recording timestamp of the previous frame, as well as the video encoding time corresponding to the previous frame; it should be noted that the initial value of the video encoding time is 0, because the recorded video time usually starts from 0.

[0060] Step S120: Calculate the time difference between the target recording timestamp and the previous recording timestamp.

[0061] Step S130: Add the time difference to the previous video encoding time to obtain the target video encoding time.

[0062] In the above steps S120-S130, the time difference between the target recording timestamp and the previous recording timestamp is calculated, that is, the time interval between the target frame and the previous frame. Further, the calculated time difference is added to the previous video encoding time to obtain the target video encoding time of the target frame. It should be understood that the obtained target video encoding time will be used to mark the time position of the target frame in the final recorded video.

[0063] That is to say, the target video encoding time of the target frame can be calculated in the following way: target video encoding time = previous video encoding time + (target recording timestamp - previous recording timestamp); for example, the previous video encoding time is the 1st second, the target recording timestamp is 12:00:02 on day A, and the previous recording timestamp is 12:00:01 on day A, then the target video encoding time = 1 second + 1 second = 2 seconds, that is, the target image frame should be the 2nd second of the recorded video.

[0064] pass Figure 3 It can be seen that the recording and playback method of video multiple data streams provided in the embodiment of the present application can calculate the target video encoding time of the target image frame based on multiple image frames in the video data stream and multiple metadata frames corresponding to these image frames in the original metadata stream; the calculated target video encoding time corresponds to the recording timestamp of the image frame, thereby realizing the time synchronization between the image frames in the video data stream and the metadata frames in the original metadata stream, and the relevant information of each image frame can be accurately obtained during the playback operation.

[0065] Please see Figure 4 , Figure 4 A schematic diagram of the structure of a metadata file provided in an embodiment of the present application; in an optional implementation of an embodiment of the present application, step S200 writes the target video encoding time into the original metadata stream to obtain a metadata file, which can be implemented in the following manner:

[0066] For each metadata frame in the original metadata stream, each metadata frame is divided into a metadata header and metadata for storage; the video encoding time corresponding to each metadata frame is written into the corresponding metadata header to obtain a metadata file in which the metadata header and metadata are alternately stored.

[0067] like Figure 4 As shown in the figure, for each metadata frame in the original metadata stream, it is divided into a metadata header and a metadata part. The metadata header is used to store the binding information of the frame and metadata, including metadata size, recording timestamp, video encoding time and other information, while the metadata part stores the specific metadata content. The target video encoding time corresponding to each metadata frame is written into the corresponding metadata header, and the processed metadata header and metadata are stored alternately to form a complete metadata file.

[0068] The metadata file includes a metadata header, such as Figure 4 As shown, the total metadata header stores the necessary information for simulating camera equipment and provides basic information related to the entire recording process, such as camera model, shooting time, etc.

[0069] pass Figure 4It can be seen that the recording and playback method of video multi-stream data provided in the embodiment of the present application realizes writing the target video encoding time into the original metadata stream, and finally generates a metadata file containing time information. It realizes binding the image frame with the corresponding metadata, and the relevant information of each image frame can be accurately obtained during playback.

[0070] Please see Figure 5 , Figure 5 A schematic diagram of saving multi-stream data provided in an embodiment of the present application; in an embodiment of the present application, the above step S300 records and plays back a video based on a video data stream, a metadata file, and other data streams, including the following contents:

[0071] The video data stream is stored as a video file including image frames, and other data streams are stored as other data files including other recording time stamps; metadata files, video files and other data files are stored to complete the recording of the video.

[0072] Other data files Figure 5 In the example, the sensor data file corresponds to the sensor data, and the control data file corresponds to the control data; according to Figure 5 It can be seen that the image frames corresponding to the metadata one by one calculate the video encoding time and then write the encoding time into the metadata; further, after the image is compressed, encoded, multiplexed and other operations are performed on the image, a video file is formed, and the video file is stored in the storage space.

[0073] The original metadata includes a recording timestamp, camera information, and corresponding image information. After the encoding time is written into the metadata and the encoding time and metadata are bound, the metadata is stored as a metadata file.

[0074] Please refer to Figure 6 , Figure 6 Schematic diagram of the sensor data file structure provided in the embodiment of the present application; the storage of sensor and control data is relatively simple, that is, the timestamp of the data is directly bound with the size of the data frame and the data and saved in a binary file, such as Figure 6 As shown in the figure, taking the sensor file as an example, each frame of sensor data contains the recording timestamp, the length of the sub-frame data, and the sensor data. The structure of the control data file is similar to that of the sensor file, and each frame contains the recording timestamp and control data.

[0075] It should be noted that the data stream in the embodiment of the present application is generated from the camera and transmitted to the host, and the host processes the data and saves it locally; in some embodiments, the data stream can be saved in the camera, and the image data is obtained from the camera, and is calculated by the host and projected onto the display device.

[0076] pass Figure 5 and Figure 6 It can be seen that the recording and playback method of video multiple data streams provided in the embodiment of the present application completes the recording of the video by storing the video data stream as a video file including image frames, and storing other data streams as other data files including other recording timestamps. In this process, the original metadata is written into the encoding time, corresponding to the image frame one by one, forming a metadata file. In addition, the sensor data and control data are directly saved in the corresponding binary file to ensure the integrity and consistency of the data. During the playback process, the synchronous playback of multiple data streams is achieved through the synchronization principle of the recording time and the current time flow rate, and even if the stream is changed, it will not affect the normal synchronization. In addition, due to the dynamic adaptability of the scheme, real-time processing capability and correct association with metadata, it is also allowed to adjust the video stream during the recording process, such as modifying the resolution and format, without affecting the normal recording and playback.

[0077] Please see Figure 7 , Figure 7 A schematic diagram of a file pair provided in an embodiment of the present application; in an optional embodiment, the video data stream is stored as a video file including image frames, including:

[0078] Image compression, graphic encoding and image multiplexing are performed on the image frames, and the video data stream is stored as multiple video files including the image frames; the metadata files corresponding to the image frames in each video file are stored separately to establish a video file and metadata file pair.

[0079] Some special situations may occur during the recording process, such as modifying the image format, image resolution, or saving files that are too large. These situations will make it impossible to continue saving the image in the original video file, so it is necessary to create a new video file and metadata file pair to achieve uninterrupted storage of video data and ensure the continuity of timestamps during playback.

[0080] It should be noted that since the data volume of the sensor data and control data files is relatively small and the format is fixed, similar special situations will not occur, so there is no need to perform the same processing.

[0081] Separately storing multiple image frames and corresponding metadata files in each video file ensures the continuity of timestamps during playback. Even if special circumstances occur during recording, the smoothness and accuracy of playback can be ensured. When dealing with abnormal circumstances, data management and processing can be more convenient, and data backup and recovery are also easier to achieve.

[0082] Please see Figure 8 , Figure 8 Flowchart of video playback provided for implementation of this application; please Figure 8See on the basis of Fig. 9 , Fig. 9 A schematic diagram of video playback provided in an embodiment of the present application; in an optional implementation of an embodiment of the present application, step S300 records and plays back a video based on a video data stream, a metadata file, and other data streams, which can be implemented by the following steps:

[0083] Step S310: Read other recording timestamps in other data files.

[0084] Step S320: determining the recording timestamp of the image frame and the metadata corresponding to the image frame in the metadata file according to the video encoding time of the image frame in the video data stream.

[0085] Step S330: Synchronize the recording timestamp of the image frame with the image frames, metadata and other data corresponding to other timestamps to play back the video.

[0086] In the above steps S310 to S330, first, other recording timestamps in other data files are read. These timestamps correspond to data frames in other data streams and are used for time synchronization with image frames in the video data stream. Then, according to the video encoding time of the image frame in the video data stream, the recording timestamp and corresponding metadata of the image frame are determined in the metadata file. Through the information in the metadata file, the recording timestamp and related metadata of each image frame can be obtained, providing necessary reference for subsequent time synchronization. Then, the recording timestamp of the image frame and other timestamps are synchronized for video playback.

[0087] That is, the image frames in the video data stream, metadata, and data frames in other data streams are matched and synchronized according to their timestamps to achieve the playback process of the entire video.

[0088] pass Figure 8 and Fig. 9 It can be seen that the video multi-data stream recording and playback method provided in the embodiment of the present application can accurately obtain the recording timestamps of the image frames in the video data stream and the timestamps in other data streams during the playback process, and match and synchronize them; make the time between different data streams consistent, so that the video playback process has temporal coherence, and the image frames and data frames in other data streams are correctly matched in time order, so that the video playback process has data accuracy.

[0089] Please see Fig.10 , Fig.10 This is a schematic diagram of the simulation recording time calculation provided in the embodiment of the present application; please Fig.10 See on the basis of Fig.11 , Fig.11A flow chart for calculating the simulated recording time provided in an embodiment of the present application; in an optional implementation of an embodiment of the present application, step S330 synchronizes the recording timestamp of the image frame with the image frames, metadata and other data corresponding to other timestamps for video playback, which may include the following steps:

[0090] Step S331: Calculate the simulated recording time according to the actual time and the recording start time.

[0091] In the above step S331, the difference between the actual time (i.e., the current actual time) and the recording start time is calculated to obtain the time interval; further, the simulated recording time is obtained by subtracting the above time interval from the actual time. By continuously updating the actual time and substituting it into the formula, the simulated recording time corresponding to the current time can be obtained.

[0092] Step S332: When the recording timestamp reaches the simulated recording time, the image frame, metadata and other data corresponding to the recording timestamp are transmitted for video playback.

[0093] When implementing data transmission control, a controller can be used to manage data transmission. The controller controls data transmission according to changes in the analog recording time. Specifically:

[0094] When the video needs to be paused, you only need to pause the update of the analog recording time and synchronously update the time interval according to the difference between the current time and the recording start time. This can achieve the pause function of the video. When the video continues to play, the analog recording time is restored.

[0095] When the video needs to jump, the difference between the jump time and the simulated recording time is calculated and reflected in the time interval. Further, the file reading position of each data stream is modified to the corresponding playback position to realize the function of video jumping.

[0096] When acquiring metadata, the recording timestamp and encoding time of the image frame can be acquired at the same time. In this way, a set of corresponding frames and metadata are acquired with the recording timestamp. By repeating this process, all image streams can be acquired. At the same time, when reading sensor data frames and control data frames, their recording timestamps can also be directly acquired. When the recording timestamp reaches the analog recording time, the data is transmitted, thereby achieving synchronization of the data streams; even if the rates of the various streams are different, it will not be affected.

[0097] In an optional embodiment, during playback, data can be sent at fixed time intervals to ensure data continuity and accuracy. By sending data at regular intervals, synchronous playback of data streams can be achieved regardless of how the rate of the data stream changes.

[0098] For slower data streams, data padding can be performed to make them reach the same frame rate as other data streams. The padding data can be repeated in the previous frame or inserted in a blank frame to keep the frame rates of the various data streams consistent.

[0099] In addition, during playback, there may be data asynchrony due to different data stream rates. To handle this situation, a buffer can be used to cache and adjust the data to ensure that the data of each data stream can be synchronized during playback.

[0100] Please see Fig.12 , Fig.12 This is a module diagram of a video multi-stream recording and playback device provided in an embodiment of the present application; the present application also provides a video multi-stream recording and playback device, and the video multi-stream recording and playback device 100 includes a data processing module 110 and a recording and playback module 120.

[0101] The data processing module 110 is used to calculate a target video encoding time of a target image frame according to a plurality of image frames in the video data stream and a plurality of metadata frames in the original metadata stream respectively corresponding to the plurality of image frames.

[0102] The data processing module 110 is further configured to write the target video encoding time into the original metadata stream to obtain a metadata file.

[0103] The recording and playback module 120 is used to record and playback videos based on video data streams, metadata files, and other data streams.

[0104] In an optional embodiment, in the process of calculating the target video encoding time of the target image frame based on multiple image frames in the video data stream and multiple metadata frames in the original metadata stream that respectively correspond to the multiple image frames, the data processing module 110 is used to: obtain the target recording timestamp and the previous recording timestamp from the metadata frames corresponding to the target frame and the previous frame of the target frame, and the previous video encoding time corresponding to the previous frame of the target frame; wherein the initial value of the video encoding time is 0; calculate the time difference between the target recording timestamp and the previous recording timestamp; and add the time difference to the previous video encoding time to obtain the target video encoding time.

[0105] In an optional embodiment, in the process of writing the target video encoding time into the original metadata stream to obtain the metadata file, the data processing module 110 is used to: for each metadata frame in the original metadata stream, divide each metadata frame into a metadata header and metadata for storage; write the video encoding time corresponding to each metadata frame into the corresponding metadata header to obtain a metadata file in which the metadata header and metadata are alternately stored.

[0106] In an optional embodiment, in the process of recording and playing back a video based on a video data stream, a metadata file and other data streams, the recording and playback module 120 is used to: store the video data stream as a video file including image frames, and store other data streams as other data files including other recording timestamps; store metadata files, video files and other data files to complete the recording of the video.

[0107] In an optional embodiment, in the process of storing the video data stream as a video file including image frames, the recording and playback module 120 is used to: perform image compression, graphic encoding and image multiplexing on the image frames, and store the video data stream as multiple video files including image frames; and separately store the metadata files corresponding to the image frames in each video file to establish a video file and metadata file pair.

[0108] In an optional embodiment, when recording and playing back videos based on video data streams, metadata files and other data streams, the recording and playback module 120 is used to: read other recording timestamps in other data files; determine the recording timestamps of image frames and the metadata corresponding to the image frames in the metadata file according to the video encoding time of the image frames in the video data stream; synchronize the recording timestamps of image frames with the image frames, metadata and other data corresponding to other timestamps to play back the video.

[0109] In an optional embodiment, in the process of synchronizing the recording timestamp of the image frame and the image frames, metadata and other data corresponding to other timestamps for video playback, the recording and playback module 120 is used to: calculate the simulated recording time based on the actual time and the recording start time; when the recording timestamp reaches the simulated recording time, the image frames, metadata and other data corresponding to the recording timestamp are transmitted for video playback.

[0110] See also Fig.13 , Fig.13 The electronic device 200 provided in the embodiment of the present application includes: a processor 201 and a memory 202, wherein the memory 202 stores machine-readable instructions executable by the processor 201, and when the machine-readable instructions are executed by the processor 201, the above method is executed.

[0111] Based on the same inventive concept, an embodiment of the present application also provides a computer-readable storage medium, in which computer program instructions are stored. When the computer program instructions are read and executed by a processor, the steps in any implementation method of the above-mentioned video multi-data stream recording and playback method are executed.

[0112] The computer-readable storage medium may be a random access memory (RAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or any other medium that can store program code.

[0113] In this article, relational terms such as first and second, etc. are used only 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 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 device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.

[0114] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for recording and replaying multiple video data streams, characterized in that: The recording and playback method comprises: Calculating a target video encoding time of a target image frame according to a plurality of image frames in a video data stream and a plurality of metadata frames in an original metadata stream respectively corresponding to the plurality of image frames; Writing the target video encoding time into the original metadata stream to obtain a metadata file; Video is recorded and played back based on the video data stream, metadata file and other data streams.

2. The method according to claim 1, characterized in that The step of calculating the target video encoding time of the target image frame according to the multiple image frames in the video data stream and the multiple metadata frames in the original metadata stream respectively corresponding to the multiple image frames comprises: Obtaining a target recording timestamp and a previous recording timestamp from metadata frames corresponding to the target frame and the previous frame of the target frame, and a previous video encoding time corresponding to the previous frame of the target frame, respectively; wherein the initial value of the video encoding time is 0; Calculating a time difference between the target recording timestamp and the previous recording timestamp; The target video encoding time is obtained by adding the time difference to the previous video encoding time.

3. The method according to claim 1, characterized in that The step of writing the target video encoding time into the original metadata stream to obtain a metadata file includes: For each metadata frame in the original metadata stream, each metadata frame is divided into a metadata header and metadata for storage; The video encoding time corresponding to each metadata frame is written into the corresponding metadata header to obtain the metadata file in which the metadata header and the metadata are alternately stored.

4. The method according to claim 1, characterized in that: Based on the video data stream, metadata file and other data streams, recording and playing back the video, including: storing the video data stream as a video file including image frames, and storing the other data streams as other data files including other recording timestamps; The metadata file, video file and other data files are stored to complete the recording of the video.

5. The method according to claim 4, characterized in that The step of storing the video data stream as a video file including image frames comprises: Performing image compression, graphic coding and image multiplexing on the image frames, and storing the video data stream as a plurality of video files including the image frames; The metadata file corresponding to the image frame in each video file is stored separately to establish a video file and metadata file pair.

6. The method according to claim 4, characterized in that The recording and playback of the video based on the video data stream, metadata file and other data streams also includes: Reading the other recording timestamps in the other data files; Determining, in the metadata file, a recording timestamp of the image frame and metadata corresponding to the image frame according to a video encoding time of the image frame in the video data stream; The recording timestamp of the image frame is synchronized with the image frames, metadata and other data corresponding to other timestamps to play back the video.

7. The method according to claim 6, characterized in that The step of synchronizing the recording timestamp of the image frame with the image frames, metadata, and other data corresponding to other timestamps to play back the video includes: Calculate the simulated recording time based on the actual time and recording start time; When the recording timestamp reaches the simulated recording time, the image frame, metadata and other data corresponding to the recording timestamp are transmitted for video playback.

8. A video multi-stream recording and playback device, characterized in that: The video multi-data stream recording and playback device comprises: a data processing module and a recording and playback module; The data processing module is used to calculate the target video encoding time of the target image frame according to the multiple image frames in the video data stream and the multiple metadata frames in the original metadata stream respectively corresponding to the multiple image frames; The data processing module is also used to write the target video encoding time into the original metadata stream to obtain a metadata file; The recording and playback module is used to record and play back the video based on the video data stream, metadata file and other data streams.

9. An electronic device, characterized in that: The electronic device comprises a memory and a processor, wherein the memory stores program instructions, and when the processor runs the program instructions, the steps in the method according to any one of claims 1 to 7 are executed.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the steps in the method according to any one of claims 1 to 7 are executed.

Citation Information

Patent Citations

  • A method and a device for constructing a metadata cache

    CN109684282A

  • Data synchronous encoding method of non-contact animal monitor

    CN111526338A

  • Contents and meta data recording and reproducing device and contents processing device and program

    JP2007082088A

  • Time synchronization between live video streaming and live metadata

    US10979477B1

  • Method and system for synchronization of multiple content streams

    US20160180884A1