Synchronization method, device, equipment and storage medium for multi-source recorded video streams

By extracting and correcting the i-frame timestamp of the multi-source video stream, determining the time offset, and synchronizing non-i-frames, the synchronization error and calculation burden problems in the synchronous recording of multi-source video streams in the prior art are solved, and the precise synchronization of the video stream and the consistency of the content are achieved.

CN118646942BActive Publication Date: 2025-03-11GUANGZHOU BAOLUN ELECTRONICS CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410723706.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-05
Publication Date
2025-03-11
Estimated Expiration
2044-06-05

AI Technical Summary

Technical Problem

The prior art is difficult to completely eliminate synchronization errors in real-time recording in multi-source video stream synchronous recording, with high processing complexity, increasing the computing burden of the system, and the hardware synchronization is complex and has poor flexibility, which has high requirements for the quality of the signal line and the transmission distance.

Method used

By obtaining the reference video stream and the video stream to be processed, the i-frame time stamp is extracted, the time offset is corrected, and the non-i-frames in the video stream to be processed are synchronized according to the offset, so as to achieve accurate synchronization of the video stream.

Benefits of technology

It realizes accurate synchronization of multiple video sources, ensures consistency and completeness of recorded content, reduces system computing burden, and improves synchronization accuracy and system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118646942B_ABST
    Figure CN118646942B_ABST
Patent Text Reader

Abstract

The synchronization method, device, equipment and storage medium of multi-source recorded video stream provided by the present invention obtain a reference video stream and a video stream to be processed; extract the i-frame timestamps of the reference video stream and the video stream to be processed respectively, obtain the reference i-frame timestamp and the i-frame timestamp to be processed; correct the reference i-frame timestamp and the i-frame timestamp to be processed; determine the time offset according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed; synchronize the non-i-frames in the video stream to be processed according to the time offset, the corrected reference i-frame timestamp and the i-frame timestamp to be processed. This method can accurately synchronize multiple video sources to ensure the consistency and integrity of the recorded content, and accurately calculating the time offset helps to fine-tune the video stream and achieve accurate synchronization between different video sources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of video synchronization, and in particular to a synchronization method, device, equipment and storage medium for multi-source recorded video streams. Background Art

[0002] Multi-source video stream synchronous recording technology plays an important role in many application scenarios, such as video surveillance systems, virtual reality (VR) and augmented reality (AR) systems, live sports events, multi-camera film production, etc. These applications require that multiple video sources can be recorded synchronously to ensure the time consistency between each video stream during playback or processing.

[0003] Existing technologies mainly rely on simple timestamp matching and hardware synchronization. The timestamps of each video stream are corrected through software algorithms, which cannot completely eliminate synchronization errors in real-time recording. In addition, the processing complexity is high, which increases the calculation burden of the system. Hardware synchronization can achieve precise synchronization, but the hardware connection is complex, the flexibility is poor, and it has high requirements on the quality of the signal line and the transmission distance.

[0004] In summary, the problems existing in the prior art need to be solved urgently. Summary of the invention

[0005] The present invention provides a synchronization method, device, equipment and storage medium for multi-source recorded video streams, which are used to solve the defects in the prior art, achieve accurate synchronization of multiple video sources, and ensure the consistency and integrity of recorded content.

[0006] The present invention provides a synchronization method for multi-source recorded video streams, comprising:

[0007] Obtain the baseline video stream and the video stream to be processed;

[0008] Extracting the i-frame timestamps of the reference video stream and the video stream to be processed respectively, to obtain the reference i-frame timestamp and the i-frame timestamp to be processed;

[0009] Correcting the reference i-frame timestamp and the to-be-processed i-frame timestamp;

[0010] Determine a time offset according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed;

[0011] The non-i frames in the video stream to be processed are synchronized according to the time offset, the corrected reference i-frame timestamp and the i-frame timestamp to be processed.

[0012] According to a synchronization method for multi-source recorded video streams provided by the present invention, the step of respectively extracting i-frame timestamps of the reference video stream and the video stream to be processed to obtain the reference i-frame timestamp and the i-frame timestamp to be processed specifically includes:

[0013] Determine a reference GOP length according to the number of frames in the GOP and the i-frame interval of the reference video stream;

[0014] Determine the length of the GOP to be processed according to the number of frames in the GOP of the video stream to be processed and the i-frame interval;

[0015] Extracting the reference i-frame timestamp from the reference video stream according to the reference GOP length;

[0016] The i-frame timestamp to be processed is extracted from the video stream to be processed according to the length of the GOP to be processed.

[0017] According to a synchronization method for multi-source recorded video streams provided by the present invention, the step of correcting the reference i-frame timestamp and the i-frame timestamp to be processed specifically includes:

[0018] Get system delay;

[0019] According to the system delay, the specific method of correcting the reference i-frame timestamp and the to-be-processed i-frame timestamp is as follows:

[0020] You , n ′= You , n − D

[0021] in, You , n is the timestamp of the nth i-th frame, D System delay.

[0022] According to a synchronization method for multi-source recorded video streams provided by the present invention, the specific manner of determining the time offset according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed is as follows:

[0023] Δ Thi = You , n ′− That is , n '

[0024] Among them, Δ Thi is the time offset, You , n ′ is the timestamp of the nth reference i frame of the corrected reference video stream, That is , n′ is the timestamp of the nth i-th frame to be processed in the video stream to be processed after correction.

[0025] According to a synchronization method for multi-source recorded video streams provided by the present invention, the step of synchronizing non-i frames in the video stream to be processed according to the time offset, the corrected reference i-frame timestamp and the i-frame timestamp to be processed specifically includes:

[0026] Determine the synchronization error according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed;

[0027] When the synchronization error is less than a preset threshold, the non-i frames in the video stream to be processed are synchronized according to the time offset.

[0028] According to a synchronization method for multi-source recorded video streams provided by the present invention, the step of synchronizing non-i frames in the to-be-processed video stream according to the time offset specifically includes:

[0029] Determining a frame rate delay according to the time offset;

[0030] Non-i frames in the video stream to be processed are synchronized according to the frame rate delay.

[0031] According to a synchronization method for multi-source recorded video streams provided by the present invention, the specific manner of determining the frame rate delay according to the time offset is as follows:

[0032] Δ F = Fi +Δ Thi ×(1− Fi )

[0033] Among them, Δ F is the frame rate delay, Fi is the frame rate of the video stream to be processed, Δ Thi is the time offset.

[0034] The present invention also provides a synchronization device for multi-source recorded video streams, comprising:

[0035] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for synchronizing multi-source recorded video streams as described in any one of the above is implemented.

[0036] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method for synchronizing multi-source recorded video streams as described in any one of the above is implemented.

[0037] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the method for synchronizing multi-source recorded video streams as described in any one of the above is implemented.

[0038] The synchronization method, device, equipment and storage medium of multi-source recorded video stream provided by the present invention obtain a reference video stream and a video stream to be processed; extract the i-frame timestamps of the reference video stream and the video stream to be processed respectively, obtain the reference i-frame timestamp and the i-frame timestamp to be processed; correct the reference i-frame timestamp and the i-frame timestamp to be processed; determine the time offset according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed; synchronize the non-i-frames in the video stream to be processed according to the time offset, the corrected reference i-frame timestamp and the i-frame timestamp to be processed. This method can accurately synchronize multiple video sources to ensure the consistency and integrity of the recorded content, and accurately calculating the time offset helps to fine-tune the video stream and achieve accurate synchronization between different video sources. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0040] Figure 1 It is a flow chart of a synchronization method for multi-source recorded video streams provided by the present invention;

[0041] Figure 2 It is a structural schematic diagram of a synchronization device for multi-source recorded video streams provided by the present invention;

