CN109600660B - Method and apparatus for recording video - Google Patents

Method and apparatus for recording video Download PDF

Info

Publication number
CN109600660B
CN109600660B CN201810865722.1A CN201810865722A CN109600660B CN 109600660 B CN109600660 B CN 109600660B CN 201810865722 A CN201810865722 A CN 201810865722A CN 109600660 B CN109600660 B CN 109600660B
Authority
CN
China
Prior art keywords
video
recording
data
video data
target audio
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810865722.1A
Other languages
Chinese (zh)
Other versions
CN109600660A (en
Inventor
周驿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Microlive Vision Technology Co Ltd
Original Assignee
Beijing Microlive Vision Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Microlive Vision Technology Co Ltd filed Critical Beijing Microlive Vision Technology Co Ltd
Priority to CN201810865722.1A priority Critical patent/CN109600660B/en
Publication of CN109600660A publication Critical patent/CN109600660A/en
Priority to BR112020024621-2A priority patent/BR112020024621A2/en
Priority to KR1020207035557A priority patent/KR102625410B1/en
Priority to JP2021504427A priority patent/JP7008870B2/en
Priority to PCT/CN2019/098460 priority patent/WO2020024950A1/en
Priority to EP19845332.6A priority patent/EP3833010A4/en
Application granted granted Critical
Publication of CN109600660B publication Critical patent/CN109600660B/en
Priority to US17/014,391 priority patent/US11114133B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4334Recording operations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/4302Content synchronisation processes, e.g. decoder synchronisation
    • H04N21/4307Synchronising the rendering of multiple content streams or additional data on devices, e.g. synchronisation of audio on a mobile phone with the video output on the TV screen
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/472End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content
    • H04N21/47217End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content for controlling playback functions for recorded or on-demand content, e.g. using progress bars, mode or play-point indicators or bookmarks

Abstract

The embodiment of the application discloses a method and a device for recording videos. One embodiment of the method comprises: in response to detecting a recording resuming instruction, determining the duration of the video encoded by the video encoder, and setting the playing progress of the audio player to the duration, wherein the recording resuming instruction is used for instructing to continue to acquire video data and continue to play target audio data by using the audio player; sequentially starting the video encoder and the audio player; and after the target audio data is played to the playing progress, responding to the collected video data, and transmitting the collected video data to the video encoder so that the video encoder encodes the collected video data. The implementation of the embodiment improves the effect of audio and video synchronization in the recording process of the dubbing music video.

Description

Method and apparatus for recording video
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a method and a device for recording videos.
Background
When recording the video of the score, the audio (score) is usually played while the video is captured by the camera. For example, a singing action performed by a user is recorded during the process of playing a certain song, and the recorded video takes the song as background music. In the application with the video recording function, the situation that the recorded dubbing music video is not synchronized with the audio and video is common.
When recording the dubbing music video in segments, the related method is usually to start the video encoder and the audio player at the same time after detecting the recording resuming instruction, encode the video data by using the video encoder, and continue playing the audio data by using the audio player.
Disclosure of Invention
The embodiment of the application provides a method and a device for recording videos.
In a first aspect, an embodiment of the present application provides a method for recording a video, where the method includes: in response to the detection of a recording resuming instruction, determining the duration of the video coded by the video coder, and setting the playing progress of the audio player to the duration, wherein the recording resuming instruction is used for instructing to continue to collect the video data and continue to play the target audio data by using the audio player; starting a video encoder and an audio player in sequence; and after the target audio data is played to the playing progress, responding to the collected video data, and transmitting the collected video data to the video encoder so that the video encoder encodes the collected video data.
In some embodiments, the method further comprises: in response to the detected recording stopping instruction, stopping transmitting the collected video data to the video encoder, and controlling the audio player to stop playing; and controlling the video encoder to stop encoding.
In some embodiments, after controlling the video encoder to stop encoding, the method further comprises: determining a total duration of video data encoded by a video encoder; and determining the total time length as the final playing progress of the audio player.
In some embodiments, after determining the total duration as the final playing progress of the audio player, the method further comprises: taking the played target audio data indicated by the final playing progress as a target audio data interval, and extracting the target audio data interval; and storing the coded video data and the target audio data interval.
In some embodiments, the method further comprises: and deleting the collected video data in response to the collected video data before the target audio data is played to the playing progress.
In some embodiments, the method further comprises: and in response to the detection of the recording resuming instruction, setting a pre-established coding identifier as a first preset value, wherein the first preset value is used for indicating that the currently acquired video data is deleted.
In some embodiments, the method further comprises: and when the target audio data is played to the playing progress, setting the encoding identification to be a second preset value, wherein the second preset value is used for indicating that the currently acquired video data is transmitted to the video encoder.
In some embodiments, the method further comprises: and in response to detecting the recording stopping instruction, setting the code identification to be a first preset value.
In a second aspect, an embodiment of the present application provides an apparatus for recording a video, the apparatus including: the setting unit is configured to respond to the detection of a recording resuming instruction, determine the time length of the video coded by the video coder, and set the playing progress of the audio player to the time length, wherein the recording resuming instruction is used for indicating that the video data is continuously collected and the target audio data is continuously played by the audio player; a start unit configured to start the video encoder and the audio player in sequence; and the transmission unit is configured to respond to the collected video data after the target audio data is played to the playing progress, and transmit the collected video data to the video encoder so that the video encoder encodes the collected video data.
In some embodiments, the apparatus further comprises: a control unit configured to stop transmitting the collected video data to the video encoder and control the audio player to stop playing in response to detecting a recording stop instruction; and controlling the video encoder to stop encoding.
In some embodiments, the apparatus further comprises: a first determination unit configured to determine a total duration of video data encoded by a video encoder; and the second determination unit is configured to determine the total time length as the final playing progress of the audio player.
In some embodiments, the apparatus further comprises: an extraction unit configured to extract a target audio data interval with the played target audio data indicated by the final play progress as the target audio data interval; a storage unit configured to store the encoded video data and the target audio data interval.
In some embodiments, the apparatus further comprises: and the deleting unit is configured to respond to the collected video data and delete the collected video data before the target audio data is played to the playing progress.
In some embodiments, the apparatus further comprises: the first setting unit is configured to respond to the detection of the recording resuming instruction, and set the pre-established coding identification to be a first preset value, wherein the first preset value is used for indicating that the currently acquired video data is deleted.
In some embodiments, the apparatus further comprises: and the second setting unit is configured to set the encoding identifier to a second preset value when the target audio data is played to the playing progress, wherein the second preset value is used for indicating that the currently acquired video data is transmitted to the video encoder.
In some embodiments, the apparatus further comprises: and the third setting unit is configured to respond to the detected recording stopping instruction and set the code identification to be the first preset value.
In a third aspect, an embodiment of the present application provides a terminal device, including: one or more processors; a storage device having one or more programs stored thereon which, when executed by one or more processors, cause the one or more processors to implement a method as in any embodiment of a method for recording video.
In a fourth aspect, embodiments of the present application provide a computer-readable medium on which a computer program is stored, which when executed by a processor, implements a method as in any of the embodiments of the method for recording video.
According to the method and the device for recording the video, after the recording resuming instruction is detected, the playing progress of the audio player is set to the duration of the recorded video, then the video encoder and the audio player are sequentially started, and when the target audio data is played to the playing progress, the collected video data is transmitted to the video encoder in response to the collected video data, so that the video encoder encodes the collected video data. Therefore, the duration of the recorded video can be set as the playing progress of the audio player, and the condition that the recorded video is not synchronized with the audio and video due to the deviation of the playing progress is avoided. Meanwhile, the video encoder is started in advance, and when the target audio data is played to the playing progress, the collected video data is transmitted to the video encoder, so that the video data encoding and the audio data playing are synchronously performed, and the audio and video synchronization effect in the recording process of the dubbing music video is improved.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for recording video in accordance with the present application;
FIG. 3 is a schematic diagram of an application scenario of a method for recording video according to the present application;
FIG. 4 is a flow diagram of yet another embodiment of a method for recording video in accordance with the present application;
FIG. 5 is a schematic block diagram of one embodiment of an apparatus for recording video in accordance with the present application;
fig. 6 is a schematic structural diagram of a computer system suitable for implementing a terminal device according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 illustrates an exemplary system architecture 100 to which the method for recording video or the apparatus for recording video of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 101, 102, 103 to interact with the server 105 over the network 104 to receive or send messages (e.g., audio video data upload requests, audio data acquisition requests), etc. Various communication client applications, such as a video recording application, an audio playing application, a video encoding application instant messaging tool, a mailbox client, social platform software, and the like, may be installed on the terminal devices 101, 102, and 103.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices having a display screen and video recording and audio playing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The terminal devices 101, 102, 103 may be equipped with an image capturing device (e.g., a camera) to capture video data. In practice, the smallest visual unit that makes up a video is a Frame (Frame). Each frame is a static image. Temporally successive sequences of frames are composited together to form a motion video. Further, the terminal apparatuses 101, 102, 103 may also be mounted with a device (e.g., a speaker) for converting an electric signal into sound to play the sound. In practice, the audio data is data obtained by performing analog-to-Digital Conversion (ADC) on an analog audio signal at a certain frequency. The audio data playing is a process of performing digital-to-analog conversion on a digital audio signal, restoring the digital audio signal into an analog audio signal, and converting the analog audio signal (the analog audio signal is an electrical signal) into sound for output.
The terminal apparatuses 101, 102, 103 can perform acquisition of video data with an image acquisition device (e.g., a camera) mounted thereon. Also, encoding of video data may be performed using a video encoder installed thereon. In addition, the audio player installed thereon can also be used for playing the audio data. The terminal apparatuses 101, 102, 103 can control, set, and the like a video encoder, an audio player, and the like.
The server 105 may be a server providing various services, such as a background server providing support for video recording type applications installed on the terminal devices 101, 102, 103. The background server can analyze and store the received data such as the audio and video data uploading request and the like. And audio and video data acquisition requests sent by the terminal equipment 101, 102 and 103 can be received, and the audio and video data indicated by the audio and video data acquisition requests are fed back to the terminal equipment 101, 102 and 103.
The server may be hardware or software. When the server is hardware, it may be implemented as a distributed server cluster formed by multiple servers, or may be implemented as a single server. When the server is software, it may be implemented as multiple pieces of software or software modules (e.g., to provide distributed services), or as a single piece of software or software module. And is not particularly limited herein.
It should be noted that the method for recording video provided in the embodiment of the present application is generally executed by the terminal devices 101, 102, and 103, and accordingly, the apparatus for recording video is generally disposed in the terminal devices 101, 102, and 103.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to fig. 2, a flow 200 of one embodiment of a method for recording video in accordance with the present application is shown. The method for recording the video comprises the following steps:
step 201, in response to detecting the recording resuming instruction, determining the duration of the video encoded by the video encoder, and setting the playing progress of the audio player to the duration.
In the present embodiment, the execution subject of the method for recording a video (e.g., the terminal apparatuses 101, 102, 103 shown in fig. 1) may acquire and store target audio data in advance. Here, the target audio data may be audio data (voice data) of a soundtrack designated as a video in advance by a user, for example, audio data corresponding to a certain designated song. The execution body may have a video encoder installed or disposed therein. The video encoder may be used in practice of encoding video data, and video encoding refers to a mode of converting a file in a certain video format into a file in another video format through a specific compression technology. The video encoder may be implemented in existing software (e.g., a component, a code module, etc.) or hardware, and is not limited thereto.
In response to detecting the recording resuming instruction, a duration of the video encoded by the video encoder may be determined, and the playing progress of the audio player may be set to the duration. Wherein, the recording resuming instruction can be used to instruct to continue to collect the video data and to continue to play the target audio data by using the audio player. Here, before the recording command is resumed, the execution body may store a pre-recorded video that is not recorded. Here, the pre-recorded video has been encoded by a video encoder. The execution body may determine a duration of video encoded by the video encoder. In practice, the duration of the video encoded by the video encoder during each recording process can be determined as follows: firstly, determining the starting time and the stopping time of transmitting data to a video encoder by the recording; and then, determining the difference value between the stop time and the start time as the time length of the video coded by the video coder in the recording process. In practice, the time duration may also be regarded as the time duration of the successfully recorded video. And summing the time lengths of the coded videos in the recording processes, so as to obtain the time length of the coded video of the video coder.
It should be noted that the execution main body may also use other methods to determine the time length of the recorded video, and details are not described here.
It should be noted that, if the execution main body does not store the video that is not recorded in advance and is not recorded completely, that is, the execution main body is in the process of recording the first video, the playing progress may be directly set to 0. At this time, playback is started from the start position of the target audio data.
In practice, audio data is data obtained by digitizing a sound signal. The digitization of the sound signal is a process of converting a continuous analog audio signal into a digital signal at a certain frequency to obtain audio data. Generally, the process of digitizing a sound signal comprises three steps of sampling, quantizing and encoding. Here, sampling is to replace an original signal that is continuous in time with a sequence of signal sample values at regular intervals. Quantization is the approximation of the original amplitude value which changes continuously in time by a finite amplitude, and the continuous amplitude of the analog signal is changed into a finite number of discrete values with a certain time interval. The encoding means that the quantized discrete values are represented by binary numbers according to a certain rule. Here, Pulse Code Modulation (PCM) may implement digitized audio data into which an analog audio signal is sampled, quantized, and encoded. Accordingly, the above target audio data may be a data stream in a PCM encoding format. At this time, the format of the file in which the target audio data is described may be the wav format. The format of the file describing the target audio data may be other formats, such as mp3 format and ape format. At this time, the target Audio data may be data in other encoding formats (for example, lossy compression formats such as AAC (Advanced Audio Coding)), and is not limited to the PCM encoding format. The execution body may also perform format conversion on the file to convert the file into a record wav format. At this time, the target audio file in the converted file is a data stream in PCM coding format.
Generally, the execution body may be installed with a video recording application. The video recording application can support recording of the dubbing music video. The dubbing music video can be a video which is played by audio data at the same time of video data acquisition. And the recorded sound in the dubbing music video is the sound corresponding to the audio data. For example, a singing action performed by a user is recorded during the process of playing a certain song, and the recorded video takes the song as background music. The video recording application can support continuous recording and segmented recording of the dubbing music video. When recording in segments, a user may first click a recording button to record a first segment of video. Then, the recording button is clicked again to trigger the instruction of suspending video recording. And then clicking the recording key again to trigger a recording resuming instruction so as to record the second video segment. Then, the recording button is clicked again to trigger the instruction of suspending video recording. And so on. It should be noted that the recording instruction, the recording pause instruction, and the recording resume instruction may also be triggered by other manners. For example, each video can be recorded by pressing a record button for a long time. When the recording button is released, an instruction for suspending video recording is triggered. And will not be described in detail herein.
Step 202, the video encoder and the audio player are started in sequence.
In this embodiment, an audio player may be installed or disposed in the execution body. The audio player is used for playing audio data. In practice, audio playback is a process of performing digital-to-analog conversion on digitized audio data and restoring the converted audio data into an analog audio signal. The audio player may be implemented in existing software (e.g., a component, a code module, etc.) or hardware, and is not limited thereto.
In this embodiment, after step 201 is executed, the execution subject may start the video encoder and the audio player in sequence. I.e. the video encoder is started first. And starting the audio player after the video encoder is successfully started. It should be noted that, if the audio player is started first and then the video encoder is started, or the audio player and the video encoder are started simultaneously, the video encoder may not be started successfully when the target audio data is played to the playing progress, so that the playing of the target audio data is not synchronized with the encoding of the video data. And after the video encoder is started successfully, the audio player is started, so that the situation can be avoided. In practice, the execution body may control the start or stop of the video encoder and the audio decoder.
And 203, after the target audio data is played to the playing progress, responding to the collected video data, and transmitting the collected video data to the video encoder so that the video encoder encodes the collected video data.
In this embodiment, after the target audio data is played to the playing progress, in response to the collected video data, the collected video data may be transmitted to the video encoder, so that the video encoder encodes the collected video data. Therefore, after the target audio data is played to the playing progress, the video data is formally encoded, so that the audio data is played and the video data is encoded synchronously, and the audio and video synchronization effect in the recording process of the dubbing music video is improved.
In practice, the execution body may be equipped with an image acquisition device, such as a camera. The execution main body can acquire video data by using the camera.
In some optional implementations of this embodiment, before the target audio data is played to the playing progress, in response to capturing the video data, the execution subject may delete the captured video data. In practice, the executing body may collect video data by using the camera. Before the above step 201 is executed, that is, before the recording resuming instruction is detected, the camera may be in an on state or an off state. If the target audio data is in the on state, the image capturing may be continued, but the captured image is not transmitted to the video encoder, or the captured image is not stored, and may be discarded (i.e., frame dropping processing is performed) until the target audio data is played to the playing progress. If the camera is in the off state before the recording resuming instruction is detected, the camera can be turned on for image capturing after the recording resuming instruction is detected. At this time, the captured frames are also discarded until the target audio data is played to the playing progress.
In some optional implementation manners of this embodiment, the method for recording a video may further include the following steps: and in response to the detected recording stopping instruction, stopping transmitting the collected video data to the video encoder, and controlling the audio player to stop playing. And then, controlling the video encoder to stop encoding.
In some optional implementations of this embodiment, after the controlling the video encoder to stop encoding, the method for recording a video may further include: first, the total duration of video data that has been encoded by the video encoder is determined. Here, the total duration of the encoded video data is the total duration of the video data that can be currently recorded. Then, the total duration may be determined as a final playing progress of the audio player. It should be noted that the encoded video data includes video data recorded before step 201.
In some optional implementation manners of this embodiment, after the determining the total duration as the final playing progress of the audio player, the method for recording a video may further include: firstly, the played target audio data indicated by the final playing progress is taken as a target audio data interval, and the target audio data interval is extracted. Here, the playing end position of the target audio data corresponding to the playing progress may be determined. And taking a section formed from the playing starting position to the playing ending position of the target audio data as a target audio data section, and extracting the target audio data section. The encoded video data and the target audio data interval may then be stored. Here, the target audio data interval and the encoded video data may be stored in two files, respectively, and a mapping between the two files may be established. In addition, the target audio data interval and the encoded video data may be stored in the same file.
In some optional implementation manners of this embodiment, the method for recording a video may further include: in response to detecting the recording resuming instruction, the pre-established code flag is set to a first preset value (e.g., "NO", or "N", or "0", etc.). The first preset value may be used to indicate that the currently acquired video data is deleted.
In some optional implementation manners of this embodiment, the method for recording a video may further include: when the target audio data is played to the playing progress, the encoding flag is set to a second preset value (for example, "YES", or "Y", or "1", etc.). The second preset value may be used to instruct the video encoder to transmit currently acquired video data.
In some optional implementation manners of this embodiment, the method for recording a video may further include: and responding to the detected recording stopping instruction, and setting the code identification to be the first preset value.
With continued reference to fig. 3, fig. 3 is a schematic diagram of an application scenario of the method for recording a video according to the present embodiment. In the application scenario of fig. 3, the user holds the terminal device 301 and records the dubbing video. The terminal device 301 runs a short video recording application. The user selects a certain score (for example, song "small apple") in the interface of the short video recording application in advance, and records the score video in a segmented manner. The score corresponds to the target audio data 302. After a certain segment is recorded, after a user clicks a dubbing video recording button, a recording recovery instruction is triggered. After detecting the recording resuming instruction, the terminal device 301 sets the playing progress of the audio player to the duration of the video encoded by the video encoder. And then, the video encoder and the audio player are sequentially started, and after the target audio data is played to the playing progress, the collected video data is transmitted to the video encoder in response to the collected video data 303, so that the video encoder encodes the collected video data.
In the method provided by the above embodiment of the present application, after the recording resuming instruction is detected, the playing schedule of the audio player is set to the duration of the recorded video, and then the video encoder and the audio player are sequentially started, and after the target audio data is played to the playing schedule, the collected video data is transmitted to the video encoder in response to the collected video data, so that the video encoder encodes the collected video data. Therefore, the duration of the recorded video can be set as the playing progress of the audio player, and the condition that the recorded video is not synchronized with the audio and video due to the deviation of the playing progress is avoided. Meanwhile, the video encoder is started in advance, and when the target audio data is played to the playing progress, the collected video data is transmitted to the video encoder, so that the video data encoding and the audio data playing are synchronously performed, and the audio and video synchronization effect in the recording process of the dubbing music video is improved.
With further reference to fig. 4, a flow 400 of yet another embodiment of a method for recording video is shown. The process 400 of the method for recording video includes the steps of:
in step 401, in response to detecting the recording resuming instruction, a duration of the video encoded by the video encoder is determined, and a playing progress of the audio player is set to the duration.
In the present embodiment, a video encoder may be installed or disposed in an execution body (e.g., terminal apparatuses 101, 102, 103 shown in fig. 1) of the method for recording a video. And in response to detecting the recording resuming instruction, determining the time length coded by the video coder, and setting the playing progress of the audio player to the time length. Wherein, the recording resuming instruction can be used to instruct to continue to collect the video data and to continue to play the target audio data by using the audio player.
In this embodiment, in response to detecting the recording resuming instruction, the executing entity may further set a pre-established code flag to be a first preset value (e.g., "NO", or "N", or "0", etc.). The first preset value may be used to indicate that the currently acquired video data is deleted.
In this embodiment, the execution body may be mounted with an image capture device, such as a camera. The execution main body can acquire video data by using the camera. Before the above step 401 is executed, that is, before the recording resuming instruction is detected, the camera may be in an opened state. The execution body may continuously perform image acquisition using the camera. In response to capturing video data (i.e., capturing each frame), it may be determined whether a value of a current coding flag is the first preset value, and the currently captured video data may be deleted (i.e., frame dropping processing is performed) until the value of the coding flag is a second preset value (e.g., "YES", or "Y", or "1", etc.). The second preset value may be used to instruct the video encoder to transmit currently acquired video data.
Step 402, the video encoder and the audio player are started in sequence.
In this embodiment, an audio player may be installed or disposed in the execution body. The execution body may sequentially start the video encoder and the audio player. I.e. the video encoder is started first. And starting the audio player after the video encoder is successfully started.
And step 403, after the target audio data is played to the playing progress, in response to the collected video data, transmitting the collected video data to the video encoder, so that the video encoder encodes the collected video data.
In this embodiment, after the target audio data is played to the playing progress, in response to the collected video data, the collected video data may be transmitted to the video encoder, so that the video encoder encodes the collected video data. Therefore, after the target audio data is played to the playing progress, the video data is formally encoded, so that the audio data is played and the video data is encoded synchronously, and the audio and video synchronization effect in the recording process of the dubbing music video is improved.
In addition, when the target audio data is played to the playing progress, the execution main body may further set the encoding flag to the second preset value to indicate that, when video data is collected, the currently collected video data is transmitted to the video encoder.
Step 404, in response to detecting the recording stop instruction, stopping transmitting the collected video data to the video encoder, and controlling the audio player to stop playing.
In this embodiment, in response to detecting the recording stop instruction, the execution main body may stop transmitting the collected video data to the video encoder, and simultaneously, control the audio player to stop playing.
In addition, in response to detecting the recording stopping instruction, the executing body may further set the code identifier to the first preset value to indicate that the video data captured continuously is discarded when the video data is captured continuously.
Step 405, the video encoder is controlled to stop encoding.
In this embodiment, after stopping transmitting the collected video data to the video encoder and controlling the audio player to stop playing, the execution main body may control the video encoder to stop encoding. I.e. stop the video encoder.
At step 406, the total duration of video data that has been encoded by the video encoder is determined.
In this embodiment, after controlling the video encoder to stop encoding, the execution body may determine a total duration of the video data encoded by the video encoder. Here, the total duration of the encoded video data is the total duration of the video data that can be currently recorded. The encoded video data includes the video data recorded before step 201.
Step 407, determine the total duration as the final playing progress of the audio player.
In this embodiment, the execution subject may determine the determined total duration as the final playing progress of the audio player.
And step 408, taking the played target audio data indicated by the final playing progress as a target audio data interval, and extracting the target audio data interval.
In this embodiment, the execution main body may first determine a playing end position of the target audio data corresponding to the playing progress. Then, a section from the play start position to the play end position of the target audio data may be determined as the target audio data section. Finally, the target audio data interval may be extracted.
Step 409, storing the encoded video data and the target audio data interval.
In this embodiment, the execution body may store the target audio data interval and the encoded video data into two files, respectively, and establish a mapping between the two files. In addition, the target audio data interval and the encoded video data may be stored in the same file.
As can be seen from fig. 4, compared with the embodiment corresponding to fig. 2, the flow 400 of the method for recording a video in this embodiment represents the operation performed after the instruction for stopping recording is detected. When the recording is stopped, the audio encoder is stopped playing the target audio data while the transmission of the video data to the video encoder is stopped. Thus, a synchronous stop of video encoding and audio playback is achieved. Therefore, the audio and video synchronization effect in the recording process of the dubbing music videos is further improved. In addition, the operation of audio and video data storage is highlighted. Therefore, the audio and video files can be generated, and subsequent playing, uploading and the like are facilitated.
With further reference to fig. 5, as an implementation of the methods shown in the above-mentioned figures, the present application provides an embodiment of an apparatus for recording video, which corresponds to the method embodiment shown in fig. 2, and which is particularly applicable to various electronic devices.
As shown in fig. 5, the apparatus 500 for recording video according to this embodiment includes: a setting unit 501, configured to determine a duration of a recorded video in response to detecting a recording resuming instruction, and set a playing progress of an audio player to the duration, where the recording resuming instruction is used to instruct to continue to acquire video data and continue to play target audio data by using the audio player; a start unit 502 configured to start the video encoder and the audio player in sequence; a transmitting unit 503 configured to transmit the captured video data to the video encoder in response to the captured video data after the target audio data is played to the playing progress, so that the video encoder encodes the captured video data.
In some optional implementations of this embodiment, the apparatus may further include a control unit (not shown in the figure). Wherein the control unit may be configured to stop transmitting the collected video data to the video encoder and control the audio player to stop playing in response to detecting a recording stop instruction; and controlling the video encoder to stop encoding.
In some optional implementations of this embodiment, the apparatus may further include a first determining unit and a second determining unit (not shown in the figure). Wherein the first determining unit may be configured to determine a total duration of the video data encoded by the video encoder. The second determination unit may be configured to determine the total duration as a final playing progress of the audio player.
In some optional implementations of this embodiment, the apparatus may further include an extraction unit and a storage unit (not shown in the figure). The extracting unit may be configured to extract the target audio data interval by using the played target audio data indicated by the final playing progress as a target audio data interval. The storage unit may be configured to store the encoded video data and the target audio data interval.
In some optional implementations of this embodiment, the apparatus may further include a deletion unit (not shown in the figure). The deleting unit may be configured to delete the captured video data in response to the captured video data before the target audio data is played to the playing progress.
In some optional implementations of this embodiment, the apparatus may further include a first setting unit (not shown in the figure). The first setting unit may be configured to set a pre-established coding identifier to a first preset value in response to detecting a recording resuming instruction, where the first preset value is used to instruct to delete currently acquired video data.
In some optional implementations of this embodiment, the apparatus may further include a second setting unit (not shown in the figure). The second setting unit may be configured to set the encoding flag to a second preset value when the target audio data is played to the playing progress, where the second preset value is used to instruct the video encoder to transmit currently-captured video data.
In some optional implementations of this embodiment, the apparatus may further include a third setting unit (not shown in the figure). The third setting unit may be configured to set the code identifier to the first preset value in response to detecting a recording stop instruction.
In the apparatus provided in the foregoing embodiment of the present application, after the setting unit 501 detects the recording resuming instruction, the playing schedule of the audio player is set to the duration of the recorded video, then the starting unit 502 starts the video encoder and the audio player in sequence, and then the transmitting unit 503 transmits the acquired video data to the video encoder in response to the acquired video data after determining that the target audio data is played to the playing schedule, so that the video encoder encodes the acquired video data. Therefore, the playing progress of the audio player can be set based on the duration of the recorded video, and the condition that the recorded video is not synchronized with the audio and video due to the deviation of the playing progress is avoided. Meanwhile, when the target audio data is played to the playing progress, the collected video data is transmitted to the video encoder, so that the video data encoding and the audio data playing are synchronously carried out, and the audio and video synchronization effect in the recording process of the dubbing music video is improved.
Referring now to FIG. 6, shown is a block diagram of a computer system 600 suitable for use in implementing a terminal device of an embodiment of the present application. The terminal device shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
To the I/O interface 605, AN input section 606 including a touch panel, and the like, AN output section 607 including a display such as a liquid crystal display (L CD), a speaker, and the like, a storage section 608 including a hard disk, and the like, and a communication section 609 including a network interface card such as a L AN card, a modem, and the like, the communication section 609 performs communication processing via a network such as the internet, a drive 610 is also connected to the I/O interface 605 as necessary, a removable medium 611 such as a semiconductor memory, and the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted into the storage section 608 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the method of the present application when executed by a Central Processing Unit (CPU) 601. It should be noted that the computer readable medium described herein can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present application, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a setting unit, a starting unit, and a transmission unit. Here, the names of these units do not constitute a limitation to the unit itself in some cases, and for example, the setting unit may also be described as a "unit that sets the progress of play of a music player".
As another aspect, the present application also provides a computer-readable medium, which may be contained in the apparatus described in the above embodiments; or may be present separately and not assembled into the device. The computer readable medium carries one or more programs which, when executed by the apparatus, cause the apparatus to: in response to detecting a recording resuming instruction, determining the duration of the video encoded by the video encoder, and setting the playing progress of the audio player to the duration, wherein the recording resuming instruction is used for instructing to continue to acquire video data and continue to play target audio data by using the audio player; sequentially starting the video encoder and the audio player; and after the target audio data is played to the playing progress, responding to the collected video data, and transmitting the collected video data to the video encoder so that the video encoder encodes the collected video data.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the invention. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (18)

1. A method for recording video, comprising:
in response to detecting a recording resuming instruction, determining the duration of the video encoded by the video encoder, and setting the playing progress of the audio player to the duration, wherein the recording resuming instruction is used for instructing to continue to acquire video data and continue to play target audio data by using the audio player;
sequentially starting the video encoder and the audio player;
and after the target audio data is played to the playing progress, responding to the collected video data, and transmitting the collected video data to the video encoder so that the video encoder encodes the collected video data.
2. The method for recording video of claim 1, wherein the method further comprises:
in response to the detection of the recording stopping instruction, stopping transmitting the collected video data to the video encoder, and controlling the audio player to stop playing; controlling the video encoder to stop encoding.
3. The method for recording video as claimed in claim 2, wherein after said controlling the video encoder to stop encoding, the method further comprises:
determining a total duration of video data that has been encoded by the video encoder;
and determining the total duration as the final playing progress of the audio player.
4. The method for recording video of claim 3, wherein after the determining the total duration as a final play progress of the audio player, the method further comprises:
taking the played target audio data indicated by the final playing progress as a target audio data interval, and extracting the target audio data interval;
and storing the coded video data and the target audio data interval.
5. The method for recording video of claim 1, wherein the method further comprises:
and deleting the collected video data in response to the collected video data before the target audio data is played to the playing progress.
6. The method for recording video of claim 1, wherein the method further comprises:
and in response to the detection of the recording resuming instruction, setting a pre-established coding identifier as a first preset value, wherein the first preset value is used for indicating that the currently acquired video data is deleted.
7. The method for recording video of claim 6, wherein the method further comprises:
and when the target audio data is played to the playing progress, setting the encoding identification to be a second preset value, wherein the second preset value is used for indicating that the currently acquired video data is transmitted to the video encoder.
8. The method for recording video of claim 7, wherein the method further comprises:
and in response to detecting a recording stopping instruction, setting the code identification to be the first preset value.
9. An apparatus for recording video, comprising:
the setting unit is configured to respond to the detection of a recording resuming instruction, determine the time length of the video coded by the video coder, and set the playing progress of the audio player to the time length, wherein the recording resuming instruction is used for indicating that the video data is continuously collected and the target audio data is continuously played by the audio player;
a start unit configured to start the video encoder and the audio player in sequence;
a transmission unit configured to transmit the collected video data to the video encoder in response to the collected video data after the target audio data is played to the playing progress, so that the video encoder encodes the collected video data.
10. An apparatus for recording video according to claim 9, wherein the apparatus further comprises:
a control unit configured to stop transmitting the collected video data to the video encoder and control the audio player to stop playing in response to detecting a recording stop instruction; controlling the video encoder to stop encoding.
11. An apparatus for recording video according to claim 10, wherein the apparatus further comprises:
a first determining unit configured to determine a total duration of video data encoded by the video encoder;
a second determination unit configured to determine the total duration as a final playing progress of the audio player.
12. An apparatus for recording video according to claim 11, wherein the apparatus further comprises:
an extracting unit configured to extract a target audio data interval with the played target audio data indicated by the final play progress as the target audio data interval;
a storage unit configured to store the encoded video data and the target audio data interval.
13. An apparatus for recording video according to claim 9, wherein the apparatus further comprises:
a deletion unit configured to delete the captured video data in response to the captured video data before the target audio data is played to the play progress.
14. An apparatus for recording video according to claim 9, wherein the apparatus further comprises:
the first setting unit is configured to set a pre-established coding identifier to a first preset value in response to detecting a recording resuming instruction, wherein the first preset value is used for indicating that currently acquired video data is deleted.
15. An apparatus for recording video according to claim 14, wherein the apparatus further comprises:
the second setting unit is configured to set the encoding identifier to a second preset value when the target audio data is played to the playing progress, wherein the second preset value is used for indicating that the currently acquired video data is transmitted to the video encoder.
16. An apparatus for recording video as defined in claim 15, wherein the apparatus further comprises:
a third setting unit configured to set the code identifier to the first preset value in response to detecting a recording stop instruction.
17. A terminal device, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-8.
18. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-8.
CN201810865722.1A 2018-08-01 2018-08-01 Method and apparatus for recording video Active CN109600660B (en)

Priority Applications (7)

Application Number Priority Date Filing Date Title
CN201810865722.1A CN109600660B (en) 2018-08-01 2018-08-01 Method and apparatus for recording video
BR112020024621-2A BR112020024621A2 (en) 2018-08-01 2019-07-30 video recording method and device
KR1020207035557A KR102625410B1 (en) 2018-08-01 2019-07-30 Video recording methods and devices
JP2021504427A JP7008870B2 (en) 2018-08-01 2019-07-30 How and equipment to record video
PCT/CN2019/098460 WO2020024950A1 (en) 2018-08-01 2019-07-30 Video recording method and device
EP19845332.6A EP3833010A4 (en) 2018-08-01 2019-07-30 Video recording method and device
US17/014,391 US11114133B2 (en) 2018-08-01 2020-09-08 Video recording method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810865722.1A CN109600660B (en) 2018-08-01 2018-08-01 Method and apparatus for recording video

Publications (2)

Publication Number Publication Date
CN109600660A CN109600660A (en) 2019-04-09
CN109600660B true CN109600660B (en) 2020-07-24

Family

ID=65957009

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810865722.1A Active CN109600660B (en) 2018-08-01 2018-08-01 Method and apparatus for recording video

Country Status (1)

Country Link
CN (1) CN109600660B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7008870B2 (en) * 2018-08-01 2022-01-25 北京微播視界科技有限公司 How and equipment to record video
CN116052701B (en) * 2022-07-07 2023-10-20 荣耀终端有限公司 Audio processing method and electronic equipment

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6801707B1 (en) * 1999-09-20 2004-10-05 Matsushita Electric Industrial Co., Ltd. Encoding/recording device that suspends encoding for video data and sampling for an audio signal in response to a recording pause instruction so as to allow data recorded before and after recording pause to be continuously reproduced
TWI314017B (en) * 2006-07-12 2009-08-21 Quanta Comp Inc System and method for synchronizing video frames and audio frames
CN101483753A (en) * 2008-01-10 2009-07-15 华为技术有限公司 Implementation method and device for recoding service
CN101740084B (en) * 2009-11-25 2012-05-09 中兴通讯股份有限公司 Clipping method and mobile terminal of multi-media segment
CN102348086A (en) * 2010-08-03 2012-02-08 中兴通讯股份有限公司 Method and mobile terminal for loading background sounds in video recording process
CN103208298A (en) * 2012-01-11 2013-07-17 三星电子(中国)研发中心 Video shooting method and system
CN103702041A (en) * 2013-12-30 2014-04-02 乐视网信息技术(北京)股份有限公司 Method and device for realizing pause continuation shooting of video
CN104023192B (en) * 2014-06-27 2016-04-13 努比亚技术有限公司 A kind of method and apparatus of recorded video
CN105407379A (en) * 2014-08-26 2016-03-16 天脉聚源(北京)教育科技有限公司 Synchronous recording method for multiple media
CN104835520A (en) * 2015-03-27 2015-08-12 广州荔支网络技术有限公司 Mobile equipment recording method and device
CN105516485B (en) * 2015-12-04 2019-03-01 小米科技有限责任公司 The way of recording and device

Also Published As

Publication number Publication date
CN109600660A (en) 2019-04-09

Similar Documents

Publication Publication Date Title
CN109600564B (en) Method and apparatus for determining a timestamp
US11114133B2 (en) Video recording method and device
WO2020024962A1 (en) Method and apparatus for processing data
CN109600665B (en) Method and apparatus for processing data
CN109600661B (en) Method and apparatus for recording video
US11122093B2 (en) Systems and methods for multi-party media management
CN109600660B (en) Method and apparatus for recording video
WO2023024290A1 (en) Video recording method, camera device, control terminal, and video recording system
WO2023125169A1 (en) Audio processing method and apparatus, device, and storage medium
CN105208318A (en) Video conference content processing method and device
CN112423140A (en) Video playing method and device, electronic equipment and storage medium
CN110912948B (en) Method and device for reporting problems
CN109600562B (en) Method and apparatus for recording video
CN109600563B (en) Method and apparatus for determining a timestamp
WO2020024960A1 (en) Method and device for processing data
CN109618198A (en) Live content reports method and device, storage medium, electronic equipment
CN112349303B (en) Audio playing method, device and storage medium
CN108228829B (en) Method and apparatus for generating information
US11876850B2 (en) Simultaneous recording and uploading of multiple audio files of the same conversation and audio drift normalization systems and methods
US11388489B2 (en) Simultaneous recording and uploading of multiple audio files of the same conversation and audio drift normalization systems and methods
CN112218137B (en) Multimedia data acquisition method, device, equipment and medium
CN117556066A (en) Multimedia content generation method and electronic equipment
WO2024052705A1 (en) Collaborative media transcription system with failed connection mitigation
CN113948054A (en) Audio track processing method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant