Code stream data recording method, electronic device and storage medium

By obtaining the time interval of video and audio synchronization of the conference scene in a multi-person meeting, the code stream data is recorded, and the lip sound is out of synchronization caused by frequent switching of the conference scenes is solved, achieving lip sound synchronization and a better recording experience.

CN115499418BActive Publication Date: 2025-03-25SUZHOU KEDA TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211148976.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-21
Publication Date
2025-03-25
Estimated Expiration
2042-09-21

AI Technical Summary

Technical Problem

In multi-person meetings, common online meetings have frequent switching of meeting scenes, resulting in the problem of lip sound being out of sync for videos recorded by the terminal, which affects the viewing and recording experience.

Method used

By obtaining the video synchronization time interval and audio synchronization time interval of the current conference scene, the video code stream and audio code stream to be recorded are recorded respectively, ensuring that the audio and video data recorded in the same time interval corresponds to the actual meeting and realize lip synchronization.

Benefits of technology

This method can automatically adapt to frequent switching of conference scenes, ensure that the recorded stream data lip sound is synchronized, and improve the viewing experience of video.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115499418B_ABST
    Figure CN115499418B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of data recording technology, and specifically to a method for recording code stream data, an electronic device, and a storage medium. The method includes obtaining a video synchronization time interval corresponding to a current conference scene, the video synchronization time interval being determined based on the video frame rate of a target recording file in the current conference scene; obtaining a code stream to be recorded in the current conference scene, the code stream to be recorded including a video code stream to be recorded and an audio code stream to be recorded; parsing the frame header information of the audio code stream to be recorded to determine the frame duration of the audio code stream to determine the audio synchronization time interval; under the same recording start timestamp, recording the video code stream to be recorded based on the video synchronization time interval and recording the audio code stream to be recorded based on the audio synchronization time interval to determine the target recording file. The method can automatically adapt to the frequent switching of conference scenes, thereby realizing the lip synchronization of the recorded code stream data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data recording, and in particular to a method for recording code stream data, an electronic device and a storage medium. Background Art

[0002] With the popularity of multi-person video activities such as online classes and remote conferences, the need for local terminal recording in multi-person conferences is becoming more and more common. For common online conferences, there are often factors such as frequent switching of conference scenes during multi-person conferences. Unprocessed recording will cause abnormal problems such as lip sync in the video recorded by the terminal, making the viewing experience very poor. Summary of the invention

[0003] In view of this, an embodiment of the present invention provides a method for recording bitstream data, an electronic device, and a storage medium to solve the problem of lip-synch in recorded video.

[0004] According to a first aspect, an embodiment of the present invention provides a method for recording bitstream data, comprising:

[0005] Obtaining a video synchronization time interval corresponding to a current conference scene, where the video synchronization time interval is determined based on a video frame rate of a target recording file in the current conference scene;

[0006] Obtaining the code stream to be recorded in the current conference scenario, wherein the code stream to be recorded includes the video code stream to be recorded and the audio code stream to be recorded;

[0007] Parsing the frame header information of the audio code stream to be recorded to determine the frame length of the audio code stream, so as to determine the audio synchronization time interval;

[0008] At the same recording start timestamp, the video stream to be recorded is recorded based on the video synchronization time interval and the audio stream to be recorded is recorded based on the audio synchronization time interval to determine the target recording file.

[0009] The method for recording bitstream data provided by the embodiment of the present invention utilizes the video frame rate of the target recording file and the frame duration of the audio bitstream to be recorded, respectively, to flexibly synchronize and control the recording duration of the audio and video, so that the audio and video data recorded within the same time interval corresponds to the actual meeting. At the same time, since the video synchronization time interval and the audio synchronization time interval are both determined under the current meeting scene, the audio and video time intervals corresponding to different meeting scenes are different, so that the method can automatically adapt to the frequent switching of meeting scenes, thereby realizing the lip synchronization of the recorded bitstream data.

[0010] In some implementations, recording the to-be-recorded video stream based on the video synchronization time interval includes:

[0011] Starting from the recording start timestamp, obtaining the video frames to be recorded within the video synchronization time interval;

[0012] Determine the number of video frames within the video synchronization time interval using the timestamp of the video frame to be recorded;

[0013] Based on the number of video frames in the video synchronization time interval, the recorded video frames in the video synchronization time interval are determined, and the number of the recorded video frames is 1.

[0014] In the method for recording bitstream data provided by an embodiment of the present invention, a video synchronization time interval is used to represent the duration of a recorded video frame of a target recording file finally generated. The video synchronization time interval is used to process the acquired video frames to be recorded within the video synchronization time interval, so that there is only one recorded video frame within the video synchronization time interval, thereby being able to adapt to fluctuations in video data and solving the problem of lip-sound asynchrony caused by frame loss or delay of each frame of data.

[0015] In some implementations, determining the recorded video frames within the video synchronization time interval based on the number of video frames within the video synchronization time interval includes:

[0016] When the number of video frames is equal to 1, determining the to-be-recorded video frame as the recorded video frame;

[0017] When the number of video frames is greater than , determining the video frame with the earliest timestamp among the video frames to be recorded as the recording video frame;

[0018] When the number of video frames is less than 1, the recorded video frames in the current video synchronization time interval are determined based on the historical recorded video frames in the previous video synchronization time interval.

[0019] The method for recording bitstream data provided by the embodiment of the present invention is that since the start time of recording corresponding to the current video synchronization time interval is the end time of the previous video synchronization time interval, that is, the time is continuous and uninterrupted as a whole, therefore, when the number of video frames to be recorded within the video synchronization time interval is large, the video frame with the earliest timestamp is taken as the recording video frame, which can ensure the continuity of the recorded video.

[0020] In some implementations, determining the recorded video frames within the video synchronization time interval based on the historical recorded video frames of the previous video synchronization time interval includes:

[0021] When the historical recorded video frame exists, determining the historical recorded video frame as the recorded video frame;

[0022] When the historical recorded video frame does not exist, a preset picture is determined as the recorded video frame.

[0023] The method for recording bitstream data provided by the embodiment of the present invention uses preset pictures to fill in the missing historical recorded video frames, so as to ensure that there are recorded video frames in each video synchronization time interval.

[0024] In some implementations, recording the to-be-recorded audio stream based on the audio synchronization time interval includes:

[0025] Starting from the recording start timestamp, obtaining the audio frames to be recorded within the audio synchronization time interval;

[0026] Determine the actual duration of all the audio frames to be recorded within the audio synchronization time interval by using the timestamp of the audio frames to be recorded;

[0027] Based on the relationship between the actual duration of all the audio frames to be recorded and the audio synchronization time interval, the recorded audio frames within the audio synchronization time interval are determined, and the duration of the recorded audio frames is equal to the audio synchronization time interval.

[0028] In the method for recording bitstream data provided by the embodiment of the present invention, since the frame duration represents the duration of the audio frame, the audio frames to be recorded are processed by utilizing the relationship between the actual durations of all audio frames to be recorded and the audio synchronization time interval, so as to obtain the recorded audio frames within the audio synchronization time interval, so as to avoid the lip-sync problem caused by audio frame delay or frame loss.

[0029] In some implementations, determining the recorded audio frames within the audio synchronization time interval based on the relationship between the actual durations of all the to-be-recorded audio frames and the audio synchronization time interval includes:

[0030] When the actual duration is equal to the audio synchronization time interval, determining the to-be-recorded audio frame as a recorded audio frame within the audio synchronization time interval;

[0031] When the actual duration is greater than the audio synchronization time interval, processing the to-be-recorded audio frame to align with the audio synchronization time interval to obtain the recorded audio frame;

[0032] When the actual duration is less than the audio synchronization time interval, the audio frame to be recorded is processed to supplement the audio synchronization time interval to obtain the recorded audio frame, or the audio frame to be recorded is discarded and a silent frame is determined as the recorded audio frame.

[0033] The method for recording bitstream data provided by the embodiment of the present invention processes the audio frames to be recorded to ensure that the duration of the processed audio frames to be recorded is consistent with the audio synchronization time interval when the actual duration is inconsistent with the audio synchronization time interval.

[0034] In some implementations, recording the video stream to be recorded based on the video synchronization time interval and recording the audio stream to be recorded based on the audio synchronization time interval at the same recording start timestamp to determine the target recording file includes:

[0035] Create a temporary file;

[0036] Writing the video code stream to be recorded and the audio code stream to be recorded into the temporary file respectively;

[0037] When the recording is finished, the video code stream to be recorded in the temporary file and the audio code stream to be recorded in the temporary file are read frame by frame;

[0038] Under the same recording start timestamp, the read video stream to be recorded is recorded based on the video synchronization time interval and the read audio stream to be recorded is recorded based on the audio synchronization time interval to determine the target recording file.

[0039] The method for recording code stream data provided by the embodiment of the present invention first writes the code stream data into a temporary file, and then performs synchronous transcoding after the recording is completed, which can reduce the amount of data processing during the meeting and ensure the real-time nature of the meeting.

[0040] In some implementations, the step of parsing the frame header information of the audio code stream to be recorded to determine the frame duration of the audio code stream to determine the audio synchronization time interval includes:

[0041] When there are at least two audio channels in the current conference scene, the frame header information of each audio code stream to be recorded is parsed to determine the frame duration of each audio code stream;

[0042] The common multiple of the frame durations of the audio code streams is determined as the audio synchronization time interval.

[0043] The method for recording bitstream data provided by the embodiment of the present invention determines the audio synchronization time interval by using the common multiple of the frame durations of the various audio bitstreams, thereby ensuring that the audio time interval can meet the requirements of all audio channels, and further ensuring lip synchronization.

[0044] According to a second aspect, an embodiment of the present invention provides a device for recording bitstream data, characterized in that it includes:

[0045] A first acquisition module, used to acquire a video synchronization time interval corresponding to a current conference scene, where the video synchronization time interval is determined based on a video frame rate of a target recording file in the current conference scene;

[0046] A second acquisition module is used to acquire the code stream to be recorded in the current conference scene, where the code stream to be recorded includes the video code stream to be recorded and the audio code stream to be recorded;

[0047] A parsing module, used for parsing the frame header information of the audio code stream to be recorded to determine the frame duration of the audio code stream, so as to determine the audio synchronization time interval;

[0048] A recording module is used to record the video stream to be recorded based on the video synchronization time interval and to record the audio stream to be recorded based on the audio synchronization time interval under the same recording start timestamp to determine the target recording file.

[0049] According to the third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for recording bit stream data described in the first aspect or any one of the embodiments of the first aspect by executing the computer instructions.

[0050] According to a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the method for recording bitstream data described in the first aspect or any one of the embodiments of the first aspect.

[0051] It should be noted that, for the corresponding beneficial effects of the device for recording bitstream data, the electronic device, and the computer-readable storage medium provided in the embodiments of the present invention, please refer to the description of the corresponding beneficial effects of the method for recording bitstream data above, which will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0053] Figure 1 is a flowchart of a method for recording bitstream data according to an embodiment of the present invention;

[0054] Figure 2is a flowchart of a method for recording bitstream data according to an embodiment of the present invention;

[0055] Figure 3 is a flowchart of a method for recording bitstream data according to an embodiment of the present invention;

[0056] Figure 4 is a schematic diagram of a process of synchronous video transcoding according to an embodiment of the present invention;

[0057] Figure 5 is a schematic diagram of a process of audio synchronous transcoding according to an embodiment of the present invention;

[0058] Figure 6 is a structural block diagram of a device for recording bitstream data according to an embodiment of the present invention;

[0059] Figure 7 It is a schematic diagram of the hardware structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments 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 those skilled in the art without creative work are within the scope of protection of the present invention.

[0061] The method for recording bitstream data provided by the embodiment of the present invention records the video bitstream to be recorded and the audio bitstream to be recorded in the bitstream to be recorded at the video synchronization time interval and the audio synchronization time interval respectively, that is, the audio and video are recorded respectively using their respective corresponding synchronization strategies, thereby avoiding the problem of lip-sound asynchrony caused by switching of conference scenes.

[0062] Furthermore, before starting recording, it is also necessary to determine the data source and recording time of the code stream to be recorded. The data source is used to indicate the source of the code stream to be recorded. When recording the code stream locally with an electronic device, there are two types of code streams to be recorded, namely, locally collected and received from a remote end. For data collected locally, the recording time is consistent with the collection time; for data received from a remote end, the recording time is consistent with the playback time. While recording the code stream data, the recording time and current conference scene information are recorded, and at the same time, all code streams are recorded frame by frame at the same entrance, so that the recorded data is sorted by time. The current conference scene information includes the current conference mode, the total number of audio channels, the total number of video channels, the video display channel position information, etc.