[0042] Figure 3 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0044] Multi-source video stream synchronous recording technology plays an important role in many application scenarios, such as video surveillance systems, virtual reality (VR) and augmented reality (AR) systems, live sports events, multi-camera film production, etc. These applications require that multiple video sources can be recorded synchronously to ensure the time consistency between each video stream during playback or processing.

[0045] Timestamp matching is a common method. When collecting video data, the software will add a timestamp to each frame of video data. This timestamp is usually generated by the system clock. The timestamps of different video sources are synchronized by comparison and alignment. This method is simple to implement and low cost, but it depends on the accuracy of the system clock, there may be slight synchronization differences, and it is greatly affected by network delay and jitter.

[0046] Hardware synchronization uses a high-precision external clock source (such as GPS, atomic clock) to provide a unified time reference for multiple video sources. This method can provide nanosecond-level time synchronization with high accuracy, but it is expensive and requires additional hardware equipment, which increases the complexity of the system.

[0047] In order to solve the problems in the prior art, the present invention proposes a synchronization method for multi-source recorded video streams to achieve accurate synchronization of multiple video sources and ensure the consistency and integrity of the recorded content. The synchronization of the multi-source recorded video streams is described below. Figure 1 As shown, including but not limited to the following steps:

[0048] Step 110: Obtain a reference video stream and a video stream to be processed.

[0049] In step 110, it is necessary to obtain a reference video stream and a video stream to be processed. By obtaining relevant parameters in the reference video stream and the video stream to be processed, the parameters in the video stream to be processed can be accurately adjusted, thereby achieving synchronization of the video source. For the acquisition of the video stream, a high-resolution camera can be used to obtain the video stream to ensure the clarity and details of the video stream. The camera can be fixed or a camera with a pan / tilt control to adjust the shooting angle and position. The video stream can also be obtained through a network connection, which is convenient for remote monitoring and management. This camera can directly transmit the video stream to a server or a storage device. In this embodiment, the acquisition method of the video stream is not specifically limited, and those skilled in the art can select a suitable acquisition method according to actual conditions.

[0050] Step 120: extract the i-frame timestamps of the reference video stream and the video stream to be processed respectively to obtain the reference i-frame timestamp and the i-frame timestamp to be processed.

[0051] In step 120, it is necessary to obtain the i-frame timestamps of the reference video stream and the video stream to be processed, so as to provide a basis for the subsequent determination of the time offset of the video stream. Specifically, it is necessary to identify the i-frame positions in the video stream and mark them. Pi , n Indicates the position of the nth i-frame, GOP length Li = Number of frames in Gop / i-frame interval, and then the position of the i-frame in the video stream can be determined by the following formula:

[0052] Pi , n = n × Li

[0053] After determining the location, you can use the video decoding library to extract it, such as:

[0054] FFmpeg: is a powerful multimedia processing tool that can be used to extract i-frame information and timestamps from video streams.

[0055] OpenCV: is an open source computer vision library that supports video processing and can be used in conjunction with FFmpeg.

[0056] Step 130: Correct the reference i-frame timestamp and the to-be-processed i-frame timestamp.

[0057] In step 130, the timestamp of the i-frame to be processed needs to be calculated mainly to eliminate the influence of system delay on the timestamp of the i-frame to be processed. The calculation formula is as follows:

[0058] You , n ′= You , n − D

[0059] in, You , n ′ is the corrected i-frame timestamp, You , n is the i-frame timestamp before correction, D System delay.

[0060] System delay can be measured using a test signal, which uses a signal of known duration and records its propagation time in the system.

[0061] Step 140: Determine a time offset according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed.

[0062] In step 140, the time offset of the i-frame needs to be determined to facilitate synchronization of the video stream. Specifically, the calculation formula of the time offset is as follows:

[0063] Δ Thi = You , n ′− That is , n '

[0064] Among them, Δ Thi is the time offset, You , n ′ is the timestamp of the nth reference i frame of the corrected reference video stream, That is , n ′ is the timestamp of the nth i-th frame to be processed in the video stream to be processed after correction.

[0065] Furthermore, the time offset can also be You , n 'and That is , n The average difference between the two.

