CN-116233344-B - Audio and video recording method and related equipment
Abstract
The application discloses an audio and video recording method, an audio and video recording device, electronic equipment and a computer readable storage medium, wherein the method comprises the steps of determining corresponding segmentation conditions in a segmentation recording mode and initializing a first audio and video mixer; the method comprises the steps of obtaining first audio and video data by using a first audio and video mixer to execute audio and video mixing operation, storing the first audio and video data as a first audio and video file when a real-time recording condition meets a segmentation condition, initializing a second audio and video mixer, obtaining second audio and video data by using the second audio and video mixer to execute audio and video mixing operation, storing the second audio and video data as a second audio and video file when the real-time recording condition meets the segmentation condition, initializing the first audio and video mixer, and returning to the step of obtaining the first audio and video data by using the first audio and video mixer to execute audio and video mixing operation. By applying the technical scheme provided by the application, the problem of frame loss in the audio/video segmented recording process can be effectively solved, and the user experience is further ensured.
Inventors
- ZHANG GONGWEI
Assignees
- 西安广和通无线通信有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20230315
Claims (8)
- 1. An audio/video recording method, comprising: when the recording mode is a segmented recording mode, determining a segmentation condition corresponding to the segmented recording mode, and initializing a first audio-video mixer; generating first audio-video data by utilizing the first audio-video mixer to record audio data of an audio thread and video data of a video thread; When the real-time recording condition meets the segmentation condition, storing the first audio and video data as a first audio and video file, and initializing a second audio and video mixer; Generating second audio-video data by utilizing the second audio-video mixer to record the audio data of the audio thread and the video data of the video thread; When the real-time recording condition meets the segmentation condition, storing the second audio and video data as a second audio and video file, and initializing a first audio and video mixer; returning to the step of generating first audio-video data by using the first audio-video mixer to record the audio data of the audio thread and the video data of the video thread; Before the first audio/video data is stored as the first audio/video file, the method further comprises the step of controlling the audio thread and the video thread to stop recording; Correspondingly, before the audio data recorded by the audio thread and the video data recorded by the video thread are generated into second audio-video data by using the second audio-video mixer, the method further comprises the steps of controlling the audio thread and the video thread to start recording; The controlling the audio thread and the video thread to stop recording comprises the steps of issuing a stop instruction to the audio thread and the video thread so that the audio thread stops recording and sets a stop zone bit, and stopping recording when the video thread monitors the stop zone bit in the audio thread.
- 2. The audio-video recording method according to claim 1, wherein after the controlling the audio thread and the video thread to stop recording, further comprising: And controlling the first audio-video mixer to stop running.
- 3. The audio-video recording method according to claim 1, wherein after said storing the first audio-video data as the first audio-video file, further comprising: and releasing the resources of the first audio-video mixer.
- 4. A method of recording audio and video according to any one of claims 1 to 3, further comprising: Controlling the audio thread to set key audio frame marks for the first frame of audio in the audio data; And controlling the video thread to set an important video frame mark for a first frame of video in the video data.
- 5. The audio/video recording method according to claim 1, wherein the segmentation condition is a segmentation condition of a preset recording duration, or a segmentation condition of a preset file size, or a segmentation condition of a preset file length.
- 6. An audio/video recording apparatus, comprising: The first initializing module is used for determining a segmentation condition corresponding to the segmentation recording mode when the recording mode is the segmentation recording mode and initializing a first audio-video mixer; the first recording generation module is used for generating first audio-video data by utilizing the first audio-video mixer to record the audio data of the audio thread and the video data of the video thread; The second initialization module is used for storing the first audio and video data into a first audio and video file and initializing a second audio and video mixer when the real-time recording condition meets the segmentation condition; the second record generating module is used for generating second audio and video data by utilizing the second audio and video mixer to record the audio data of the audio thread and the video data of the video thread; the third initialization module is used for storing the second audio and video data into a second audio and video file and initializing the first audio and video mixer when the real-time recording condition meets the segmentation condition; The circulation module is used for returning to the step of generating first audio-video data by utilizing the first audio-video mixer to record the audio data of the audio thread and the video data of the video thread; The first control module is used for controlling the audio thread and the video thread to stop recording before the first audio-video data is saved as a first audio-video file, and controlling the audio thread and the video thread to start recording before the audio data recorded by the audio thread and the video data recorded by the video thread are generated into second audio-video data by using the second audio-video mixer; The first control module is specifically configured to issue a stop instruction to the audio thread and the video thread, so that the audio thread stops recording and sets a stop flag bit, and the video thread stops recording when the stop flag bit in the audio thread is monitored.
- 7. An electronic device, comprising: A memory for storing a computer program; A processor for implementing the steps of the audio video recording method according to any one of claims 1 to 5 when executing said computer program.
- 8. A computer readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the audio video recording method according to any of claims 1 to 5.
Description
Audio and video recording method and related equipment Technical Field The present application relates to the field of multimedia technologies, and in particular, to an audio/video recording method, an audio/video recording apparatus, an electronic device, and a computer readable storage medium. Background With the rapid development of multimedia technology, the application of audio and video recording is also more and more widespread, for example, the method can be applied to monitoring scenes such as judicial, education, medical treatment and the like. Because recorded audio and video is generally used as a backup record and may be downloaded and watched by a plurality of users, the recording effect of the audio and video becomes the most important requirement in the technical field of audio and video recording and broadcasting. However, the conventional audio and video synchronous loop segment recording scheme still has the problem of frame loss, which causes poor user experience. Therefore, how to effectively solve the problem of frame loss in the audio/video segment recording process is a problem to be solved by those skilled in the art. Disclosure of Invention The application aims to provide an audio and video recording method which can effectively solve the problem of frame loss in the audio and video segmented recording process so as to ensure user experience, and the other aim of the application is to provide an audio and video recording device, electronic equipment and a computer readable storage medium which all have the beneficial effects. In a first aspect, the present application provides an audio/video recording method, including: when the recording mode is a segmented recording mode, determining a segmentation condition corresponding to the segmented recording mode, and initializing a first audio-video mixer; generating first audio-video data by utilizing the first audio-video mixer to record audio data of an audio thread and video data of a video thread; When the real-time recording condition meets the segmentation condition, storing the first audio and video data as a first audio and video file, and initializing a second audio and video mixer; Generating second audio-video data by utilizing the second audio-video mixer to record the audio data of the audio thread and the video data of the video thread; When the real-time recording condition meets the segmentation condition, storing the second audio and video data as a second audio and video file, and initializing a first audio and video mixer; And returning to the step of generating first audio-video data by using the first audio-video mixer to record the audio data recorded by the audio thread and the video data recorded by the video thread. Optionally, before the storing the first audio/video data as the first audio/video file, the method further includes: Controlling the audio thread and the video thread to stop recording; Correspondingly, before the audio data recorded by the audio thread and the video data recorded by the video thread are generated by using the second audio-video mixer, the method further comprises: and controlling the audio thread and the video thread to start recording. Optionally, the controlling the audio thread and the video thread to stop recording includes: and issuing a stop instruction to the audio thread and the video thread so as to enable the audio thread to stop recording and set a stop zone bit, and enabling the video thread to stop recording when the stop zone bit in the audio thread is monitored. Optionally, after the controlling the audio thread and the video thread to stop recording, the method further includes: And controlling the first audio-video mixer to stop running. Optionally, after the storing the first audio/video data as the first audio/video file, the method further includes: and releasing the resources of the first audio-video mixer. Optionally, the audio-video recording method further includes: Controlling the audio thread to set key audio frame marks for the first frame of audio in the audio data; And controlling the video thread to set an important video frame mark for a first frame of video in the video data. Optionally, the segmentation condition is a segmentation condition of a preset recording duration, or a segmentation condition of a preset file size, or a segmentation condition of a preset file length. In a second aspect, the present application also discloses an audio/video recording device, including: The first initializing module is used for determining a segmentation condition corresponding to the segmentation recording mode when the recording mode is the segmentation recording mode and initializing a first audio-video mixer; the first recording generation module is used for generating first audio-video data by utilizing the first audio-video mixer to record the audio data of the audio thread and the video data of the video thread; The second initialization module is used fo