[0063] When recording starts, that is, after the user clicks to start recording, the timestamp of the first frame of recorded data is the start time. This frame of data may be audio or video, and this timestamp is the start time of all code streams.

[0064] During the recording process, the video to be recorded is recorded based on the video synchronization time interval to obtain the recorded video frame corresponding to each video synchronization time interval; the audio to be recorded is recorded based on the audio synchronization time interval to obtain the recorded audio frame corresponding to each audio synchronization time interval. For the recorded video frames and recorded audio frames, the target recording file can be directly recorded and generated during the recording process, or written into a temporary file first, and then synchronously transcoded to obtain the target recording file after the recording is completed.

[0065] According to an embodiment of the present invention, an embodiment of a method for recording bitstream data is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0066] In this embodiment, a method for recording code stream data is provided, which can be used in electronic devices such as mobile terminals, conference equipment, etc. Figure 1 is a flow chart of a method for recording bitstream data according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:

[0067] S11, obtaining the video synchronization time interval corresponding to the current conference scene.

[0068] The video synchronization time interval is determined based on the video frame rate of the target recording file in the current conference scene.

[0069] The frame rate of the target recording file is determined before recording. For electronic devices, users can select the frame rate of the final target recording file, such as 30fps, 60fps, etc. Alternatively, the frame rate may not be selected by users, but may be determined by the properties of the electronic device itself, and a fixed value. There is no limitation on this, and it can be set according to actual needs.

[0070] The video frame rate is the number of frames per second. The inverse of the video frame rate means the duration of one frame. Based on this, the video synchronization time interval is determined to be the frame duration of the target recording file. That is, in the subsequent recording process, there is a recorded video frame every video synchronization time interval, so that the video stream to be recorded is recorded frame by frame and the duration of the recorded video frame corresponds to the video frame rate. For example, the video frame rate of the target recording file is 30 (s -1), video synchronization time interval dT1 = 1000 / 30 (ms).

[0071] Since the video synchronization time interval corresponds to the current conference scene, when the conference scene switches, the video synchronization time interval needs to be re-determined.

[0072] S12, obtaining the code stream to be recorded in the current conference scenario.

[0073] The code streams to be recorded include a video code stream to be recorded and an audio code stream to be recorded.

[0074] For electronic devices, the acquired code streams to be recorded are divided into video code streams to be recorded and audio code streams to be recorded. As mentioned above, there are two sources of code streams to be recorded: locally collected and received from a remote end. For electronic devices, the conference scenarios supported and the entrances to each code stream are all designed in advance, and this information is needed when recording. For example, entrance A of the electronic device is used to receive the locally collected code stream to be recorded, and entrance B is used to receive the code stream to be recorded received from a remote end. When the electronic device obtains the code stream to be recorded and obtains the entrance to the code stream to be recorded, it can determine the source of the code stream to be recorded, and accordingly, determine the recording time for the code stream to be recorded.

[0075] For example, in a video conference scenario, there are three participants, the local is participant 1, and the other participants are participant 2 and participant 3. Participant 1 corresponds to entry 1 of the electronic device, participant 2 corresponds to entry 2 of the electronic device, and participant 3 corresponds to entry 3 of the electronic device. During the meeting, for the local, when recording the content of the meeting, it is necessary not only to record the code stream data collected locally, but also to record the code stream data of other participants. As described above, the local uses the entry for obtaining the code stream to be recorded to determine the source of the code stream to be recorded, and accordingly, determines the recording time of the code stream to be recorded. If entry 1 obtains the code stream to be recorded, the recording time for the code stream to be recorded is the acquisition time of the code stream to be recorded; if entry 2 obtains the code stream to be recorded, the recording time for the code stream to be recorded is the local playback time of the code stream to be recorded.

[0076] S13, parsing the frame header information of the audio code stream to be recorded to determine the frame length of the audio code stream, so as to determine the audio synchronization time interval.

[0077] For the code stream to be recorded, its frame header information contains format information, and the duration of each frame of the audio code stream belongs to the format information. Based on this, the frame header information of the acquired audio code stream to be recorded is parsed to determine the frame duration of the audio code stream. After determining the frame duration of the audio code stream, the electronic device determines the audio synchronization time interval based on the number of audio code streams to be recorded in the current conference scene, thereby realizing frame-by-frame recording of the audio code stream to be recorded. When there is only one audio code stream to be recorded, the frame duration of the audio code stream to be recorded is determined as the audio synchronization time interval.

[0078] In some embodiments, the above S13 includes:

[0079] (1) When there are at least two audio channels in the current conference scene, the frame header information of each audio code stream to be recorded is parsed to determine the frame duration of each audio code stream.

[0080] (2) The common multiple of the frame durations of the various audio code streams is determined as the audio synchronization time interval.

[0081] For the audio data to be recorded, the audio synchronization time interval should be an integer multiple of the frame length of the audio code stream. When there are multiple audio channels, the audio synchronization time interval should be a common multiple of the duration of each audio code stream, and then a processing channel for each audio channel is established, and the mixing format is unified. Using the common multiple of the frame length of each audio code stream to determine the audio synchronization time interval can ensure that the audio time interval can meet the requirements of all audio channels, further ensuring lip synchronization.

[0082] S14, under the same recording start timestamp, recording the video stream to be recorded based on the video synchronization time interval and recording the audio stream to be recorded based on the audio synchronization time interval to determine the target recording file.

[0083] After the above preparation, the video synchronization time interval and the audio synchronization time interval are determined. Then, the recording of the stream to be recorded can be started, that is, at the same recording start timestamp, the video stream to be recorded is recorded using the video synchronization time interval, and the audio stream to be recorded is recorded using the audio synchronization time interval.

[0084] As mentioned above, the recording start timestamp is the timestamp of the first bitstream frame to be recorded, which may be an audio bitstream frame or a video bitstream frame. Recording audio and video at the same recording start timestamp ensures that the start time is the same.

[0085] When recording the video stream to be recorded, it is ensured that there is only one recorded video frame in the video synchronization time interval; when recording the audio stream to be recorded, it is ensured that the duration of the recorded audio frame in the audio synchronization time interval is consistent with the audio synchronization time interval. That is, different synchronization strategies are used for the video stream to be recorded and the audio stream to be recorded, but their start times are the same.