[0066] Step 150: Synchronize non-i frames in the video stream to be processed according to the time offset, the corrected reference i-frame timestamp, and the i-frame timestamp to be processed.

[0067] In step 150, after determining the time offset, the non-i frames in the video stream to be processed can be synchronized. Specifically, all frame timestamps in the video stream to be processed are extracted, and i frames and non-i frames are distinguished, and then the non-i frame timestamps are corrected using the previously calculated time offset, and then the synchronized video stream to be processed is generated according to the corrected timestamps.

[0068] The synchronization method of multi-source recorded video stream provided by the present invention obtains a reference video stream and a video stream to be processed; extracts the i-frame timestamps of the reference video stream and the video stream to be processed respectively, obtains a reference i-frame timestamp and a to-be-processed i-frame timestamp; corrects the reference i-frame timestamp and the to-be-processed i-frame timestamp; determines the time offset according to the corrected reference i-frame timestamp and the to-be-processed i-frame timestamp; synchronizes the non-i-frames in the to-be-processed video stream according to the time offset, the corrected reference i-frame timestamp and the to-be-processed i-frame timestamp. This method can accurately synchronize multiple video sources to ensure the consistency and integrity of the recorded content, and accurately calculating the time offset helps to fine-tune the video stream and achieve accurate synchronization between different video sources.

[0069] As a further optional embodiment, the step of respectively extracting the i-frame timestamps of the reference video stream and the to-be-processed video stream to obtain the reference i-frame timestamp and the to-be-processed i-frame timestamp specifically includes:

[0070] Determine a reference GOP length according to the number of frames in the GOP and the i-frame interval of the reference video stream;

[0071] Determine the length of the GOP to be processed according to the number of frames in the GOP of the video stream to be processed and the i-frame interval;

[0072] Extracting the reference i-frame timestamp from the reference video stream according to the reference GOP length;

[0073] The i-frame timestamp to be processed is extracted from the video stream to be processed according to the length of the GOP to be processed.

[0074] In this embodiment, the GOP length can be determined by the settings of the video codec or the video analysis tool. Generally, it is a fixed value, such as 10 frames or 12 frames. The i-frame interval refers to the number of interval frames between two consecutive i-frames. Normally, it is equal to the GOP length minus 1, because there is only one i-frame in a GOP, and the remaining frames are b-frames and p-frames. For the baseline video stream, the i-frame timestamp is extracted from the video stream according to the determined GOP length. The timestamp of the first i-frame can be found in each GOP as the baseline i-frame timestamp. For the video stream to be processed, similarly, the i-frame timestamp is extracted from the video stream according to the determined GOP length.

[0075] As a further optional embodiment, the step of correcting the reference i-frame timestamp and the to-be-processed i-frame timestamp specifically includes:

[0076] Get system delay;

[0077] According to the system delay, the specific method of correcting the reference i-frame timestamp and the to-be-processed i-frame timestamp is as follows:

[0078] You , n ′= You , n − D

[0079] in, You , n is the timestamp of the nth i-th frame, D System delay.

[0080] In this embodiment, a test signal with a known time can be used to obtain the system delay. For example, a specific signal is inserted into the audio or video, and its propagation time in the system is recorded to obtain the system delay value.

[0081] For the video stream to be processed, correction can be performed using the following formula:

[0082] You ,n ′= You , n − D

[0083] in, You , n is the timestamp of the nth i-th frame, D System delay.

[0084] Through this process, we can correct the i-frame timestamps in the baseline and processed video streams to make them consistent with the actual transmission time of the system.

[0085] As a further optional embodiment, the specific method of determining the time offset according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed is as follows:

[0086] Δ Thi = You , n ′− That is , n '

[0087] Among them, Δ Thi is the time offset, You , n ′ is the timestamp of the nth reference i frame of the corrected reference video stream, That is , n ′ is the timestamp of the nth i-th frame to be processed in the video stream to be processed after correction.

[0088] Through this embodiment, the time offset between the reference video stream and the video stream to be processed can be determined for subsequent synchronization processing. Accurate calculation of the time offset helps to fine-tune the video stream and achieve accurate synchronization between different video sources, which is of great significance for real-time monitoring and event backtracking.

[0089] As a further optional embodiment, the step of synchronizing the non-i frames in the to-be-processed video stream according to the time offset, the corrected reference i-frame timestamp, and the to-be-processed i-frame timestamp specifically includes:

[0090] Determine the synchronization error according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed;

[0091] When the synchronization error is less than a preset threshold, the non-i frames in the video stream to be processed are synchronized according to the time offset.

[0092] In order to ensure the accuracy of video synchronization, in this embodiment, the synchronization error is calculated to determine the optimization effect of synchronization. Specifically, the synchronization error is calculated based on the corrected reference i-frame timestamp and the i-frame timestamp to be processed. The calculation formula is as follows:

[0093] E =1 / N ∣ You , n ′− That is , n ′∣

[0094] Among them, E represents the synchronization error, and N represents the number of video streams.

[0095] Next, the synchronization error E is compared with a preset threshold. If the synchronization error E is less than the preset threshold, it means that the error is not large, and the optimization effect meets expectations, then the non-i frames in the processed video stream can be synchronized according to the time offset.

[0096] As a further optional embodiment, the step of synchronizing the non-i frames in the to-be-processed video stream according to the time offset specifically includes:

[0097] Determining a frame rate delay according to the time offset;

[0098] Non-i frames in the video stream to be processed are synchronized according to the frame rate delay.

[0099] In this embodiment, it is necessary to determine the frame rate delay according to the time offset, so as to adjust the frame rate of the video stream to be processed.

[0100] As a further optional embodiment, the specific manner of determining the frame rate delay according to the time offset is as follows:

[0101] Δ F = Fi +Δ Thi ×(1− Fi )

[0102] Among them, Δ F is the frame rate delay, Fi is the frame rate of the video stream to be processed, Δ Thi is the time offset.

[0103] In this embodiment, the frame rate delay can be determined by the following formula:

[0104] Δ F = Fi +Δ Thi ×(1− Fi )

[0105] Among them, Δ F is the frame rate delay, Fi is the frame rate of the video stream to be processed, Δ Thi is the time offset.

[0106] After determining the frame rate delay, the frame rate of the video stream to be processed can be synchronized. Specifically:

[0107] Fi , new = Fi , old ±Δ F

[0108] in, Fi , new is the frame rate after synchronization, Fi , old is the frame rate before synchronization, Δ F is the frame rate delay.

[0109] Based on the above embodiments, the present invention has the following beneficial effects:

[0110] 1. Ensure the consistency and integrity of recorded content by accurately synchronizing multiple video sources, which is particularly suitable for multi-angle shooting and remote monitoring scenarios, improving the usability and viewing experience of recorded content

[0111] 2. Accurate timestamp extraction and correction can eliminate system delays and external interference, ensuring the synchronization accuracy of video streams, which is crucial for subsequent video editing, analysis and playback.

[0112] 3. By accurately identifying and marking i-frames, the algorithm can establish a stable synchronization reference, thereby reducing synchronization errors and improving system stability and reliability.

[0113] 4. Accurate calculation of time offset helps to fine-tune the video stream and achieve precise synchronization between different video sources, which is of great significance for real-time monitoring and event backtracking.

[0114] 5. Using interpolation technology to synchronize non-i frames can reduce the jumping and stuttering caused by frame rate differences and ensure the smoothness of video playback.

[0115] 6. By evaluating the synchronization error and optimizing it, the synchronization performance of the system can be significantly improved, the synchronization deviation can be reduced, and the accuracy and consistency of long-term recording can be ensured.

[0116] 7. Existing technologies may rely on simple timestamp matching or hardware synchronization, which may lead to slight synchronization differences in multi-source video streams. The present invention provides a more accurate synchronization mechanism by accurately identifying and aligning i-frames, ensuring high consistency between video streams.