[0086] The method for recording bitstream data provided in this embodiment utilizes the video frame rate of the target recording file and the frame duration of the audio bitstream to be recorded, respectively, to flexibly synchronize and control the recording duration of the audio and video, so that the audio and video data recorded within the same time interval corresponds to the actual meeting. At the same time, since the video synchronization time interval and the audio synchronization time interval are both determined under the current meeting scenario, the audio and video time intervals corresponding to different meeting scenarios are different, so that the method can automatically adapt to the frequent switching of meeting scenarios, thereby realizing the lip synchronization of the recorded bitstream data.

[0087] In this embodiment, a method for recording code stream data is provided, which can be used in electronic devices such as mobile terminals, conference equipment, etc. Figure 2 is a flow chart of a method for recording bitstream data according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:

[0088] S21, obtaining the video synchronization time interval corresponding to the current conference scene.

[0089] The video synchronization time interval is determined based on the video frame rate of the target recording file in the current conference scene.

[0090] For details, please see Figure 1 S11 of the illustrated embodiment will not be described in detail here.

[0091] S22, obtaining the code stream to be recorded in the current conference scenario.

[0092] The code streams to be recorded include a video code stream to be recorded and an audio code stream to be recorded.

[0093] For details, please see Figure 1 S12 of the illustrated embodiment will not be described in detail here.

[0094] S23, parsing the frame header information of the audio code stream to be recorded to determine the frame length of the audio code stream, so as to determine the audio synchronization time interval.

[0095] For details, please see Figure 1 S13 of the illustrated embodiment will not be described in detail here.

[0096] S24, under the same recording start timestamp, recording the video stream to be recorded based on the video synchronization time interval and recording the audio stream to be recorded based on the audio synchronization time interval to determine the target recording file.

[0097] As described above, corresponding synchronization strategies are adopted for the video stream to be recorded and the audio stream to be recorded. For the recording of the video stream to be recorded, for each video stream to be recorded, starting from the recording start timestamp, the video stream to be recorded in the time period [T, T+dT1) is processed frame by frame; when the recording timestamp exceeds T+dT1, enter the next synchronization time period [T+dT1, T+2dT1). There needs to be a recorded video frame in the time period [T, T+dT1). Among them, dT1 is the video synchronization time interval, and T here is the start time of the current synchronization time period. Specifically, the recording of the video stream to be recorded based on the video synchronization time interval in the above S24 includes:

[0098] S241, starting from the recording start timestamp, obtaining the video frames to be recorded within the video synchronization time interval.

[0099] The time period of the current video synchronization processing is the time period [T, T+dT1), and the recording start timestamp is the timestamp of the first frame of the video to be recorded in the video stream to be recorded.

[0100] When recording the video code stream to be recorded, the electronic device obtains the video frames to be recorded in the time period [T, T+dT1), and the length of the time period is the video synchronization time interval.

[0101] S242, using the timestamp of the video frame to be recorded, determine the number of video frames within the video synchronization time interval.

[0102] All the video frames to be recorded in the time period [T, T+dT1) have corresponding timestamps. The timestamp of each video frame to be recorded in the time period [T, T+dT1) is used to determine the number of video frames to be recorded actually obtained in the time period [T, T+dT1).

[0103] As described above, according to the definition of the video synchronization time interval, there is only one recorded video frame in the video synchronization time interval. The actual number of frames determined here is the number of video frames to be recorded that are actually obtained in the video synchronization time interval.

[0104] S243: Determine the recorded video frames within the video synchronization time interval based on the number of video frames within the video synchronization time interval.

[0105] The number of recorded video frames is 1. According to the demand for recorded video frames within the video synchronization time interval, the actually acquired video frames to be recorded are processed to ensure that there is only one recorded video frame within the video synchronization time interval. Specifically, if the actual number of frames is 1, the video frame to be recorded is determined as the recorded video frame within the video synchronization time interval.

[0106] In some embodiments, the above S243 includes:

[0107] (1) When the number of video frames is equal to 1, the video frame to be recorded is determined as the recording video frame.

[0108] (2) When the number of video frames is greater than , the video frame with the earliest timestamp among the video frames to be recorded is determined as the recording video frame.

[0109] (3) When the number of video frames is less than 1, the recorded video frames in the current video synchronization time interval are determined based on the historical recorded video frames in the previous video synchronization time interval.

[0110] When the number of video frames to be recorded actually obtained within the video synchronization time interval is greater than 1, the video frame to be recorded with the earliest timestamp is queried based on the timestamps of the obtained video frames to be recorded, and is determined as the recorded video frame within the video synchronization time interval.

[0111] When the number of video frames is less than 1, the video frames recorded in the video synchronization time interval of the current video recording process are combined with the historical recorded video frames of the previous video synchronization time interval. For example, the time period of the current video recording process is [T, T+dT1), and correspondingly, the time period of the previous video synchronization recording process is [T-dT1, T). According to the above description, each video synchronization time interval corresponds to a recorded video frame. Based on this, the recording time frame in the current video synchronization time interval is determined in combination with the historical recorded video frames of the previous video synchronization time interval.

[0112] Since the start time of recording corresponding to the current video synchronization time interval is the end time of the previous video synchronization time interval, that is to say, the overall time is continuous and uninterrupted, therefore, when there are a large number of video frames to be recorded within the video synchronization time interval, the video frame with the earliest timestamp is taken as the recording video frame, which can ensure the continuity of the recorded video.

[0113] In some embodiments, step (3) of S243 above includes:

[0114] 2.1) When the historical recorded video frame exists, the historical recorded video frame is determined as the recorded video frame.

[0115] 2.2) When the historical recorded video frame does not exist, the preset picture is determined as the recorded video frame.

[0116] Whether the historical recorded video frame exists indicates whether the historical recorded video frame is determined from the historical video frame to be recorded. Specifically, if there is no video frame to be recorded in the time period [T, T+dT1), but there is a historical recorded video frame in the time period [T-dT1, T), then the historical recorded video frame is still used as the recorded video frame in the time period [T, T+dT1); if there is no video frame to be recorded in the time period [T, T+dT1), but there is no historical recorded video frame in the time period [T-dT1, T), then this bitstream is missing and can be replaced by a custom preset image, that is, the preset image is determined as the recorded video frame.

[0117] Further, after the recorded video frames in the time period [T, T+dT1) are determined, if it is necessary to synthesize multiple channels of video, screen synthesis is performed.