[0117] 8. In multi-channel video synchronization, network delay, hardware differences and coding inconsistency may all lead to synchronization errors. The algorithm of the present invention can automatically correct synchronization deviations through adaptive adjustment and stability monitoring, thereby improving the fault tolerance of the system.

[0118] 9. Compared with the traditional synchronization method, the algorithm of the present invention reduces the delay in the synchronization process and improves the real-time performance of the video stream through inter-frame interpolation technology and real-time error evaluation. It is particularly suitable for real-time monitoring and remote interaction scenarios.

[0119] 10. The algorithm of the present invention optimizes the synchronization process of video streams, reduces unnecessary data processing and storage overhead, improves the utilization efficiency of system resources, and reduces the cost of system operation.

[0120] The following is a description of the synchronization device for multi-source recorded video streams provided by the present invention. Figure 2 As shown, the synchronization device for multi-source recorded video streams described below and the synchronization method for multi-source recorded video streams described above can correspond to each other.

[0121] A synchronization device for multi-source recorded video streams, comprising:

[0122] The video acquisition module 210 is used to acquire a reference video stream and a video stream to be processed;

[0123] A timestamp extraction module 220 is used to extract the i-frame timestamps of the reference video stream and the video stream to be processed respectively, to obtain the reference i-frame timestamp and the i-frame timestamp to be processed;

[0124] A timestamp correction module 230, configured to correct the reference i-frame timestamp and the to-be-processed i-frame timestamp;

[0125] A time offset module 240, configured to determine a time offset according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed;

[0126] The video synchronization module 250 is used to synchronize the non-i frames in the to-be-processed video stream according to the time offset, the corrected reference i-frame timestamp and the to-be-processed i-frame timestamp.

[0127] Figure 3 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 3As shown, the electronic device may include: a processor 310, a communications interface 320, a memory 330 and a communication bus 340, wherein the processor 310, the communications interface 320 and the memory 330 communicate with each other through the communication bus 340. The processor 310 may call the logic instructions in the memory 330 to execute the synchronization method of multi-source recorded video streams, and the method includes:

[0128] Obtain the baseline video stream and the video stream to be processed;

[0129] Extracting the i-frame timestamps of the reference video stream and the video stream to be processed respectively, to obtain the reference i-frame timestamp and the i-frame timestamp to be processed;

[0130] Correcting the reference i-frame timestamp and the to-be-processed i-frame timestamp;

[0131] Determine a time offset according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed;

[0132] The non-i frames in the video stream to be processed are synchronized according to the time offset, the corrected reference i-frame timestamp and the i-frame timestamp to be processed.

[0133] In addition, the logic instructions in the above-mentioned memory 330 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0134] On the other hand, the present invention further provides a computer program product, the computer program product comprising a computer program, the computer program can be stored in a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the synchronization method of multi-source recorded video streams provided by the above methods, the method comprising:

[0135] Obtain the baseline video stream and the video stream to be processed;

[0136] Extracting the i-frame timestamps of the reference video stream and the video stream to be processed respectively, to obtain the reference i-frame timestamp and the i-frame timestamp to be processed;

[0137] Correcting the reference i-frame timestamp and the to-be-processed i-frame timestamp;

[0138] Determine a time offset according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed;

[0139] The non-i frames in the video stream to be processed are synchronized according to the time offset, the corrected reference i-frame timestamp and the i-frame timestamp to be processed.

[0140] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the method for synchronizing multi-source recorded video streams provided by the above methods is implemented, the method comprising:

[0141] Obtain the baseline video stream and the video stream to be processed;

[0142] Extracting the i-frame timestamps of the reference video stream and the video stream to be processed respectively, to obtain the reference i-frame timestamp and the i-frame timestamp to be processed;

[0143] Correcting the reference i-frame timestamp and the to-be-processed i-frame timestamp;

[0144] Determine a time offset according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed;