[0118] When historical recorded video frames do not exist, preset images are used to fill them out to ensure that there are recorded video frames in each video synchronization time interval.

[0119] As mentioned above, the video synchronization time interval is related to the current conference scene. Based on this, when the conference scene changes, or the number of video streams increases or decreases, the end time T+dT1 of the last time period [T, T+dT1) of the current conference scene is taken as the start recording time of the new conference scene, and the video synchronization time interval is re-determined, and the video stream to be recorded of the new conference scene continues to be recorded until the recording of the new conference scene is completed.

[0120] For each audio frame to be recorded, starting from the recording start timestamp, process the audio data to be recorded in the time period [T, T+dT2) frame by frame. When the recording timestamp exceeds T+dT2, enter the next synchronization time period [T+dT2, T+2*dT2). There must be enough audio recording frames in the time period [T, T+dT2), that is, the duration of all audio recording frames in each time period is the audio synchronization time interval. Among them, dT2 is the audio synchronization time interval, and T here is the start time of the current synchronization time period. The above S23 records the audio stream to be recorded based on the audio synchronization time interval, including:

[0121] S244, starting from the recording start timestamp, obtaining the audio frames to be recorded within the audio synchronization time interval.

[0122] The time period of the current audio synchronization processing is the [T, T+dT2) time period, and the recording start timestamp within the time period is the timestamp of the first audio frame to be recorded acquired within the time period.

[0123] When recording the audio code stream to be recorded, the electronic device obtains the audio frames to be recorded in the time period [T, T+dT2), and the length of the time period is the audio synchronization time interval.

[0124] S245: Determine the actual duration of all the audio frames to be recorded within the audio synchronization time interval by using the timestamp of the audio frame to be recorded.

[0125] To determine the actual duration, the audio frames to be recorded obtained within the time period [T, T+dT2) have corresponding timestamps, and the difference between the timestamps of the last audio frame to be recorded and the first audio frame to be recorded within the time period can be used to determine the actual duration of all audio frames to be recorded within the audio synchronization time interval.

[0126] It may also be that since the duration of each audio frame to be recorded is known fixed format information, the timestamp is used to determine the number of audio frames to be recorded in the time period [T, T+dT2), and then the actual duration of all audio frames to be recorded in the audio synchronization time interval can be obtained by multiplying the number by the duration of each frame.

[0127] S246: Determine the recorded audio frames within the audio synchronization time interval based on the relationship between the actual durations of all the audio frames to be recorded and the audio synchronization time interval.

[0128] Among them, the duration of the recorded audio frame is equal to the audio synchronization time interval. As mentioned above, in the time period [T, T+dT2), the requirement for recording audio frames is: the duration of all recorded audio frames is the audio synchronization time interval. Based on this, it is necessary to use the size relationship between the actual duration and the audio synchronization time interval determined in the above S246 to process the audio frames to be recorded obtained in this time period, so that the duration of the recorded audio frames obtained after processing is consistent with the audio synchronization time interval.

[0129] In some implementations, the above S246 includes:

[0130] (1) When the actual duration is equal to the audio synchronization time interval, the audio frame to be recorded is determined as the recorded audio frame within the audio synchronization time interval.

[0131] (2) When the actual duration is greater than the audio synchronization time interval, the audio frame to be recorded is processed to align the audio synchronization time interval to obtain the recorded audio frame.

[0132] (3) When the actual duration is less than the audio synchronization time interval, the audio frame to be recorded is processed to make up for the audio synchronization time interval to obtain a recorded audio frame, or the audio frame to be recorded is discarded and the silent frame is determined as the recorded audio frame.

[0133] Specifically, when the actual duration is equal to the audio synchronization time interval, it means that the acquired audio frames to be recorded are just sufficient frames, and all the audio frames to be recorded will be retained and determined as the recorded audio frames within the audio synchronization time interval.

[0134] When the actual duration is greater than the audio synchronization time interval, it indicates a superframe, and it is necessary to actively drop frames or use an audio acceleration algorithm to align the audio synchronization time interval to obtain an audio recording file. Among them, the processing method for the recorded audio frames is not limited to the active frame drop or audio acceleration algorithm described above, and other methods can also be used. The processing of the recorded audio frames may not be to process all the audio frames to be recorded, but to process part of the audio frames in the recorded audio frames, etc., which is specifically set according to actual needs.

[0135] When the actual duration is less than the audio synchronization time interval, it indicates a missing frame, and the audio frame to be recorded needs to be compensated for by an audio frame loss algorithm to make up the duration to obtain an audio recording file. Alternatively, a time interval threshold is set. If the audio synchronization time interval is greater than the time interval threshold, it indicates that the audio synchronization time interval is too large. In this case, when the actual duration is less than the audio synchronization time interval, the effect of the audio frame loss compensation method is not good. Therefore, a silent frame is directly used instead, that is, the acquired audio frame to be recorded is discarded, and the silent frame is determined as the recorded audio frame.

[0136] When the actual duration is inconsistent with the audio synchronization time interval, the audio frame to be recorded is processed to ensure that the duration of the processed audio frame to be recorded is consistent with the audio synchronization time interval.

[0137] Further, after the recorded audio frames in the time period [T, T+dT2) are determined, if it is necessary to synthesize multiple channels of audio, the multiple channels of recorded audio frames are mixed.

[0138] As mentioned above, the audio synchronization time interval is the same as the current conference scene. Based on this, when the conference scene is switched, or the audio code stream increases or decreases, the end time T+dT2 of the last time period [T, T+dT2) of the current conference scene is taken as the start recording time of the new conference scene, and the audio synchronization time interval is re-determined. The audio code stream to be recorded in the new conference scene is recorded until the recording of the new conference scene is completed.

[0139] When the recording ends, the last frame, whether it is audio or video, ends directly, and the data of the last time period of the synchronous recording of audio and video is processed.

[0140] In the method for recording bitstream data provided by the present embodiment, the video synchronization time interval is used to indicate the duration of a recorded video frame of the target recording file finally generated, and the acquired video frames to be recorded within the video synchronization time interval are processed using the video synchronization time interval, so that there is only one recorded video frame within the video synchronization time interval, thereby being able to adapt to the fluctuation of the video data, and to solve the problem of lip-sync asynchrony caused by reasons such as frame loss or delay of each frame of data. Since the frame duration indicates the duration of the audio frame, the actual duration of all the audio frames to be recorded and the size relationship of the audio synchronization time interval are used to process the audio frames to be recorded, and obtain the recorded audio frames within the audio synchronization time interval, so as to avoid the problem of lip-sync asynchrony caused by audio frame delay or frame loss.

[0141] In this embodiment, a method for recording code stream data is provided, which can be used in electronic devices such as mobile terminals, conference equipment, etc. Figure 3 is a flow chart of a method for recording bitstream data according to an embodiment of the present invention. Figure 3 As shown, the process includes the following steps:

[0142] S31, obtaining the video synchronization time interval corresponding to the current conference scene.

[0143] The video synchronization time interval is determined based on the video frame rate of the target recording file in the current conference scene.

[0144] For details, please see Figure 1 S11 of the illustrated embodiment will not be described in detail here.

[0145] S32, obtaining the code stream to be recorded in the current conference scenario.

[0146] The code streams to be recorded include a video code stream to be recorded and an audio code stream to be recorded.

[0147] For details, please see Figure 1 S12 of the illustrated embodiment will not be described in detail here.

[0148] S33, parsing the frame header information of the audio code stream to be recorded to determine the frame length of the audio code stream, so as to determine the audio synchronization time interval.

[0149] For details, please see Figure 1 S13 of the illustrated embodiment will not be described in detail here.

[0150] S34, under the same recording start timestamp, recording the video stream to be recorded based on the video synchronization time interval and recording the audio stream to be recorded based on the audio synchronization time interval to determine the target recording file.

[0151] When recording the bitstream data, the target recording file can be directly generated during recording; or the bitstream to be recorded can be first written into a temporary file, and then synchronously transcoded to generate the target recording file after the recording is completed. In this embodiment, taking writing into a temporary file as an example, the above S34 includes:

[0152] S341, create a temporary file.

[0153] When recording starts, a temporary file is created and information such as the audio and video format of the target recording file is written into the temporary file as a file header.

[0154] S342, writing the video stream to be recorded and the audio stream to be recorded into temporary files respectively.

[0155] For the locally collected stream to be recorded, the timestamp when the collected data is obtained is recorded as the recording timestamp, and it is saved to a temporary file before sending. For the remotely acquired stream to be recorded, since the delay of decoding and playback is stable, its statistical average value can be obtained, and the timestamp when the data is received plus the delay is directly used to get its recording timestamp, which can be directly saved to a temporary file when the stream data is received. Lock the interface for writing temporary files, write only one frame of stream data at a time, and record the current conference scene, synthetic picture style and other information in the frame header.

[0156] S343, when the recording is finished, the video stream to be recorded and the audio stream to be recorded in the temporary file are read frame by frame.

[0157] S344, under the same recording start timestamp, recording the read video stream to be recorded based on the video synchronization time interval and recording the read audio stream to be recorded based on the audio synchronization time interval to determine the target recording file.

[0158] When the recording ends, the temporary file is closed and the video code stream to be recorded and the audio code stream to be recorded in the temporary file are read for synchronous recording, which can also be called synchronous transcoding. Among them, when performing synchronous transcoding, the video code stream to be recorded in the temporary file is based on the video synchronization time interval, and the audio code stream to be recorded in the temporary file is based on the audio synchronization time interval. After transcoding the temporary file, the target recording file is obtained. It should be noted that the specific processing method of the above S344 is the same as Figure 2 S24 of the illustrated embodiment is similar and will not be described in detail here.

[0159] In some embodiments, Figure 4 As shown, the above steps of reading the recorded video frames in the temporary file frame by frame for synchronous transcoding include:

[0160] (1) Obtain the number of channels of the video code stream in the current conference scene.

[0161] (2) The video code stream to be recorded is read frame by frame, and the read video code stream to be recorded is decoded based on the video synchronization time interval to obtain the recorded video frames within the video synchronization time interval, so as to determine the channels of each video code stream for synthesizing the recorded video frames.

[0162] (3) Performing image synthesis on the recorded video frames determined for synthesis.

[0163] (4) Encode the result of the image synthesis and write it into the video channel of the target recording file.

[0164] After transcoding starts, first read the header information of the temporary file and create the target recording file in the required agreed format. Calculate the video synchronization time interval based on the target video frame rate, and based on the audio format supported by the electronic device, take the lowest common multiple of the single frame lengths of all formats as the audio synchronization time interval. Read the first frame of code stream data from the temporary file to determine the start time of the recording. For the video, start the decoding, screen synthesis, and encoding threads, read the video code stream to be recorded in the temporary file frame by frame, perform synchronous transcoding, and finally encode the result of the screen synthesis and write it into the video channel of the target recording file.

[0165] In some embodiments, Figure 5 As shown, the above steps of reading the audio code stream to be recorded frame by frame and performing synchronous transcoding to obtain recorded audio frames and determining the target recording file include:

[0166] (1) Get the number of audio code stream channels in the current conference scenario.

[0167] (2) The audio code stream to be recorded is read frame by frame, and the read audio code stream to be recorded is decoded based on the audio synchronization time interval to obtain the recorded audio frames in the channels of each audio code stream within the audio synchronization time interval.

[0168] (3) Mix the recorded audio frames in the channels of each audio code stream.

[0169] (4) Encode the mixing result and write it into the audio channel of the target recording file.

[0170] For audio, start the decoding, mixing, and encoding threads, read the audio code stream to be recorded in the temporary file frame by frame, perform synchronous transcoding, encode the mixing result, and write it into the audio channel of the target recording file.

[0171] For the specific process of recording the video stream to be recorded based on the video synchronization time interval and recording the audio stream to be recorded based on the audio synchronization time interval, please refer to the above Figure 2S24 of the illustrated embodiment will not be described in detail here.

[0172] After reading the last frame of data in the temporary file, notify the audio and video processing thread to synchronously end transcoding. After processing the data in the last synchronization time interval, close the target recording file.

[0173] The method for recording code stream data provided in this embodiment first writes the code stream data into a temporary file, and then performs synchronous transcoding after the recording is completed, which can reduce the amount of data processing during the meeting and ensure the real-time nature of the meeting.