[0145] The non-i frames in the video stream to be processed are synchronized according to the time offset, the corrected reference i-frame timestamp and the i-frame timestamp to be processed.

[0146] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0147] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0148] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for synchronizing multi-source recorded video streams, characterized in that: include: Obtain the baseline video stream and the video stream to be processed; Extracting the i-frame timestamps of the reference video stream and the video stream to be processed respectively, to obtain the reference i-frame timestamp and the i-frame timestamp to be processed; Correcting the reference i-frame timestamp and the to-be-processed i-frame timestamp; Determine a time offset according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed; The non-i frames in the video stream to be processed are synchronized according to the time offset, the corrected reference i-frame timestamp and the i-frame timestamp to be processed.

2. The method for synchronizing multi-source recorded video streams according to claim 1, characterized in that: The step of respectively extracting the i-frame timestamps of the reference video stream and the to-be-processed video stream to obtain the reference i-frame timestamp and the to-be-processed i-frame timestamp specifically includes: Determine a reference GOP length according to the number of frames in the GOP and the i-frame interval of the reference video stream; Determine the length of the GOP to be processed according to the number of frames in the GOP of the video stream to be processed and the i-frame interval; Extracting the reference i-frame timestamp from the reference video stream according to the reference GOP length; The i-frame timestamp to be processed is extracted from the video stream to be processed according to the length of the GOP to be processed.

3. The method for synchronizing multi-source recorded video streams according to claim 2, characterized in that: The step of correcting the reference i-frame timestamp and the i-frame timestamp to be processed specifically includes: Get system delay; The reference i-frame timestamp and the to-be-processed i-frame timestamp are corrected according to the system delay.

4. The method for synchronizing multi-source recorded video streams according to claim 3, characterized in that: The specific method of determining the time offset according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed is as follows: D Tij = Ti , n ′− Tj , n ′ Among them, Δ Tij is the time offset, Ti , n ′ is the timestamp of the nth reference i frame of the corrected reference video stream, Tj , n ′ is the timestamp of the nth i-th frame to be processed in the video stream to be processed after correction.

5. The method for synchronizing multi-source recorded video streams according to claim 4, characterized in that: The step of synchronizing the non-i frames in the to-be-processed video stream according to the time offset, the corrected reference i-frame timestamp, and the to-be-processed i-frame timestamp specifically includes: Determine the synchronization error according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed; When the synchronization error is less than a preset threshold, the non-i frames in the video stream to be processed are synchronized according to the time offset.

6. The method for synchronizing multi-source recorded video streams according to claim 5, characterized in that: The step of synchronizing the non-i frames in the video stream to be processed according to the time offset specifically includes: Determining a frame rate delay according to the time offset; Non-i frames in the video stream to be processed are synchronized according to the frame rate delay.

7. The method for synchronizing multi-source recorded video streams according to claim 6, characterized in that: The specific method of determining the frame rate delay according to the time offset is as follows: D F = Fi +D Tij ×(1− Fi ) Among them, Δ F is the frame rate delay, Fi is the frame rate of the video stream to be processed, Δ Tij is the time offset.

8. A synchronization device for multi-source recorded video streams, characterized in that: include: A video acquisition module, used to acquire a reference video stream and a video stream to be processed; A timestamp extraction module, used to extract the i-frame timestamps of the reference video stream and the to-be-processed video stream respectively, to obtain the reference i-frame timestamp and the to-be-processed i-frame timestamp; A timestamp correction module, used for correcting the reference i-frame timestamp and the i-frame timestamp to be processed; A time offset module, used to determine a time offset according to the corrected reference i-frame timestamp and the i-frame timestamp to be processed; The video synchronization module is used to synchronize the non-i frames in the video stream to be processed according to the time offset, the corrected reference i frame timestamp and the i frame timestamp to be processed.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the method for synchronizing multi-source recorded video streams as described in any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for synchronizing multi-source recorded video streams as described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Method and device for synchronizing I frame

    CN102510494A

  • Video stream synchronization

    CN107079193A