[0174] As a specific application example of an embodiment of the present invention, it is applied to a video conference, and the acquired code stream to be recorded is directly recorded, and a target recording file is generated at the end of the conference. Before recording, it is necessary to first determine the recording timestamp, recording start timestamp, video synchronization time interval, audio synchronization time interval, etc. Then, based on the video synchronization time interval, the video code stream to be recorded is recorded, and the recorded video frames corresponding to the video synchronization time interval are obtained, and written into the target recording file; based on the audio synchronization time interval, the audio code stream to be recorded is recorded, and the recorded audio frames corresponding to the audio synchronization time interval are obtained, and written into the target recording file. Finally, at the end of the meeting, the target recording file is generated.

[0175] As another specific application example of an embodiment of the present invention, it is applied to a video conference, and the acquired code stream to be recorded is first written into a temporary file, and then synchronously transcoded to generate a target recording file after the conference is over. Before recording, it is necessary to first determine the recording timestamp, recording start timestamp, video synchronization time interval, audio synchronization time interval, etc. After the conference starts, the acquired code stream to be recorded is written into a temporary file. After the conference is over, the video code stream to be recorded and the audio code stream to be recorded in the temporary file are synchronously transcoded based on the video synchronization time interval and the audio synchronization time interval to obtain the target recording file.

[0176] The method for recording bitstream data provided in this embodiment can ensure lip synchronization even if the conference scene switches frequently and the network is unstable during a multi-person conference. Whether the target recording file is directly recorded in the conference or a temporary file is generated and then transcoded after the conference, lip synchronization can be achieved simply and effectively.

[0177] In this embodiment, a device for recording bitstream data is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made are omitted. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0178] This embodiment provides a device for recording bitstream data, such as Figure 6 As shown, including:

[0179] A first acquisition module 41 is used to acquire a video synchronization time interval corresponding to a current conference scene, where the video synchronization time interval is determined based on a video frame rate of a target recording file in the current conference scene;

[0180] The second acquisition module 42 is used to acquire the stream to be recorded in the current conference scene, where the stream to be recorded includes the video stream to be recorded and the audio stream to be recorded;

[0181] The parsing module 43 is used to parse the frame header information of the audio code stream to be recorded to determine the frame duration of the audio code stream, so as to determine the audio synchronization time interval;

[0182] The recording module 44 is used to record the video stream to be recorded based on the video synchronization time interval and to record the audio stream to be recorded based on the audio synchronization time interval under the same recording start timestamp to determine the target recording file.

[0183] In some implementations, the recording module 44 includes:

[0184] A first acquisition unit, configured to acquire the video frames to be recorded within the video synchronization time interval starting from the recording start timestamp;

[0185] A first determining unit, configured to determine the number of video frames within the video synchronization time interval by using the timestamp of the video frame to be recorded;

[0186] The second determining unit is used to determine the recorded video frames within the video synchronization time interval based on the number of video frames within the video synchronization time interval, and the number of recorded video frames is 1.

[0187] In some implementations, the second determining unit includes:

[0188] A first determining subunit, configured to determine the to-be-recorded video frame as the recorded video frame when the number of video frames is equal to 1;

[0189] A second determining subunit is configured to, when the number of video frames is greater than or equal to 1, determine the video frame with the earliest timestamp among the video frames to be recorded as the recording video frame;

[0190] The third determining subunit is configured to determine, when the number of video frames is less than 1, recorded video frames within the video synchronization time interval based on historical recorded video frames within a previous video synchronization time interval.

[0191] In some embodiments, the third determining subunit includes:

[0192] a fourth determining subunit, configured to determine the historical recorded video frame as the recorded video frame when the historical recorded video frame exists;

[0193] The fifth determining subunit is used to determine a preset picture as a recorded video frame when the historical recorded video frame does not exist.

[0194] In some implementations, the recording module 44 includes:

[0195] A second acquisition unit, configured to acquire the audio frames to be recorded within the audio synchronization time interval starting from the recording start timestamp;

[0196] A third determining unit, configured to determine the actual duration of all the audio frames to be recorded within the audio synchronization time interval by using the timestamp of the audio frame to be recorded;

[0197] The fourth determination unit is used to determine the recorded audio frames within the audio synchronization time interval based on the relationship between the actual durations of all the audio frames to be recorded and the audio synchronization time interval, and the duration of the recorded audio frames is equal to the audio synchronization time interval.

[0198] In some implementations, the fourth determining unit includes:

[0199] a sixth determining subunit, configured to determine the to-be-recorded audio frame as a recorded audio frame within the audio synchronization time interval when the actual duration is equal to the audio synchronization time interval;

[0200] a seventh determining subunit, configured to, when the actual duration is greater than the audio synchronization time interval, process the to-be-recorded audio frame to align the audio synchronization time interval to obtain the recorded audio frame;

[0201] An eighth determination subunit is used to process the audio frame to be recorded to supplement the audio synchronization time interval to obtain the recorded audio frame when the actual duration is less than the audio synchronization time interval, or to discard the audio frame to be recorded and determine the silent frame as the recorded audio frame.

[0202] In some implementations, the recording module 44 further includes:

[0203] Create a unit to create temporary files;

[0204] A writing unit, used for writing the video stream to be recorded and the audio stream to be recorded into the temporary file respectively;

[0205] A reading unit, used for reading the video code stream to be recorded and the audio code stream to be recorded in the temporary file frame by frame after the recording is finished;

[0206] The transcoding unit is used to record the read video stream to be recorded based on the video synchronization time interval and to record the read audio stream to be recorded based on the audio synchronization time interval under the same recording start timestamp to determine the target recording file.

[0207] In some embodiments, the parsing module 43 includes:

[0208] A parsing unit, configured to parse the frame header information of each audio stream to be recorded to determine the frame duration of each audio stream when there are at least two audio streams in the current conference scene;

[0209] The fifth determining unit is used to determine a common multiple of the frame durations of the audio code streams of each channel as the audio synchronization time interval.

[0210] The recording device for bitstream data in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC circuit, a processor and a memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.

[0211] The further functional description of each of the above modules is the same as that of the above corresponding embodiments and will not be repeated here.

[0212] The embodiment of the present invention also provides an electronic device having the above Figure 6 The recording device of the code stream data shown.

[0213] See also Figure 7 , Figure 7 is a schematic diagram of the structure of an electronic device provided by an optional embodiment of the present invention, such as Figure 7As shown, the electronic device may include: at least one processor 51, such as a CPU (Central Processing Unit), at least one communication interface 53, a memory 54, and at least one communication bus 52. The communication bus 52 is used to realize the connection and communication between these components. The communication interface 53 may include a display screen (Display) and a keyboard (Keyboard), and the optional communication interface 53 may also include a standard wired interface and a wireless interface. The memory 54 may be a high-speed RAM memory (Random Access Memory) or a non-volatile memory (non-volatile memory), such as at least one disk storage. The memory 54 may optionally be at least one storage device located away from the aforementioned processor 51. The processor 51 may be combined with Figure 6 In the described device, the memory 54 stores an application program, and the processor 51 calls the program code stored in the memory 54 to execute any of the above method steps.

[0214] The communication bus 52 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The communication bus 52 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 7 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0215] Among them, the memory 54 may include a volatile memory (English: volatile memory), such as a random access memory (English: random-access memory, abbreviated: RAM); the memory may also include a non-volatile memory (English: non-volatile memory), such as a flash memory (English: flash memory), a hard disk drive (English: hard disk drive, abbreviated: HDD) or a solid-state drive (English: solid-state drive, abbreviated: SSD); the memory 54 may also include a combination of the above types of memory.

[0216] The processor 51 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and a NP.

[0217] The processor 51 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0218] Optionally, the memory 54 is also used to store program instructions. The processor 51 can call the program instructions to implement the method for recording code stream data as shown in any embodiment of the present application.

[0219] The embodiment of the present invention further provides a non-transitory computer storage medium, wherein the computer storage medium stores computer executable instructions, and the computer executable instructions can execute the method for recording bitstream data in any of the above method embodiments. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk (HDD) or a solid-state drive (SSD), etc.; the storage medium may also include a combination of the above types of memories.

[0220] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.

Claims

1. A method for recording code stream data, characterized in that: include: Obtaining a video synchronization time interval corresponding to a current conference scene, where the video synchronization time interval is determined based on a video frame rate of a target recording file in the current conference scene; Obtaining the streams to be recorded in the current conference scenario, wherein the streams to be recorded include a video stream to be recorded and an audio stream to be recorded; Parsing the frame header information of the audio code stream to be recorded to determine the frame length of the audio code stream, so as to determine the audio synchronization time interval; Under the same recording start timestamp, the video stream to be recorded is recorded based on the video synchronization time interval and the audio stream to be recorded is recorded based on the audio synchronization time interval to determine the target recording file; When recording the video stream to be recorded, there is only one recorded video frame within the video synchronization time interval; When recording the audio code stream to be recorded, the duration of the recorded audio frame within the audio synchronization time interval is consistent with the audio synchronization time interval.

2. The method according to claim 1, characterized in that The recording of the to-be-recorded video stream based on the video synchronization time interval includes: Starting from the recording start timestamp, obtaining the video frames to be recorded within the video synchronization time interval; Determine the number of video frames within the video synchronization time interval using the timestamp of the video frame to be recorded; Based on the number of video frames in the video synchronization time interval, the recorded video frames in the video synchronization time interval are determined, and the number of the recorded video frames is 1.

3. The method according to claim 2, characterized in that The determining, based on the number of video frames in the video synchronization time interval, the recorded video frames in the video synchronization time interval comprises: When the number of video frames is equal to 1, determining the to-be-recorded video frame as the recorded video frame; When the number of video frames is greater than 1, determining the video frame with the earliest timestamp among the video frames to be recorded as the recording video frame; When the number of video frames is less than 1, the recorded video frames in the current video synchronization time interval are determined based on the historical recorded video frames in the previous video synchronization time interval.

4. The method according to claim 3, characterized in that: The determining of the recorded video frames within the video synchronization time interval based on the historical recorded video frames of the previous video synchronization time interval includes: When the historical recorded video frame exists, determining the historical recorded video frame as the recorded video frame; When the historical recorded video frame does not exist, a preset picture is determined as the recorded video frame.

5. The method according to claim 1, characterized in that The recording of the audio code stream to be recorded based on the audio synchronization time interval includes: Starting from the recording start timestamp, obtaining the audio frames to be recorded within the audio synchronization time interval; Determine the actual duration of all the audio frames to be recorded within the audio synchronization time interval by using the timestamp of the audio frames to be recorded; Based on the relationship between the actual duration of all the audio frames to be recorded and the audio synchronization time interval, the recorded audio frames within the audio synchronization time interval are determined, and the duration of the recorded audio frames is equal to the audio synchronization time interval.

6. The method according to claim 5, characterized in that The determining the recorded audio frames within the audio synchronization time interval based on the relationship between the actual durations of all the to-be-recorded audio frames and the audio synchronization time interval includes: When the actual duration is equal to the audio synchronization time interval, determining the to-be-recorded audio frame as a recorded audio frame within the audio synchronization time interval; When the actual duration is greater than the audio synchronization time interval, processing the to-be-recorded audio frame to align with the audio synchronization time interval to obtain the recorded audio frame; When the actual duration is less than the audio synchronization time interval, the audio frame to be recorded is processed to supplement the audio synchronization time interval to obtain the recorded audio frame, or the audio frame to be recorded is discarded and a silent frame is determined as the recorded audio frame.

7. The method according to any one of claims 1 to 6, characterized in that The step of recording the video stream to be recorded based on the video synchronization time interval and recording the audio stream to be recorded based on the audio synchronization time interval under the same recording start timestamp to determine the target recording file includes: Create a temporary file; Writing the video code stream to be recorded and the audio code stream to be recorded into the temporary file respectively; When the recording is finished, the video code stream to be recorded in the temporary file and the audio code stream to be recorded in the temporary file are read frame by frame; Under the same recording start timestamp, the read video stream to be recorded is recorded based on the video synchronization time interval and the read audio stream to be recorded is recorded based on the audio synchronization time interval to determine the target recording file.

8. The method according to claim 1, characterized in that The step of parsing the frame header information of the audio code stream to be recorded to determine the frame duration of the audio code stream to determine the audio synchronization time interval includes: When there are at least two audio channels in the current conference scene, the frame header information of each audio code stream to be recorded is parsed to determine the frame duration of each audio code stream; The common multiple of the frame durations of the audio code streams is determined as the audio synchronization time interval.

9. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for recording bitstream data according to any one of claims 1 to 8 by executing the computer instructions.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method for recording bitstream data according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Audio and video synchronous processing device and method

    CN103167342A

  • Method for synchronizing labial sounds of spliced audios and videos of multimedia files

    CN111741376A