WO2020024950A1 - 录制视频的方法和装置 - Google Patents

录制视频的方法和装置 Download PDF

Info

Publication number
WO2020024950A1
WO2020024950A1 PCT/CN2019/098460 CN2019098460W WO2020024950A1 WO 2020024950 A1 WO2020024950 A1 WO 2020024950A1 CN 2019098460 W CN2019098460 W CN 2019098460W WO 2020024950 A1 WO2020024950 A1 WO 2020024950A1
Authority
WO
WIPO (PCT)
Prior art keywords
video
video encoder
data
video data
response
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.)
Ceased
Application number
PCT/CN2019/098460
Other languages
English (en)
French (fr)
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
Priority claimed from CN201810865722.1A external-priority patent/CN109600660B/zh
Priority claimed from CN201810865723.6A external-priority patent/CN109600562B/zh
Application filed by Beijing Microlive Vision Technology Co Ltd filed Critical Beijing Microlive Vision Technology Co Ltd
Priority to JP2021504427A priority Critical patent/JP7008870B2/ja
Priority to EP19845332.6A priority patent/EP3833010A4/en
Priority to KR1020207035557A priority patent/KR102625410B1/ko
Priority to BR112020024621-2A priority patent/BR112020024621B1/pt
Publication of WO2020024950A1 publication Critical patent/WO2020024950A1/zh
Priority to US17/014,391 priority patent/US11114133B2/en
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B27/00Editing; Indexing; Addressing; Timing or synchronising; Monitoring; Measuring tape travel
    • G11B27/10Indexing; Addressing; Timing or synchronising; Measuring tape travel
    • G11B27/19Indexing; Addressing; Timing or synchronising; Measuring tape travel by using information detectable on the record carrier
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B27/00Editing; Indexing; Addressing; Timing or synchronising; Monitoring; Measuring tape travel
    • G11B27/02Editing, e.g. varying the order of information signals recorded on, or reproduced from, record carriers
    • G11B27/031Electronic editing of digitised analogue information signals, e.g. audio or video signals
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/00007Time or data compression or expansion
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/10527Audio or video recording; Data buffering arrangements
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B27/00Editing; Indexing; Addressing; Timing or synchronising; Monitoring; Measuring tape travel
    • G11B27/10Indexing; Addressing; Timing or synchronising; Measuring tape travel
    • 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
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/76Television signal recording
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/00007Time or data compression or expansion
    • G11B2020/00072Time or data compression or expansion the compressed signal including a video signal
    • GPHYSICS
    • G11INFORMATION STORAGE
    • G11BINFORMATION STORAGE BASED ON RELATIVE MOVEMENT BETWEEN RECORD CARRIER AND TRANSDUCER
    • G11B20/00Signal processing not specific to the method of recording or reproducing; Circuits therefor
    • G11B20/10Digital recording or reproducing
    • G11B20/10527Audio or video recording; Data buffering arrangements
    • G11B2020/10537Audio or video recording
    • G11B2020/10546Audio or video recording specifically adapted for audio data

Definitions

  • the embodiments of the present application relate to the field of computer technology, for example, to a method and an apparatus for recording a video.
  • audio (soundtrack) playback is usually performed at the same time as video capture with the camera. For example, during a song, a singing action performed by a user is recorded, and the recorded video uses the song as background music. In applications with video recording capabilities, it is common for audio and video to be out of sync for recorded soundtrack videos.
  • the related method is usually to start the video encoder and audio player at the same time after detecting the resume recording instruction, use the video encoder to encode the video data, and use the audio player to continue the audio data. Playback.
  • the embodiments of the present application provide a method and a device for recording a video.
  • An embodiment of the present application provides a method for recording a video.
  • the method includes: in response to detecting a resume recording instruction, determining a duration of a video encoded by a video encoder, and setting a playback progress of an audio player to the foregoing duration, where:
  • the resume recording instruction is used to instruct to continue to collect video data and use the audio player to continue playing target audio data; start the audio player; where the video encoder is started before starting the audio player; when the target audio data is played to the playback progress
  • the collected video data is transmitted to the video encoder, so that the video encoder encodes the collected video data.
  • An embodiment of the present application further provides a device for recording a video.
  • the device includes a setting unit configured to determine a duration of a video that has been encoded by a video encoder in response to detecting a resume recording instruction, and a playback progress of an audio player. It is set to the above duration, wherein the resume recording instruction is used to instruct to continue collecting video data and continue playing target audio data using the audio player; the first startup unit is configured to start the audio player; the transmission unit is configured to start at the target audio When the data is played to the playback progress, in response to the captured video data, the collected video data is transmitted to the video encoder, so that the video encoder encodes the collected video data; the second startup unit is configured Before starting the audio player, start the video encoder.
  • An embodiment of the present application further provides a terminal device including: one or more processors; a storage device configured to store one or more programs, and when one or more programs are executed by one or more processors, One or more processors are caused to implement the method for recording video as provided by any embodiment.
  • An embodiment of the present application further provides a computer-readable medium.
  • a computer program is stored on the computer-readable medium, and when the program is executed by a processor, the method for recording a video provided by any embodiment is implemented.
  • FIG. 1 is a system architecture diagram provided by an embodiment of the present application.
  • FIG. 2 is a flowchart of a method for recording a video according to an embodiment of the present application
  • FIG. 3 is a schematic diagram of an application scenario of a method for recording a video provided by an embodiment of the present application
  • FIG. 4 is a flowchart of another method for recording a video provided by an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of a video recording apparatus according to an embodiment of the present application.
  • FIG. 6 is a flowchart of another method for recording a video according to an embodiment of the present application.
  • FIG. 7 is a flowchart of another method for recording a video provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of another apparatus for recording video according to an embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of a computer system of a terminal device according to an embodiment of the present application.
  • FIG. 1 is a system architecture diagram provided by an embodiment of the present application.
  • 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 can be applied.
  • the system architecture 100 may include a terminal device 101, a terminal device 102, a terminal device 103, a network 104, and a server 105.
  • the network 104 is used to provide a medium for a communication link between the terminal device 101, the terminal device 102, the terminal device 103, and the server 105.
  • the network 104 may include any type of connection network, such as a wired, wireless communication link, or a fiber optic cable.
  • the user may use the terminal device 101, the terminal device 102, and the terminal device 103 to interact with the server 105 through the network 104 to receive or send messages (such as audio and video data upload requests, audio data acquisition requests), and the like.
  • messages such as audio and video data upload requests, audio data acquisition requests
  • a variety of communication client applications can be installed on the terminal device 101, the terminal device 102, and the terminal device 103, such as video recording applications, audio playback applications, video encoding applications, instant messaging tools, email clients, social platform software, and so on.
  • the terminal device 101, the terminal device 102, and the terminal device 103 may be hardware or software.
  • the terminal device 101, terminal device 102, and terminal device 103 are hardware, they can be a variety of electronic devices with a display screen and video recording and audio playback, including but not limited to smartphones, tablets, and laptop computers And desktop computers and much more.
  • the terminal device 101, the terminal device 102, and the terminal device 103 are software, the terminal device 101, the terminal device 102, and the terminal device 103 may be installed in the electronic devices listed above.
  • the terminal device 101, the terminal device 102, and the terminal device 103 may be implemented as multiple software or software modules (for example, to provide distributed services), or may be implemented as a single software or software module. It is not specifically limited here.
  • the terminal device 101, the terminal device 102, and the terminal device 103 may be equipped with an image acquisition device (such as a camera) to collect video data.
  • the minimum visual unit that composes a video is a frame. Each frame is a static image. Combining a sequence of temporally consecutive frames together forms a dynamic video.
  • the terminal device 101, the terminal device 102, and the terminal device 103 may also be installed with a device (such as a speaker) configured to convert an electrical signal into a sound to play the sound.
  • the audio data is data obtained by performing analog-to-digital conversion (ADC) on the analog audio signal at a certain frequency.
  • ADC analog-to-digital conversion
  • the playback of audio data is a process of digital-to-analog conversion of digital audio signals, reduction to analog audio signals, and conversion of analog audio signals (analog audio signals to electrical signals) into sound for output.
  • the terminal device 101, the terminal device 102, and the terminal device 103 may collect video data by using an image acquisition device (for example, a camera) installed on the terminal device, and may encode video data by using a video encoder installed on the terminal device 101, the terminal device 102, and the terminal device 103.
  • the terminal device 101, the terminal device 102, and the terminal device 103 may also use an audio player installed on the terminal device 101 to play audio data.
  • the terminal device 101, the terminal device 102, and the terminal device 103 can control, set, etc. the video encoder, audio player, and the like.
  • the server 105 may be a server that provides various services, such as a background server that provides support for video recording applications installed on the terminal device 101, the terminal device 102, and the terminal device 103.
  • the background server can analyze and store the received audio and video data upload requests and other data.
  • the background server can also receive audio and video data acquisition requests sent by the terminal device 101, terminal device 102, and terminal device 103, and feed back the audio and video data indicated by the audio and video data acquisition request to the terminal device 101, terminal device 102, and terminal.
  • Equipment 103 is a server that provides various services, such as a background server that provides support for video recording applications installed on the terminal device 101, the terminal device 102, and the terminal device 103.
  • the server 105 may be hardware or software.
  • the server 105 can be implemented as a distributed server cluster composed of multiple servers or as a single server.
  • the server 105 is software, it may be implemented as multiple software or software modules (for example, to provide distributed services), or may be implemented as a single software or software module. It is not specifically limited here.
  • the method for recording video provided by the embodiment of the present application is generally performed by the terminal device 101, the terminal device 102, and the terminal device 103. Accordingly, the device for recording a video is generally provided in the terminal device 101, the terminal device 102, Terminal device 103.
  • terminal devices, networks, and servers in FIG. 1 are merely exemplary. According to implementation needs, there can be any number of terminal devices, networks, and servers.
  • FIG. 2 is a flowchart of a method for recording a video provided by an embodiment of the present application.
  • the method for recording a video includes the following steps.
  • step 2010 in response to detecting the resume recording instruction, determining the duration of the video encoded by the video encoder, and setting the playback progress of the audio player to the duration.
  • an execution subject of the method for recording a video may obtain and store target audio data in advance.
  • the above-mentioned target audio data may be audio data specified in advance by the user as a soundtrack of the video, for example, audio data corresponding to a specified song.
  • a video encoder may be installed or deployed in the above execution body.
  • the video encoder may be used to encode video data.
  • video encoding refers to a manner of converting a file in a certain video format into another file in a video format through a specific compression technology.
  • the video encoder may be in the form of software (for example, a component, a code module, etc.) or hardware, which is not limited herein.
  • the duration of the video encoded by the video encoder may be determined, and the playback progress of the audio player is set to the duration.
  • the resume recording instruction may be used to instruct to continue collecting video data and continue playing target audio data by using an audio player.
  • the execution subject before the trigger of the resume recording instruction, the execution subject may store a pre-recorded and unrecorded video.
  • the pre-recorded video has been encoded by a video encoder.
  • the execution body may determine the duration of the video that the video encoder has encoded.
  • the duration of the video encoded by the video encoder can be determined in the following manner: first, determine the start time and stop time of the data transmitted from the recording to the video encoder; , Determining the difference between the stop time and the start time as the duration of the video that the video encoder has encoded during the recording process.
  • the duration may also be regarded as the duration of the successfully recorded video. Sum the length of the encoded video during multiple recordings to get the length of the video encoded by the video encoder.
  • the above-mentioned executing subject may also determine the duration of the recorded video by using other methods, which will not be repeated here.
  • the playback progress may be directly set to 0. At this time, playback starts from the start position of the target audio data.
  • the audio data is data obtained by digitizing a sound signal.
  • the process of digitizing sound signals is a process of converting continuous analog audio signals into digital audio signals to obtain audio data at a certain frequency.
  • the digitization process of a sound signal includes three steps: sampling, quantization, and encoding.
  • sampling refers to replacing a signal that is continuous in time with a sequence of signal sample values at regular time intervals.
  • Quantization refers to the use of finite amplitude approximation to indicate the amplitude value that continuously changes in time, and changes the continuous amplitude of the analog signal into a finite number of discrete values with a certain time interval.
  • Encoding means that the quantized discrete value is represented by binary digits according to a certain rule.
  • Pulse Code Modulation can realize the conversion, sampling, quantization, and encoding of analog audio signals into digital audio data. Therefore, the above-mentioned target audio data may be a data stream in a PCM encoding format, and the format of the file in which the target audio data is recorded may be a wav format. In one embodiment, the format of the file describing the target audio data may also be other formats, such as mp3 format, ape format, and the like. At this time, the above-mentioned target audio data may be data of other encoding formats (for example, lossy compression formats such as Advanced Audio Coding (AAC)), and is not limited to the PCM encoding format.
  • the above-mentioned execution body may also perform format conversion on the file in which the target audio data is recorded, convert the file into a wav format, and the target audio data in the converted file is a data stream in the PCM encoding format.
  • a video recording application can be installed in the execution body.
  • This video recording application can support the recording of soundtrack videos.
  • the above soundtrack video may be a video that plays audio data while video data is being collected.
  • the sound in the recorded soundtrack video is the sound corresponding to the audio data.
  • a singing action performed by a user is recorded, and the recorded video uses the song as background music.
  • the above video recording applications can support continuous recording and segment recording of soundtrack videos. When recording in segments, the user can first click the record button to record the first video. Then, click the recording button again to trigger the pause recording instruction. Then, click the record button again to trigger the resume recording instruction to record the second video. Then, click the recording button again to trigger the pause recording instruction. And so on.
  • the recording instruction, the recording pause instruction, and the resume recording instruction may be triggered in other ways. For example, you can record each video by long pressing the record button. When the record button is released, the pause recording instruction is triggered. I won't repeat them here.
  • Step 2020 start the video encoder and the audio player in sequence.
  • an audio player may be installed or deployed in the execution body.
  • the audio player is used to play audio data.
  • audio playback is a process of performing digital-to-analog conversion on digitized audio data and restoring the digitized audio data to an analog audio signal.
  • the above audio player may be in the form of software (for example, a certain component, a code module, etc.) or hardware, which is not limited herein.
  • the execution body may start the video encoder and the audio player in this order. That is, first start the video encoder. After the video encoder starts successfully, start the audio player. It should be noted that if the audio player is started first, and then the video encoder is started, or the audio player and video encoder are started at the same time, the target audio data may be played to the above playback progress, the video encoder has not been started successfully, As a result, the playback of the target audio data is not synchronized with the encoding of the video data. After the video encoder is successfully started, start the audio player to avoid this situation.
  • the execution body may control the start or stop of the video encoder and audio decoder.
  • Step 2030 In the case that the target audio data is played to the above playback progress, in response to the collected video data, the collected video data is transmitted to the video encoder, so that the video encoder encodes the collected video data. .
  • the collected video data may be transmitted to the video encoder, so that the video encoder may Video data is encoded. Therefore, after the target audio data is played to the above playback progress, the video data encoding is officially started, so that the audio data playback and the video data encoding are performed synchronously, and the audio and video synchronization effect during the soundtrack video recording process is improved.
  • the above-mentioned execution body may be equipped with an image acquisition device, such as a camera.
  • the execution subject may use the camera to collect video data.
  • the execution subject may delete the collected video data.
  • the execution subject may use the camera to collect video data.
  • the camera Before the foregoing step 2010 is performed, that is, before the resume recording instruction is detected, the camera may be in an on state or an off state. If the camera is on, image capture can be continuously performed, but the captured image is not transmitted to the video encoder, nor is the captured image stored, and the captured image can be discarded (that is, frame dropping processing is performed) Until the target audio data is played to the above playback progress. If the camera is turned off before the resume recording instruction is detected, the camera can be turned on for image capture after the resume recording instruction is detected. At this time, the captured frames are also discarded until the target audio data is played to the above playback progress.
  • the method for recording video may further include the steps of: in response to detecting a stop recording instruction, stopping transmitting the collected video data to the video encoder, and controlling the audio player to stop playing. After that, the video encoder is controlled to stop encoding.
  • the method for recording video may further include: first, determining a total duration of video data that the video encoder has encoded.
  • the total duration of the encoded video data is the total duration of the currently recorded video data. After that, the total duration may be determined as the final playback progress of the audio player.
  • the foregoing encoded video data includes video data recorded before step 2010.
  • the method for recording a video may further include: first, using the played target audio data indicated by the final playback progress as a target Audio data section, extracting the target audio data section.
  • the playback end position of the target audio data corresponding to the final playback progress may be determined.
  • the target audio data section is extracted by using a section formed by the playback start position and the playback end position of the target audio data as the target audio data section.
  • the encoded video data and the foregoing target audio data interval may be stored.
  • the target audio data interval and the encoded video data may be stored in two files respectively, and a mapping of the two files is established.
  • the target audio data interval and the encoded video data may also be stored in the same file.
  • the method for recording a video may further include: in response to detecting a resume recording instruction, setting a pre-established encoding identifier to a first preset value (for example, "NO", or "N", or "0" "Wait).
  • a first preset value for example, "NO", or "N", or "0" "Wait.
  • the above-mentioned first preset value may be used to instruct deletion of currently acquired video data.
  • the method for recording a video may further include: when the target audio data is played to the playback progress, setting the encoding identifier to a second preset value (for example, "YES", or "Y ", Or” 1 ", etc.).
  • the second preset value may be used to instruct transmission of the currently collected video data to the video encoder.
  • the method for recording a video may further include: in response to detecting an instruction to stop recording, setting the encoding identifier to the first preset value.
  • FIG. 3 is a schematic diagram of an application scenario of a method for recording a video provided by an embodiment of the present application.
  • a user holds a terminal device 301 and records a soundtrack video.
  • a short video recording application runs on the terminal device 301.
  • the user selects a certain soundtrack (such as the song "Little Apple") in the interface of the short video recording application to record the soundtrack video in sections.
  • the soundtrack corresponds to the target audio data 302.
  • the terminal device 301 sets the playback progress of the audio player to the duration of the video that the video encoder has encoded.
  • the video encoder and the audio player are sequentially activated.
  • the collected video data is transmitted to the video encoder to The video encoder is caused to encode the collected video data.
  • the playback progress of the audio player is set to the duration of the video encoded by the video encoder, and then the video encoder and the audio player are sequentially activated.
  • 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 video encoded by the video encoder can be set as the playback progress of the audio player, which avoids the situation that the recorded video is out of sync due to the deviation of the playback progress.
  • the video encoder is started in advance, and when the target audio data is played to the above playback progress, the collected video data is transmitted to the video encoder, which realizes the synchronization of video data encoding and audio data playback, which improves the Audio and video synchronization during soundtrack video recording.
  • FIG. 4 is a flowchart of another method for recording a video provided by an embodiment of the present application.
  • the method provided in this embodiment includes the following steps.
  • step 4010 in response to detecting the resume recording instruction, determining the duration of the video encoded by the video encoder, and setting the playback progress of the audio player to the duration.
  • a video encoder may be installed or deployed in an execution subject of the method for recording a video (for example, the terminal device 101, the terminal device 102, and the terminal device 103 shown in FIG. 1).
  • the resume recording instruction may be used to instruct to continue collecting video data and continue playing target audio data by using an audio player.
  • the execution body in response to detecting the resume recording instruction, may further set a pre-established encoding identifier to a first preset value (for example, "NO”, or "N”, or “0”, etc.).
  • a first preset value for example, "NO”, or "N”, or "0”, etc.
  • the above-mentioned first preset value may be used to instruct deletion of currently acquired video data.
  • the above-mentioned execution body may be equipped with an image acquisition device, such as a camera.
  • the execution subject may use the camera to collect video data.
  • the camera Before performing step 4010, that is, before detecting the resume recording instruction, the camera may be in a turned on state. The execution subject may continuously perform image acquisition by using the camera.
  • the captured video data that is, each frame is collected
  • the second preset value may be used to instruct transmission of the currently collected video data to the video encoder.
  • Step 4020 Start the video encoder and the audio player in sequence.
  • an audio player may be installed or deployed in the execution body.
  • the execution body may start the video encoder and the audio player in this order. That is, first start the video encoder. After the video encoder starts successfully, start the audio player.
  • Step 4030 In the case that the target audio data is played to the above playback progress, in response to the collected video data, the collected video data is transmitted to the video encoder, so that the video encoder encodes the collected video data. .
  • the collected video data may be transmitted to the video encoder, so that the video encoder may Video data is encoded. Therefore, after the target audio data is played to the above playback progress, the video data encoding is officially started, so that the audio data playback and the video data encoding are performed synchronously, so as to improve the audio and video synchronization effect during the soundtrack video recording .
  • the execution entity may further set the encoding identifier 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 4040 In response to detecting the stop recording instruction, stop transmitting the collected video data to the video encoder, and control the audio player to stop playing.
  • the execution subject in response to detecting the stop recording instruction, may stop transmitting the collected video data to the video encoder, and at the same time, control the audio player to stop playing.
  • the execution subject in response to detecting the stop recording instruction, may further set the encoding identifier to the first preset value to indicate that, in the case where video data continues to be captured, the captured image is continuously captured. Video data is discarded.
  • Step 4050 Control the video encoder to stop encoding.
  • the above-mentioned execution body may control the video encoder to stop encoding. That is, the video encoder is stopped.
  • Step 4060 Determine the total duration of the video data that the video encoder has encoded.
  • the above-mentioned execution body may determine the total duration of the video data that the video encoder has encoded.
  • the total duration of the encoded video data is the total duration of the currently recorded video data.
  • the above-mentioned encoded video data includes video data recorded before step 4010.
  • Step 4070 Determine the total duration as the final playback progress of the audio player.
  • the above-mentioned execution subject may determine the determined total duration as the final playback progress of the audio player.
  • Step 4080 Use the played target audio data indicated by the final playback progress as the target audio data interval, and extract the target audio data interval.
  • the execution subject may first determine a playback end position of the target audio data corresponding to the final playback progress. Then, the interval formed from the playback start position to the playback end position of the target audio data may be determined as the target audio data interval. Finally, the target audio data interval can be extracted.
  • Step 4090 Store the encoded video data and the target audio data interval.
  • the execution body may store the target audio data interval and the encoded video data into two files, and establish a mapping between the two files.
  • the target audio data interval and the encoded video data may also be stored in the same file.
  • the method for recording a video in this embodiment embodies an operation performed after a stop recording instruction is detected. Because in the case of stopping recording, the audio encoder is stopped from playing target audio data while the video data is stopped being transmitted to the video encoder. Therefore, synchronous stop of video encoding and audio playback is achieved. As a result, the audio and video synchronization effect during the soundtrack video recording process is further improved.
  • the method provided in this embodiment also highlights the operation of storing audio and video data. In this way, audio and video files can be generated for subsequent playback and upload.
  • FIG. 5 is a schematic structural diagram of a video recording apparatus according to an embodiment of the present application.
  • an embodiment of the present application provides a device for recording a video.
  • the device embodiment corresponds to the method embodiment shown in FIG. 2.
  • the device can be specifically applied to various electronic devices. .
  • the apparatus for recording video includes: a first setting unit 501 configured to determine a duration of a recorded video in response to detecting a resume recording instruction, and adjust a playback progress of an audio player. It is set to the above duration, wherein the above-mentioned resume recording instruction is used to instruct to continue to collect video data and continue to play target audio data by using the audio player; the starting unit 502 is configured to sequentially start the video encoder and the audio player; a transmission unit 503.
  • the target audio data is played to the playback progress, in response to the captured video data, the collected video data is transmitted to the video encoder, so that the video encoder may The video data is encoded.
  • the apparatus may further include a control unit (not shown in the figure).
  • the control unit may be configured to stop transmitting the collected video data to the video encoder in response to detecting the stop recording instruction, and control the audio player to stop playing; and control the video encoder to stop encoding.
  • the apparatus may further include a first determining unit and a second determining unit (not shown in the figure).
  • the first determining unit may be configured to determine a total duration of video data that has been encoded by the video encoder.
  • the second determining unit may be configured to determine the total duration as a final playback progress of the audio player.
  • the device may further include an extraction unit and a storage unit (not shown in the figure).
  • the extraction unit may be configured to use the played target audio data indicated by the final playback progress as a target audio data interval, and extract the target audio data interval.
  • the storage unit may be configured to store the encoded video data and the target audio data interval.
  • the device may further include a deleting 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 playback progress.
  • the apparatus may further include a second setting unit (not shown in the figure).
  • the second setting unit may be configured to set a pre-established encoding identifier to a first preset value in response to detecting a resume recording instruction, where the first preset value is used to indicate that the currently collected video data is set. delete.
  • the device may further include a third setting unit (not shown in the figure).
  • the third setting unit may be configured to set the encoding identifier to a second preset value when the target audio data is played to the playback progress, where the second preset value is used to indicate The above-mentioned video encoder transmits the currently collected video data.
  • the apparatus may further include a fourth setting unit (not shown in the figure).
  • the fourth setting unit may be configured to set the encoding identifier to the first preset value in response to detecting a recording stop instruction.
  • the device provided by the above embodiment of the present application sets the playback progress of the audio player to the duration of the recorded video by the first setting unit 501 after detecting the resume recording instruction, and then the startup unit 502 starts the video encoder and
  • the transmission unit 503 transmits the collected video data to the video encoder in response to the captured video data, so that the video encoder Encode the captured video data. Therefore, the playback progress of the audio player can be set based on the duration of the recorded video, which avoids the situation that the recorded video is out of sync due to the deviation of the playback progress.
  • the collected video data is then transmitted to the video encoder, which realizes the synchronization of video data encoding and audio data playback, which improves the recording process of the soundtrack video. Audio and video synchronization effect.
  • FIG. 6 is a flowchart of another method for recording a video provided by an embodiment of the present application.
  • the method for recording a video includes the following steps:
  • Step 210 Start the video encoder.
  • a video encoder may be installed or deployed in an execution subject of the method for recording a video (for example, the terminal device 101, the terminal device 102, and the terminal device 103 shown in FIG. 1).
  • the execution body controls start or stop of the video encoder.
  • the above-mentioned execution subject may start the above-mentioned startup video encoder to prepare a user for video recording.
  • a video encoder may be used to encode video data.
  • video encoding refers to a manner of converting a file in a certain video format into another file in a video format through a specific compression technology.
  • the video encoder may be in the form of software (for example, a component, a code module, etc.) or hardware, which is not limited herein.
  • Step 220 In response to detecting the resume recording instruction, determining a length of time that the video encoder has encoded, and setting the playback progress of the audio player to the length of time.
  • target audio data may be acquired and stored in the execution body in advance.
  • the above-mentioned target audio data may be audio data specified in advance by the user as a soundtrack of the video, for example, audio data corresponding to a specified song.
  • the duration of the video encoded by the video encoder may be determined, and the playback progress of the audio player is set to the duration.
  • the resume recording instruction may be used to instruct to continue collecting video data and continue playing target audio data by using an audio player.
  • the execution subject before the trigger of the resume recording instruction, the execution subject may store a pre-recorded and unrecorded video.
  • the pre-recorded video has been encoded by a video encoder.
  • the execution body may determine the duration of the video that the video encoder has encoded.
  • the duration of the video encoded by the video encoder can be determined in the following manner: first, determine the start time and stop time of the data transmitted from the recording to the video encoder; , Determining the difference between the stop time and the start time as the duration of the video that the video encoder has encoded during the recording process.
  • the duration may also be regarded as the duration of the successfully recorded video. Sum the duration of the encoded video during multiple recordings to get the duration of the video encoded by the video encoder.
  • the above-mentioned executing subject may also determine the duration of the recorded video by using other methods, which will not be repeated here.
  • the audio data is data obtained by digitizing a sound signal.
  • the process of digitizing sound signals is a process of converting continuous analog audio signals into digital audio signals to obtain audio data at a certain frequency.
  • the digitization process of a sound signal includes three steps: sampling, quantization, and encoding.
  • sampling refers to replacing a signal that is continuous in time with a sequence of signal sample values at regular time intervals.
  • Quantization refers to the use of finite amplitude approximation to indicate the amplitude value that continuously changes in time, and changes the continuous amplitude of the analog signal into a finite number of discrete values with a certain time interval.
  • Encoding means that the quantized discrete value is represented by binary digits according to a certain rule.
  • the PCM can realize the conversion of the analog audio signal into digital audio data through sampling, quantization, and encoding. Therefore, the above-mentioned target audio data may be a data stream in a PCM encoding format, and the format of the file in which the target audio data is recorded may be a wav format. In one embodiment, the format of the file describing the target audio data may also be other formats, such as mp3 format, ape format, and the like. At this time, the above-mentioned target audio data may be data of other encoding formats (for example, a lossy compression format such as AAC), and is not limited to the PCM encoding format.
  • the above-mentioned execution body may also perform format conversion on the file in which the target audio data is recorded, convert the file into a record wav format, and the target audio file in the converted file is a data stream in the PCM encoding format.
  • a video recording application can be installed in the execution body.
  • This video recording application can support the recording of soundtrack videos.
  • the above soundtrack video may be a video that plays audio data while video data is being collected.
  • the sound in the recorded soundtrack video is the sound corresponding to the audio data.
  • a singing action performed by a user is recorded, and the recorded video uses the song as background music.
  • the above video recording applications can support continuous recording and segment recording of soundtrack videos.
  • the user can first click the recording button to record the first video. Then, click the recording button again to trigger the pause recording instruction. Then, click the record button again to trigger the resume recording instruction to record the second video. Then, click the recording button again to trigger the pause recording instruction. And so on.
  • the recording instruction, the recording pause instruction, and the resume recording instruction may be triggered in other ways. For example, you can record each video by long pressing the record button. When the record button is released, the pause recording instruction is triggered. I won't repeat them here.
  • Step 230 Start the audio player.
  • an audio player may be installed or deployed in the execution body.
  • the audio player is used to play audio data.
  • audio playback is a process of performing digital-to-analog conversion on digitized audio data and restoring the digitized audio data to an analog audio signal.
  • the foregoing video encoder and audio player may be in the form of software (for example, a certain component, a code module, etc.) or hardware, which is not limited herein.
  • the above-mentioned execution body may start the audio player.
  • the execution body may control the start or stop of the audio decoder.
  • Step 240 In the case that the target audio data is played to the above playback progress, in response to the collected video data, the collected video data is transmitted to the video encoder, so that the video encoder encodes the collected video data. .
  • the collected video data may be transmitted to the video encoder, so that the video encoder may Video data is encoded. Therefore, after the target audio data is played to the above playback progress, the video data encoding is officially started, so that the audio data playback and the video data encoding are performed synchronously, and the audio and video synchronization effect during the soundtrack video recording process is improved.
  • the above-mentioned execution body may be equipped with an image acquisition device, such as a camera.
  • the execution subject may use the camera to collect video data.
  • the execution subject may delete the collected video data.
  • the execution subject may use the camera to collect video data.
  • the camera Before step 2010 is performed, that is, before the resume recording instruction is detected, the camera may be in an on state or an off state. If the camera is on, image capture can be continuously performed, but the captured image is not transmitted to the video encoder, nor is the captured image stored, and the captured image can be discarded (that is, frame dropping processing is performed) Until the target audio data is played to the above playback progress. If the camera is turned off before the resume recording instruction is detected, the camera can be turned on for image capture after the resume recording instruction is detected. At this time, the captured frames are also discarded until the target audio data is played to the above playback progress.
  • the method for recording video may further include the steps of: in response to detecting a stop recording instruction, stopping transmitting the collected video data to the video encoder, and controlling the audio player to stop playing. After that, the video encoder is controlled to stop encoding.
  • the method for recording video may further include: first, determining a total duration of video data that the video encoder has encoded.
  • the total duration of the encoded video data is the total duration of the currently recorded video data.
  • the encoded video data includes video data recorded before step 210. After that, the total duration may be determined as the final playback progress of the audio player. Finally, the above video encoder can be started.
  • the method for recording a video may further include: first, using the played target audio data indicated by the final playback progress as the The target audio data section extracts the target audio data section.
  • the playback end position of the target audio data corresponding to the final playback progress may be determined.
  • the target audio data section is extracted by using a section formed by the playback start position and the playback end position of the target audio data as the target audio data section.
  • the encoded video data and the foregoing target audio data interval may be stored.
  • the above-mentioned target audio data interval and the video data including the encoded data may be stored into two files respectively, and a mapping of the two files is established.
  • the target audio data interval and the encoded video data may also be stored in the same file.
  • the method for recording a video may further include: setting a pre-established encoding identifier to a first preset value (for example, "NO”, or "N", or "0" "Wait).
  • a first preset value for example, "NO”, or "N", or "0" "Wait.
  • the above-mentioned first preset value may be used to instruct deletion of currently acquired video data.
  • the method for recording a video may further include: when the target audio data is played to the playback progress, setting the encoding identifier to a second preset value (for example, "YES", or "Y ", Or” 1 ", etc.).
  • the second preset value may be used to instruct transmission of the currently collected video data to the video encoder.
  • the method for recording a video may further include: in response to detecting an instruction to stop recording, setting the encoding identifier to the first preset value.
  • a user holds a terminal device 301 to record a soundtrack video.
  • a short video recording application runs on the terminal device 301.
  • the user selects a certain soundtrack (such as the song "Little Apple") in the interface of the short video recording application to record the soundtrack video in sections.
  • the soundtrack corresponds to the target audio data 302.
  • the terminal device 301 first starts the video encoder to prepare for the next recording by the user.
  • the resume recording instruction was triggered.
  • the terminal device 301 sets the playback progress of the audio player to the duration of the encoded video.
  • the audio player is started, and when the target audio data is played to the playback progress, in response to the collected video data 303, the collected video data is transmitted to the video encoder, so that the video encoder can The captured video data is encoded.
  • the video encoder by activating a video encoder, after detecting a resume recording instruction, setting the playback progress of the audio player to the duration of the encoded video, and then starting the audio player to target audio data
  • the collected video data in response to the collected video data, the collected video data is transmitted to the video encoder, so that the video encoder encodes the collected video data. Therefore, the length of the encoded video can be set as the playback progress of the audio player, and the situation that the recorded video is out of sync due to the deviation of the playback progress can be avoided.
  • the video encoder is started in advance.
  • the startup operation of the video encoder may not be performed, so that the complexity of the operations performed after the recording is resumed is reduced, and the efficiency of responding to the recording resume instruction triggered by the user is improved.
  • the collected video data is then transmitted to the video encoder, which realizes the synchronization of video data encoding and audio data playback, which improves the recording process of the soundtrack video Audio and video synchronization effect.
  • FIG. 7 is a flowchart of another method for recording a video provided by an embodiment of the present application.
  • the method provided in this embodiment includes the following steps.
  • Step 410 Start the video encoder.
  • a video encoder may be installed or deployed in an execution subject of the method for recording a video (for example, the terminal device 101, the terminal device 102, and the terminal device 103 shown in FIG. 1).
  • the execution body controls start or stop of the video encoder.
  • the execution body may start the startup video encoder.
  • the above-mentioned execution body may also set a pre-established encoding identifier to a first preset value (for example, “NO”, or “N”, or “0”, etc.).
  • a first preset value for example, “NO”, or “N”, or “0”, etc.
  • the above-mentioned first preset value may be used to instruct deletion of currently acquired video data.
  • the above-mentioned execution body may be equipped with an image acquisition device, such as a camera.
  • the execution subject may use the camera to collect video data.
  • the camera Before the foregoing step 410 is performed, that is, before the video encoder is started, the camera may be in a turned-on state.
  • the execution subject may continuously perform image acquisition by using the camera.
  • it In response to acquiring video data (that is, each frame is acquired), it may be determined whether the value of the current encoding identifier is the above-mentioned first preset value.
  • the currently collected video data may be deleted (that is, frame dropping processing is performed) until it is determined that the value of the encoding identifier is the second preset value (for example, " YES “, or” Y “, or” 1 ", etc.).
  • the second preset value may be used to instruct transmission of the currently collected video data to the video encoder.
  • Step 420 In response to detecting the resume recording instruction, determine the duration of the video that the video encoder has encoded, and set the playback progress of the audio player to the duration.
  • the execution subject in response to detecting the resume recording instruction, may determine the duration of the video encoded by the video encoder, and set the playback progress of the audio player to the duration.
  • the resume recording instruction may be used to instruct to continue collecting video data and continue playing target audio data by using an audio player.
  • Step 430 Start the audio player.
  • an audio player may be installed or deployed in the execution body.
  • the audio player is used to play audio data.
  • the above-mentioned execution body may start the audio player.
  • the execution body may control the start or stop of the audio decoder.
  • Step 440 In the case that the target audio data is played to the above playback progress, in response to the collected video data, the collected video data is transmitted to the video encoder, so that the video encoder encodes the collected video data. .
  • the collected video data may be transmitted to the video encoder, so that the video encoder may Video data is encoded. Therefore, after the target audio data is played to the above playback progress, the video data encoding is officially started, so that the audio data playback and the video data encoding are performed synchronously, so as to improve the audio and video synchronization effect during the soundtrack video recording process. .
  • the execution entity may further set the encoding identifier 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 450 In response to detecting the stop recording instruction, stop transmitting the collected video data to the video encoder, and control the audio player to stop playing.
  • the execution subject in response to detecting the stop recording instruction, may stop transmitting the collected video data to the video encoder, and at the same time, control the audio player to stop playing.
  • the execution subject in response to detecting the stop recording instruction, may further set the encoding identifier to the first preset value to indicate that, in the case where video data continues to be captured, the captured image is continuously captured. Video data is discarded.
  • Step 460 Control the video encoder to stop encoding.
  • the above-mentioned execution body may control the video encoder to stop encoding. That is, the video encoder is stopped.
  • Step 470 Determine the total duration of the video data that the video encoder has encoded.
  • the execution subject may determine the total duration of video data that the video encoder has encoded.
  • the encoded video data includes video data recorded before step 410.
  • Step 480 Determine the total duration as the final playback progress of the audio player.
  • the execution entity may determine the determined total duration as the final playback progress of the audio player.
  • Step 490 Start the video encoder.
  • the above-mentioned execution body may restart the video encoder after determining the final playback progress of the audio player, so as to record the next video.
  • Step 4100 Use the played target audio data indicated by the final playback progress as the target audio data interval, and extract the target audio data interval.
  • the execution subject may first determine a playback end position of the target audio data corresponding to the final playback progress. Then, the interval formed from the playback start position to the playback end position of the target audio data may be determined as the target audio data interval. Finally, the target audio data interval can be extracted.
  • Step 4110 Store the encoded video data and the target audio data interval.
  • the execution body may store the target audio data interval and the encoded video data into two files, and establish a mapping between the two files.
  • the target audio data interval and the encoded video data may also be stored in the same file.
  • the method for recording a video in this embodiment embodies an operation performed after a stop recording instruction is detected. Because in the case of stopping recording, the audio encoder is stopped from playing target audio data while the video data is stopped being transmitted to the video encoder. Therefore, synchronous stop of video encoding and audio playback is achieved. As a result, the audio and video synchronization effect during the soundtrack video recording process is further improved.
  • the method provided in this embodiment also highlights the operation of storing audio and video data. In this way, audio and video files can be generated for subsequent playback and upload.
  • FIG. 8 is a schematic structural diagram of another apparatus for recording video according to an embodiment of the present application.
  • an embodiment of the present application provides a device for recording a video.
  • the device embodiment corresponds to the method embodiment shown in FIG. 6.
  • the device can be applied to various electronic devices. .
  • the apparatus for recording video includes: a first startup unit 510 configured to start a video encoder; and a first setting unit 520 configured to determine, in response to detecting a resume recording instruction, determining The duration of the recorded video is set to the playback progress of the audio player as the above duration, wherein the resume recording instruction is used to instruct to continue to collect video data and continue to play target audio data using the audio player; the second startup unit 530, And configured to start the audio player; and the transmission unit 540 is configured to transmit the collected video data to the video encoder in response to the captured video data when the target audio data is played to the playback progress. To enable the video encoder to encode the collected video data.
  • the apparatus may further include a control unit (not shown in the figure).
  • the control unit may be configured to stop transmitting the collected video data to the video encoder in response to detecting the stop recording instruction, and control the audio player to stop playing; and control the video encoder to stop encoding.
  • the device may further include a first determination unit, a second determination unit, and a third activation unit (not shown in the figure).
  • the first determining unit may be configured to determine a total duration of video data that has been encoded by the video encoder.
  • the second determining unit may be configured to determine the total duration as a final playback progress of the audio player.
  • the third starting unit may be configured to start the video encoder.
  • the device may further include an extraction unit and a storage unit (not shown in the figure).
  • the extraction unit may be configured to use the played target audio data indicated by the final playback progress as a target audio data interval, and extract the target audio data interval.
  • the storage unit may be configured to store the encoded video data and the target audio data interval.
  • the device may further include a deleting 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 playback progress.
  • the apparatus may further include a second setting unit (not shown in the figure).
  • the second setting unit may be configured to set a pre-established encoding identifier to a first preset value before starting the video encoder, where the first preset value is used to instruct deletion of currently collected video data. .
  • the device may further include a third setting unit (not shown in the figure).
  • the third setting unit may be configured to set the encoding identifier to a second preset value when the target audio data is played to the playback progress, where the second preset value is used to indicate The above-mentioned video encoder transmits the currently collected video data.
  • the apparatus may further include a fourth setting unit (not shown in the figure).
  • the fourth setting unit may be configured to set the encoding identifier to the first preset value in response to detecting a recording stop instruction.
  • the device provided by the foregoing embodiment of the present application starts the video encoder through the first startup unit 510, and the first setting unit 520 sets the playback progress of the audio player to the duration of the encoded video after detecting the resume recording instruction, Then the second startup unit 530 starts the audio player. Finally, in the case that the target audio data is determined to be played to the above playback progress, in response to the captured video data, the collected video data is transmitted to the video encoder to Make the video encoder encode the collected video data. Therefore, the duration of the encoded video can be set as the playback progress of the audio player, and the situation that the recorded video is out of sync due to the deviation of the playback progress can be avoided.
  • starting the video encoder in advance can reduce the complexity of operations performed after resuming recording.
  • the collected video data is transmitted to the video encoder, which realizes the synchronization of video data encoding and audio data playback, and improves the audio and video during the soundtrack video recording process. Sync effect.
  • FIG. 9 is a schematic structural diagram of a computer system of a terminal device according to an embodiment of the present application.
  • the terminal device shown in FIG. 9 is only an example, and should not impose any limitation on the functions and scope of use of the embodiments of the present application.
  • the computer system 600 includes a central processing unit (CPU) 601, and the CPU 01 can be loaded to a random computer according to a program stored in a read-only memory (ROM) 602 or from a storage portion 608
  • ROM read-only memory
  • RAM Random Access Memory
  • a program in the Random Access Memory (RAM) 603 is accessed to perform a variety of appropriate actions and processes.
  • RAM Random Access Memory
  • various programs and data required for the operation of the system 600 are also stored.
  • the CPU 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604.
  • An input / output (I / O) interface 605 is also connected to the bus 604.
  • the following components are connected to the I / O interface 605: an input portion 606 including a keyboard, a mouse, etc .; an output portion 607 such as a liquid crystal display (LCD), and a speaker; a storage portion 608 including a hard disk; A communication portion 609 of a network interface card such as a local area network (LAN) card, a modem, or the like.
  • the communication section 609 performs communication processing via a network such as the Internet.
  • the driver 610 is also connected to the I / O interface 605 as necessary.
  • a removable medium 611 such as a semiconductor memory, is installed on the drive 610 as needed, so that a computer program that the drive 10 reads from the removable medium 611 is installed into the storage section 608 as needed.
  • the process described above with reference to the flowchart may be implemented as a computer software program.
  • embodiments of the present disclosure include a computer program product including a computer program borne on a computer-readable medium, the computer program containing program code for performing a method shown in a flowchart.
  • the computer program may be downloaded and installed from a network through the communication portion 609, and / or installed from a removable medium 611.
  • the computer-readable medium described in this application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the foregoing.
  • the 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 thereof.
  • the computer-readable storage medium may include, but is not limited to, an electrical connection with one or more wires, a portable computer diskette, a hard disk, a RAM, a ROM, an erasable programmable read-only memory (EPROM), or Flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the foregoing.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in combination with an instruction execution system, apparatus, or device.
  • the computer-readable signal medium may include a data signal that is transmitted in baseband or transmitted as part of a carrier wave, and the data signal carries computer-readable program code.
  • a propagated data signal may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, and the computer-readable medium may send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device .
  • the program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, radio frequency (RF), or any suitable combination of the foregoing.
  • RF radio frequency
  • each block in the flowchart or block diagram may represent a module, a program segment, or a part of code, which contains one or more functions to implement a specified logical function Executable instructions.
  • each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts can be implemented by a dedicated hardware-based system that performs the specified function or operation , Or it can be implemented with a combination of dedicated hardware and computer instructions.
  • the units described in the embodiments of the present application may be implemented by software or hardware.
  • the described unit may also be provided in a processor, for example, it may be described as: a processor includes a setting unit, a startup unit, and a transmission unit.
  • the names of these units do not constitute a limitation on the unit itself in some cases.
  • the setting unit may also be described as a "unit for setting the playback progress of a music player".
  • a processor includes a first startup unit, a setting unit, a second startup unit, and a transmission unit. Among them, the names of these units do not constitute a limitation on the unit itself in some cases.
  • the first startup unit may also be described as a “unit that starts a video encoder”.
  • the present application also provides a computer-readable medium, which may be included in the device described in the foregoing embodiments; or may exist alone without being assembled into the device.
  • the computer-readable medium carries one or more programs, and when the one or more programs are executed by the device, the device is caused to: in response to detecting a resume recording instruction, determine a duration of a video encoded by a video encoder, and The playback progress of the audio player is set to this duration, where the resume recording instruction is used to instruct continued acquisition of video data and use the audio player to continue playing target audio data; start the video encoder and the audio player in sequence; in the When the target audio data is played to the playback progress, in response to the collected video data, the collected video data is transmitted to the video encoder, so that the video encoder encodes the collected video data; or So that the device: starts the video encoder; determines the duration of the recorded video in response to detecting the resume recording instruction, and sets the playback progress of the audio player to the duration, wherein the resume recording instruction is used

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

本申请提供一种录制视频的方法和装置。该录制视频的方法包括:响应于检测到恢复录制指令,确定视频编码器已编码的视频的时长,将音频播放器的播放进度设置为该时长,其中,恢复录制指令用于指示继续采集视频数据并利用音频播放器继续播放目标音频数据;启动音频播放器;其中,视频编码器在启动音频播放器之前启动;在目标音频数据被播放至该播放进度的情况下,响应于采集到视频数据,向视频编码器传输所采集到的视频数据,以使视频编码器对所采集到的视频数据进行编码。

Description

录制视频的方法和装置
本申请要求在2018年08月01日提交中国专利局、申请号为201810865723.6的中国专利申请以及在2018年08月01日提交中国专利局、申请号为201810865722.1的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本申请实施例涉及计算机技术领域,例如涉及录制视频的方法和装置。
背景技术
录制配乐视频时,通常在利用摄像头进行视频采集的同时进行音频(配乐)播放。例如,播放某歌曲过程中录制用户表演的演唱动作,所录制的视频以该歌曲为背景音乐。在具有视频录制功能的应用中,录制的配乐视频出现音视频不同步的情况较为常见。
对配乐视频进行分段录制时,相关的方式通常是在检测到恢复录制指令之后,同时开启视频编码器和音频播放器,利用视频编码器进行视频数据的编码,利用音频播放器继续进行音频数据的播放。
发明内容
本申请实施例提出了录制视频的方法和装置。
本申请实施例提供了一种录制视频的方法,该方法包括:响应于检测到恢复录制指令,确定视频编码器已编码的视频的时长,将音频播放器的播放进度设置为上述时长,其中,恢复录制指令用于指示继续采集视频数据并利用音频播放器继续播放目标音频数据;启动音频播放器;其中,视频编码器在启动音频播放器之前启动;在目标音频数据被播放至播放进度的情况下,响应于采集到视频数据,向视频编码器传输所采集到的视频数据,以使视频编码器对所采集到的视频数据进行编码。
本申请实施例还提供了一种录制视频的装置,该装置包括:设置单元,被配置成响应于检测到恢复录制指令,确定视频编码器已编码的视频的时长,将音频播放器的播放进度设置为上述时长,其中,恢复录制指令用于指示继续采集视频数据并利用音频播放器继续播放目标音频数据;第一启动单元,被配置成启动音频播放器;传输单元,被配置成在目标音频数据被播放至播放进度的 情况下,响应于采集到视频数据,向视频编码器传输所采集到的视频数据,以使视频编码器对所采集到的视频数据进行编码;第二启动单元被配置成在启动音频播放器之前,启动视频编码器。
本申请实施例还提供了一种终端设备,包括:一个或多个处理器;存储装置,被配置成存储有一个或多个程序,当一个或多个程序被一个或多个处理器执行,使得一个或多个处理器实现如任一实施例提供的录制视频的方法。
本申请实施例还提供了一种计算机可读介质,计算机可读介质上存储有计算机程序,该程序被处理器执行时实现如任一实施例提供的录制视频的方法。
附图说明
图1是本申请实施例提供的一种系统架构图;
图2是本申请实施例提供的一种录制视频的方法的流程图;
图3是本申请实施例提供的一种录制视频的方法的应用场景的示意图;
图4是本申请实施例提供的另一种录制视频的方法的流程图;
图5是本申请实施例提供的一种录制视频的装置的结构示意图;
图6是本申请实施例提供的另一种录制视频的方法的流程图;
图7是本申请实施例提供的另一种录制视频的方法的流程图;
图8是本申请实施例提供的另一种录制视频的装置的结构示意图;
图9是本申请实施例提供的一种终端设备的计算机系统的结构示意图。
具体实施方式
下面结合附图和实施例对本申请进行说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本申请,而非对本申请的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本申请相关的部分。
下面将参考附图并结合实施例来说明本申请。
图1是本申请实施例提供的一种系统架构图。图1示出了可以应用本申请的录制视频的方法或录制视频的装置的示例性系统架构100。
如图1所示,系统架构100可以包括终端设备101、终端设备102、终端设备103、网络104和服务器105。网络104用以在终端设备101、终端设备102、终端设备103和服务器105之间提供通信链路的介质。网络104可以包括任意种连接类型的网络,例如有线、无线通信链路或者光纤电缆等等。
用户可以使用终端设备101、终端设备102、终端设备103通过网络104与服务器105交互,以接收或发送消息(例如音视频数据上传请求、音频数据获取请求)等。终端设备101、终端设备102、终端设备103上可以安装有多种通讯客户端应用,例如视频录制类应用、音频播放类应用、视频编码类应用即时通信工具、邮箱客户端、社交平台软件等。
终端设备101、终端设备102、终端设备103可以是硬件,也可以是软件。当终端设备101、终端设备102、终端设备103为硬件时,可以是具有显示屏并且可实现视频录制和音频播放的多种电子设备,包括但不限于智能手机、平板电脑、膝上型便携计算机和台式计算机等等。当终端设备101、终端设备102、终端设备103为软件时,终端设备101、终端设备102、终端设备103可以安装在上述所列举的电子设备中。终端设备101、终端设备102、终端设备103可以实现成多个软件或软件模块(例如用来提供分布式服务),也可以实现成单个软件或软件模块。在此不做具体限定。
终端设备101、终端设备102、终端设备103可以安装有图像采集装置(例如摄像头),以采集视频数据。在一实施例中,组成视频的最小视觉单位是帧(Frame)。每一帧是一幅静态的图像。将时间上连续的帧序列合成到一起便形成动态视频。在一实施例中,终端设备101、终端设备102、终端设备103也可以安装有被配置配置成将电信号转换为声音的装置(例如扬声器),以播放声音。在一实施例中,音频数据是以一定的频率对模拟音频信号进行模数转换(Analogue-to-Digital Conversion,ADC)后所得到的数据。音频数据的播放,是将数字音频信号进行数模转换,还原为模拟音频信号,再将模拟音频信号(模拟音频信号为电信号)转化为声音进行输出的过程。
终端设备101、终端设备102、终端设备103可以利用安装于其上的图像采集装置(例如摄像头)进行视频数据的采集,并且,可以利用安装于其上的视频编码器进行视频数据的编码。在一实施例中,终端设备101、终端设备102、终端设备103还可以利用安装于其上的音频播放器进行音频数据的播放。终端设备101、终端设备102、终端设备103可以对视频编码器、音频播放器等进行控制、设置等。
服务器105可以是提供多种服务的服务器,例如对终端设备101、终端设备102、终端设备103上所安装的视频录制类应用提供支持的后台服务器。后台服务器可以对所接收到的音视频数据上传请求等数据进行解析、存储等处理。后台服务器还可以接收终端设备101、终端设备102、终端设备103所发送的音视频数据获取请求,并将该音视频数据获取请求所指示的音视频数据反馈至终端设备101、终端设备102、终端设备103。
在一实施例中,服务器105可以是硬件,也可以是软件。当服务器105为硬件时,可以实现成多个服务器组成的分布式服务器集群,也可以实现成单个服务器。当服务器105为软件时,可以实现成多个软件或软件模块(例如用来提供分布式服务),也可以实现成单个软件或软件模块。在此不做具体限定。
在本实施例中,本申请实施例所提供的录制视频的方法一般由终端设备101、终端设备102、终端设备103执行,相应地,录制视频的装置一般设置于终端设备101、终端设备102、终端设备103中。
应该理解,图1中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。
继续参见图2,图2是本申请实施例提供的一种录制视频的方法的流程图。该录制视频的方法,包括以下步骤。
步骤2010,响应于检测到恢复录制指令,确定视频编码器已编码的视频的时长,将音频播放器的播放进度设置为该时长。
在本实施例中,录制视频的方法的执行主体(例如图1所示的终端设备101、终端设备102、终端设备103)可以预先获取并存储有目标音频数据。在一实施例中,上述目标音频数据可以是用户预先指定作为视频的配乐的音频数据(voice data),例如某个指定歌曲对应的音频数据。上述执行主体中可以安装或部署有视频编码器。在一实施例中,上述视频编码器可以用于对视频数据进行编码。在本实施例中,视频编码是指通过特定的压缩技术,将某个视频格式的文件转换成另一种视频格式文件的方式。上述视频编码器可以是软件(例如某个组件、代码模块等)或者硬件的形式,此处不作限定。
响应于检测到恢复录制指令,可以确定视频编码器已编码的视频的时长,将音频播放器的播放进度设置为该时长。在本实施例中,恢复录制指令可以用于指示继续采集视频数据并利用音频播放器继续播放目标音频数据。在一实施例中,在恢复录制指令触发之前,上述执行主体可以存储有预先录制的且未录制完成的视频。在本实施例中,预先录制的视频已经过视频编码器编码。上述执行主体可以确定视频编码器已编码的视频的时长。在一实施例中,在每一次录制过程中,经过视频编码器编码的视频的时长,可以通过如下方式确定:首先,确定该次录制向视频编码器传输数据的起始时间和停止时间;之后,将该停止时间与该起始时间的差值确定为视频编码器在该次录制过程中已编码的视频的时长。在一实施例中,该时长也可以看作该次已录制成功的视频的时长。将多次录制过程中已编码的视频的时长求和,即可得到视频编码器已编码的视 频的时长。
在一实施例中,上述执行主体还可以使用其他方法确定已录制的视频的时长,此处不再赘述。
在一实施例中,若上述执行主体中未存储有预先录制且未录制完成的视频,即,本次录制为首段视频录制,则可以直接将播放进度设置为0。此时,从目标音频数据的起始位置开始播放。
在一实施例中,音频数据是对声音信号进行数字化后的数据。声音信号的数字化过程是以一定的频率将连续的模拟音频信号转换成数字音频信号得到音频数据的过程。通常,声音信号的数字化过程包含采样、量化和编码三个步骤。其中,采样是指用每隔一定时间间隔的信号样本值序列来代替原来在时间上连续的信号。量化是指用有限幅度近似表示原来在时间上连续变化的幅度值,把模拟信号的连续幅度变为有限数量、有一定时间间隔的离散值。编码则是指按照一定的规律,把量化后的离散值用二进制数码表示。在一实施例中,脉冲编码调制(Pulse Code Modulation,PCM)可以实现将模拟音频信号经过采样、量化、编码转换成数字化的音频数据。因此,上述目标音频数据可以是PCM编码格式的数据流,记载目标音频数据的文件的格式可以是wav格式。在一实施例中,记载上述目标音频数据的文件的格式还可以是其他格式,例如mp3格式、ape格式等。此时,上述目标音频数据可以是其他编码格式(例如高级音频编码(Advanced Audio Coding,AAC)等有损压缩格式)的数据,不限于PCM编码格式。上述执行主体也可对记载有目标音频数据的文件进行格式转换,将该文件转换为wav格式,转换后的文件中的目标音频数据则为PCM编码格式的数据流。
通常,上述执行主体中可以安装有视频录制类应用。该视频录制类应用可以支持配乐视频的录制。上述配乐视频可以是在视频数据采集的同时进行音频数据播放的视频。所录制的配乐视频中的声音为该音频数据对应的声音。例如,播放某歌曲过程中录制用户表演的演唱动作,所录制的视频以该歌曲为背景音乐。上述视频录制类应用可以支持配乐视频的连续录制和分段录制。在分段录制时,用户可以首先点击录制按键,进行第一段视频的录制。接着,再次点击录制按键,触发暂停录制指令。接着,再次点击录制按键,触发恢复录制指令,以进行第二段视频的录制。接着,再次点击录制按键,触发暂停录制指令。以此类推。在一实施例中,还可以通过其他方式触发录制指令、暂停录制指令以及恢复录制指令。例如,可以通过长按录制按键进行每段视频的录制。当松开录制按键时,触发暂停录制指令。此处不再赘述。
步骤2020,依次启动视频编码器和音频播放器。
在本实施例中,上述执行主体中可以安装或部署有音频播放器。在本实施例中,上述音频播放器用于进行音频数据的播放。在本实施例中,音频播放,是将数字化的音频数据进行数模转换,将数字化的音频数据还原为模拟音频信号的过程。上述音频播放器可以是软件(例如某个组件、代码模块等)或者硬件的形式,此处不作限定。
在本实施例中,在执行步骤2010之后,上述执行主体可以依次启动视频编码器和音频播放器。即,首先启动视频编码器。在视频编码器启动成功后,启动音频播放器。需要说明的是,若先启动音频播放器,后启动视频编码器,或者,同时启动音频播放器和视频编码器,可能导致目标音频数据被播放至上述播放进度时,视频编码器尚未启动成功,从而造成目标音频数据的播放与视频数据的编码不同步。而在视频编码器启动成功后,启动音频播放器,可以避免此情况出现。在本实施例中,上述执行主体可以控制上述视频编码器、音频解码器的启动或停止。
步骤2030,在目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据,向视频编码器传输所采集到的视频数据,以使视频编码器对所采集到的视频数据进行编码。
在本实施例中,在目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据,可以向视频编码器传输所采集到的视频数据,以使视频编码器对所采集到的视频数据进行编码。由此,可以在目标音频数据被播放至上述播放进度后,正式开始进行视频数据的编码,从而实现音频数据的播放与视频数据的编码同步进行,提升配乐视频录制过程中的音视频同步效果。
在一实施例中,上述执行主体可以安装有图像采集装置,例如摄像头。上述执行主体可以利用上述摄像头进行视频数据的采集。
在一实施例中,在目标音频数据被播放至所述播放进度之前,响应于采集到视频数据,上述执行主体可以将所采集到的视频数据删除。在一实施例中,上述执行主体可以利用上述摄像头进行视频数据的采集。上述在步骤2010执行之前,即在检测到恢复录制指令之前,摄像头可以处于开启状态或者关闭状态。若摄像头处于开启状态,可以持续进行图像捕捉,但并不将所捕捉的图像传输至视频编码器,也不对所捕捉的图像进行存储,可以将所捕捉的图像丢弃(即,进行丢帧处理),直至目标音频数据被播放至上述播放进度。若在检测到恢复录制指令之前,摄像头处于关闭状态,则可以在检测到恢复录制指令之后,开启摄像头进行图像捕捉。此时,也将所捕捉的帧进行丢弃,直至目标音频数据被播放至上述播放进度。
在一实施例中,上述录制视频的方法还可以包括如下步骤:响应于检测到 停止录制指令,停止向上述视频编码器传输所采集到的视频数据,并控制上述音频播放器停止播放。之后,控制上述视频编码器停止编码。
在一实施例中,在上述控制上述视频编码器停止编码之后,上述录制视频的方法还可以包括:首先,确定上述视频编码器已编码的视频数据的总时长。在本实施例中,已编码的视频数据的总时长即为当前已录制的视频数据的总时长。之后,可以将上述总时长确定为上述音频播放器的最终播放进度。在本实施例中,上述已编码的视频数据,包括步骤2010前已录制的视频数据。
在一实施例中,在上述将总时长确定为上述音频播放器的最终播放进度之后,上述录制视频的方法还可以包括:首先,将上述最终播放进度所指示的已播放的目标音频数据作为目标音频数据区间,提取上述目标音频数据区间。在本实施例中,可以确定最终播放进度所对应的目标音频数据的播放结束位置。将目标音频数据的播放起始位置到播放结束位置所构成的区间作为目标音频数据区间,对目标音频数据区间进行提取。之后,可以将已编码的视频数据和上述目标音频数据区间进行存储。在一实施例中,可以将上述目标音频数据区间和已编码的视频数据分别存储至两个文件中,并建立上述两个文件的映射。在一实施例中,也可以将上述目标音频数据区间和已编码的视频数据存储至同一个文件中。
在一实施例中,上述录制视频的方法还可以包括:响应于检测到恢复录制指令,将预先建立的编码标识设置为第一预设值(例如“NO”,或者“N”,或者“0”等)。在本实施例中,上述第一预设值可以用于指示将当前采集的视频数据删除。
在一实施例中,上述录制视频的方法还可以包括:在上述目标音频数据被播放至上述播放进度的情况下,将上述编码标识设置为第二预设值(例如“YES”,或者“Y”,或者“1”等)。在本实施例中,上述第二预设值可以用于指示向上述视频编码器传输当前采集的视频数据。
在一实施例中,上述录制视频的方法还可以包括:响应于检测到停止录制指令,将上述编码标识设置为上述第一预设值。
继续参见图3,图3是本申请实施例提供的一种录制视频的方法的应用场景的示意图。在图3的应用场景中,用户手持终端设备301,进行配乐视频的录制。终端设备301中运行有短视频录制类应用。用户在该短视频录制类应用的界面中选择了某个配乐(例如歌曲《小苹果》),进行分段录制配乐视频。该配乐对应有目标音频数据302。在某一分段视频录制完成后,用户点击了配乐视频录 制按键之后,触发了恢复录制指令。在检测到该恢复录制指令之后,终端设备301将音频播放器的播放进度设置为视频编码器已编码的视频的时长。而后,依次启动上述视频编码器和上述音频播放器,在目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据303,向上述视频编码器传输所采集到的视频数据,以使上述视频编码器对所采集到的视频数据进行编码。
本申请的上述实施例提供的方法,在检测到恢复录制指令后,将音频播放器的播放进度设置为视频编码器已编码的视频的时长,而后依次启动视频编码器和上述音频播放器,在目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据,向上述视频编码器传输所采集到的视频数据,以使上述视频编码器对所采集到的视频数据进行编码。从而,可以将视频编码器已编码的视频的时长设定为音频播放器的播放进度,避免了由于播放进度的偏差所导致所录制的视频出现音视频不同步的情况。同时,提前启动视频编码器,在目标音频数据被播放至上述播放进度的情况下,再向视频编码器传输所采集到的视频数据,实现了视频数据编码与音频数据播放的同步进行,提升了配乐视频录制过程中的音视频同步效果。
继续参见图4,图4是本申请实施例提供的另一种录制视频的方法的流程图。本实施例提供的方法包括以下步骤。
步骤4010,响应于检测到恢复录制指令,确定视频编码器已编码的视频的时长,将音频播放器的播放进度设置为该时长。
在本实施例中,录制视频的方法的执行主体(例如图1所示的终端设备101、终端设备102、终端设备103)中可以安装或部署有视频编码器。响应于检测到恢复录制指令,确定视频编码器已编码的时长,将音频播放器的播放进度设置为该时长。在本实施例中,恢复录制指令可以用于指示继续采集视频数据并利用音频播放器继续播放目标音频数据。
在本实施例中,响应于检测到恢复录制指令,上述执行主体还可以将预先建立的编码标识设置为第一预设值(例如“NO”,或者“N”,或者“0”等)。在本实施例中,上述第一预设值可以用于指示将当前采集的视频数据删除。
在本实施例中,上述执行主体可以安装有图像采集装置,例如摄像头。上述执行主体可以利用上述摄像头进行视频数据的采集。在执行步骤4010之前,即在检测到恢复录制指令之前,摄像头可以处于已开启状态。上述执行主体可以利用上述摄像头持续进行图像采集。响应于采集到视频数据(即采集到每一帧),可以确定当前的编码标识的值是否为上述第一预设值,在确定编码标识 的值为上述第一预设值的情况下,可以将当前采集的视频数据删除(即,进行丢帧处理),直至确定上述编码标识的值为第二预设值(例如“YES”,或者“Y”,或者“1”等)。在本实施例中,上述第二预设值可以用于指示向上述视频编码器传输当前采集的视频数据。
步骤4020,依次启动视频编码器和音频播放器。
在本实施例中,上述执行主体中可以安装或部署有音频播放器。上述执行主体可以依次启动视频编码器和音频播放器。即,首先启动视频编码器。在视频编码器启动成功后,启动音频播放器。
步骤4030,在目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据,向视频编码器传输所采集到的视频数据,以使视频编码器对所采集到的视频数据进行编码。
在本实施例中,在目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据,可以向视频编码器传输所采集到的视频数据,以使视频编码器对所采集到的视频数据进行编码。由此,可以在目标音频数据被播放至上述播放进度后,正式开始进行视频数据的编码,从而实现音频数据的播放与视频数据的编码同步进行,以提升配乐视频录制过程中的音视频同步效果。
在一实施例中,在上述目标音频数据被播放至上述播放进度的情况下,上述执行主体还可以将上述编码标识设置为上述第二预设值,以指示在采集到视频数据的情况下,向上述视频编码器传输当前所采集到的视频数据。
步骤4040,响应于检测到停止录制指令,停止向视频编码器传输所采集到的视频数据,并控制音频播放器停止播放。
在本实施例中,响应于检测到停止录制指令,上述执行主体可以停止向上述视频编码器传输所采集到的视频数据,同时,控制上述音频播放器停止播放。
在一实施例中,响应于检测到停止录制指令,上述执行主体还可以将上述编码标识设置为上述第一预设值,以指示在继续捕捉到视频数据的情况下,将所继续捕捉到的视频数据丢弃。
步骤4050,控制视频编码器停止编码。
在本实施例中,在停止向视频编码器传输所采集到的视频数据,并控制音频播放器停止播放之后,上述执行主体可以控制视频编码器停止编码。即,停止上述视频编码器。
步骤4060,确定视频编码器已编码的视频数据的总时长。
在本实施例中,在控制视频编码器停止编码后,上述执行主体可以确定上 述视频编码器已编码的视频数据的总时长。在本实施例中,已编码的视频数据的总时长即为当前已录制的视频数据的总时长。上述已编码的视频数据,包括步骤4010前已录制的视频数据。
步骤4070,将总时长确定为音频播放器的最终播放进度。
在本实施例中,上述执行主体可以将所确定的总时长确定为音频播放器的最终播放进度。
步骤4080,将最终播放进度所指示的已播放的目标音频数据作为目标音频数据区间,提取目标音频数据区间。
在本实施例中,上述执行主体可以首先确定最终播放进度所对应的目标音频数据的播放结束位置。而后,可以将目标音频数据的播放起始位置到播放结束位置所构成的区间确定为目标音频数据区间。最后,可以对目标音频数据区间进行提取。
步骤4090,将已编码的视频数据和目标音频数据区间进行存储。
在本实施例中,上述执行主体可以将上述目标音频数据区间和包含已编码的视频数据分别存储至两个文件中,并建立上述两个文件的映射。在一实施例中,也可以将上述目标音频数据区间和已编码的视频数据存储至同一个文件中。
从图4中可以看出,与图2对应的实施例相比,本实施例中的录制视频的方法体现了检测到停止录制指令后所执行的操作。由于在停止录制的情况下,在停止向视频编码器传输视频数据的同时停止音频编码器播放目标音频数据。因此,实现了视频编码与音频播放的同步停止。由此,进一步提升了配乐视频录制过程中的音视频同步效果。此外,本实施例提供的方法还突出了对音视频数据存储的操作。由此,可以实现音视频文件的生成,以便于后续的播放、上传等。
继续参见图5,图5是本申请实施例提供的一种录制视频的装置的结构示意图。作为对上述图所示方法的实现,本申请实施例提供了一种录制视频的装置,该装置实施例与图2所示的方法实施例相对应,该装置具体可以应用于多种电子设备中。
如图5所示,本实施例所述的录制视频的装置包括:第一设置单元501,被配置成响应于检测到恢复录制指令,确定已录制的视频的时长,将音频播放器的播放进度设置为上述时长,其中,上述恢复录制指令用于指示继续采集视频数据并利用上述音频播放器继续播放目标音频数据;启动单元502,被配置成依次启动视频编码器和上述音频播放器;传输单元503,被配置成在上述目标音频 数据被播放至上述播放进度的情况下,响应于采集到视频数据,向上述视频编码器传输所采集到的视频数据,以使上述视频编码器对所采集到的视频数据进行编码。
在一实施例中,该装置还可以包括控制单元(图中未示出)。其中,上述控制单元可以被配置成响应于检测到停止录制指令,停止向上述视频编码器传输所采集到的视频数据,并控制上述音频播放器停止播放;控制上述视频编码器停止编码。
在一实施例中,该装置还可以包括第一确定单元和第二确定单元(图中未示出)。其中,上述第一确定单元可以被配置成确定上述视频编码器已编码的视频数据的总时长。上述第二确定单元可以被配置成将上述总时长确定为上述音频播放器的最终播放进度。
在一实施例中,该装置还可以包括提取单元和存储单元(图中未示出)。其中,上述提取单元可以被配置成将上述最终播放进度所指示的已播放的目标音频数据作为目标音频数据区间,提取上述目标音频数据区间。上述存储单元可以被配置成将已编码的视频数据和上述目标音频数据区间进行存储。
在一实施例中,该装置还可以包括删除单元(图中未示出)。其中,上述删除单元可以被配置成在目标音频数据被播放至播放进度之前,响应于采集到视频数据,将所采集到的视频数据删除。
在一实施例中,该装置还可以包括第二设置单元(图中未示出)。其中,上述第二设置单元可以被配置成响应于检测到恢复录制指令,将预先建立的编码标识设置为第一预设值,其中,上述第一预设值用于指示将当前采集的视频数据删除。
在一实施例中,该装置还可以包括第三设置单元(图中未示出)。其中,上述第三设置单元可以被配置成在上述目标音频数据被播放至上述播放进度的情况下,将上述编码标识设置为第二预设值,其中,上述第二预设值用于指示向上述视频编码器传输当前采集的视频数据。
在一实施例中,该装置还可以包括第四设置单元(图中未示出)。其中,上述第四设置单元可以被配置成响应于检测到停止录制指令,将上述编码标识设置为上述第一预设值。
本申请的上述实施例提供的装置,通过第一设置单元501在检测到恢复录制指令后,将音频播放器的播放进度设置为已录制的视频的时长,而后启动单元502依次启动视频编码器和上述音频播放器,之后传输单元503在确定目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据,向上述视 频编码器传输所采集到的视频数据,以使上述视频编码器对所采集到的视频数据进行编码。从而,可以基于已录制的视频的时长设定音频播放器的播放进度,避免了由于播放进度的偏差所导致所录制的视频出现音视频不同步的情况。同时,在目标音频数据被播放至上述播放进度的情况下,再向视频编码器传输所采集到的视频数据,实现了视频数据编码与音频数据播放的同步进行,提升了配乐视频录制过程中的音视频同步效果。
继续参见图6,图6是本申请实施例提供的另一种录制视频的方法的流程图。该录制视频的方法,包括以下步骤:
步骤210,启动视频编码器。
在本实施例中,录制视频的方法的执行主体(例如图1所示的终端设备101、终端设备102、终端设备103)中可以安装或部署有视频编码器。上述执行主体控制上述视频编码器的启动或停止。在本实施例中,上述执行主体可以启动上述启动视频编码器,为用户进行视频录制做准备。
在本实施例中,视频编码器可以用于对视频数据进行编码。在本实施例中,视频编码是指通过特定的压缩技术,将某个视频格式的文件转换成另一种视频格式文件的方式。上述视频编码器可以是软件(例如某个组件、代码模块等)或者硬件的形式,此处不作限定。
步骤220,响应于检测到恢复录制指令,确定视频编码器已编码的时长,将音频播放器的播放进度设置为该时长。
在本实施例中,上述执行主体中可以预先获取并存储有目标音频数据。在一实施例中,上述目标音频数据可以是用户预先指定作为视频的配乐的音频数据(voice data),例如某个指定歌曲对应的音频数据。
响应于检测到恢复录制指令,可以确定视频编码器已编码的视频的时长,将音频播放器的播放进度设置为该时长。在本实施例中,恢复录制指令可以用于指示继续采集视频数据并利用音频播放器继续播放目标音频数据。在一实施例中,在恢复录制指令触发之前,上述执行主体可以存储有预先录制的且未录制完成的视频。在本实施例中,预先录制的视频已经过视频编码器编码。上述执行主体可以确定视频编码器已编码的视频的时长。在一实施例中,在每一次录制过程中,经过视频编码器编码的视频的时长,可以通过如下方式确定:首先,确定该次录制向视频编码器传输数据的起始时间和停止时间;之后,将该停止时间与该起始时间的差值确定为视频编码器在该次录制过程中已编码的视频的时长。在一实施例中,该时长也可以看作该次已录制成功的视频的时长。 将多次录制过程中已编码的视频的时长求和,即可得到视频编码器已编码的视频的时长。在一实施例中,上述执行主体还可以使用其他方法确定已录制的视频的时长,此处不再赘述。
在本实施例中,音频数据是对声音信号进行数字化后的数据。声音信号的数字化过程是以一定的频率将连续的模拟音频信号转换成数字音频信号得到音频数据的过程。通常,声音信号的数字化过程包含采样、量化和编码三个步骤。其中,采样是指用每隔一定时间间隔的信号样本值序列来代替原来在时间上连续的信号。量化是指用有限幅度近似表示原来在时间上连续变化的幅度值,把模拟信号的连续幅度变为有限数量、有一定时间间隔的离散值。编码则是指按照一定的规律,把量化后的离散值用二进制数码表示。在一实施例中,PCM可以实现将模拟音频信号经过采样、量化、编码转换成数字化的音频数据。因此,上述目标音频数据可以是PCM编码格式的数据流,记载目标音频数据的文件的格式可以是wav格式。在一实施例中,记载上述目标音频数据的文件的格式还可以是其他格式,例如mp3格式、ape格式等。此时,上述目标音频数据可以是其他编码格式(例如AAC等有损压缩格式)的数据,不限于PCM编码格式。上述执行主体也可对记载目标音频数据的文件进行格式转换,将该文件转换为记录wav格式,转换后的文件中的目标音频文件则为PCM编码格式的数据流。
通常,上述执行主体中可以安装有视频录制类应用。该视频录制类应用可以支持配乐视频的录制。上述配乐视频可以是在视频数据采集的同时进行音频数据播放的视频。所录制的配乐视频中的声音为该音频数据对应的声音。例如,播放某歌曲过程中录制用户表演的演唱动作,所录制的视频以该歌曲为背景音乐。上述视频录制类应用可以支持配乐视频的连续录制和分段录制。在分段录制的情况下,用户可以首先点击录制按键,进行第一段视频的录制。接着,再次点击录制按键,触发暂停录制指令。接着,再次点击录制按键,触发恢复录制指令,以进行第二段视频的录制。接着,再次点击录制按键,触发暂停录制指令。以此类推。在一实施例中,还可以通过其他方式触发录制指令、暂停录制指令以及恢复录制指令。例如,可以通过长按录制按键进行每段视频的录制。当松开录制按键时,触发暂停录制指令。此处不再赘述。
步骤230,启动音频播放器。
在本实施例中,上述执行主体中可以安装或部署有音频播放器。在本实施例中,上述音频播放器用于进行音频数据的播放。在本实施例中,音频播放,是将数字化的音频数据进行数模转换,将数字化的音频数据还原为模拟音频信号的过程。上述视频编码器和音频播放器可以是软件(例如某个组件、代码模块等)或者硬件的形式,此处不作限定。
在本实施例中,在执行步骤220之后,上述执行主体可以启动音频播放器。在本实施例中,上述执行主体可以控制上述音频解码器的启动或停止。
步骤240,在目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据,向视频编码器传输所采集到的视频数据,以使视频编码器对所采集到的视频数据进行编码。
在本实施例中,在目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据,可以向视频编码器传输所采集到的视频数据,以使视频编码器对所采集到的视频数据进行编码。由此,可以在目标音频数据被播放至上述播放进度后,正式开始进行视频数据的编码,从而实现音频数据的播放与视频数据的编码同步进行,提升配乐视频录制过程中的音视频同步效果。
在一实施例中,上述执行主体可以安装有图像采集装置,例如摄像头。上述执行主体可以利用上述摄像头进行视频数据的采集。
在一实施例中,在目标音频数据被播放至所述播放进度之前,响应于采集到视频数据,上述执行主体可以将所采集到的视频数据删除。在一实施例中,上述执行主体可以利用上述摄像头进行视频数据的采集。在步骤2010执行之前,即在检测到恢复录制指令之前,摄像头可以处于开启状态或者关闭状态。若摄像头处于开启状态,可以持续进行图像捕捉,但并不将所捕捉的图像传输至视频编码器,也不对所捕捉的图像进行存储,可以将所捕捉的图像丢弃(即,进行丢帧处理),直至目标音频数据被播放至上述播放进度。若在检测到恢复录制指令之前,摄像头处于关闭状态,则可以在检测到恢复录制指令之后,开启摄像头进行图像捕捉。此时,也将所捕捉的帧进行丢弃,直至目标音频数据被播放至上述播放进度。
在一实施例中,上述录制视频的方法还可以包括如下步骤:响应于检测到停止录制指令,停止向上述视频编码器传输所采集到的视频数据,并控制上述音频播放器停止播放。之后,控制上述视频编码器停止编码。
在一实施例中,在上述控制上述视频编码器停止编码之后,上述录制视频的方法还可以包括:首先,确定上述视频编码器已编码的视频数据的总时长。在本实施例中,已编码的视频数据的总时长即为当前已录制的视频数据的总时长。在本实施例中,上述已编码的视频数据,包括步骤210前已录制的视频数据。之后,可以将上述总时长确定为上述音频播放器的最终播放进度。最后,可以启动上述视频编码器。
在一实施例中,在上述将上述总时长确定为上述音频播放器的最终播放进度之后,上述录制视频的方法还可以包括:首先,将上述最终播放进度所指示 的已播放的目标音频数据作为目标音频数据区间,提取上述目标音频数据区间。在本实施例中,可以确定最终播放进度所对应的目标音频数据的播放结束位置。将目标音频数据的播放起始位置到播放结束位置所构成的区间作为目标音频数据区间,对目标音频数据区间进行提取。之后,可以将已编码的视频数据和上述目标音频数据区间进行存储。在一实施例中,可以将上述目标音频数据区间和包含已编码的视频数据分别存储至两个文件中,并建立上述两个文件的映射。在一实施例中,也可以将上述目标音频数据区间和已编码的视频数据存储至同一个文件中。
在一实施例中,在上述启动视频编码器之前,上述录制视频的方法还可以包括:将预先建立的编码标识设置为第一预设值(例如“NO”,或者“N”,或者“0”等)。在本实施例中,上述第一预设值可以用于指示将当前采集的视频数据删除。
在一实施例中,上述录制视频的方法还可以包括:在上述目标音频数据被播放至上述播放进度的情况下,将上述编码标识设置为第二预设值(例如“YES”,或者“Y”,或者“1”等)。在本实施例中,上述第二预设值可以用于指示向上述视频编码器传输当前采集的视频数据。
在一实施例中,上述录制视频的方法还可以包括:响应于检测到停止录制指令,将上述编码标识设置为上述第一预设值。
继续参见图3,在图3的应用场景中,用户手持终端设备301,进行配乐视频的录制。终端设备301中运行有短视频录制类应用。用户在该短视频录制类应用的界面中选择了某个配乐(例如歌曲《小苹果》),进行分段录制配乐视频。该配乐对应有目标音频数据302。在某一分段视频录制完成后,终端设备301首先启动了视频编码器,为用户下一次录制做准备。用户点击了配乐视频录制按键之后,触发了恢复录制指令。在检测到该恢复录制指令之后,终端设备301将音频播放器的播放进度设置为已编码的视频的时长。而后,启动音频播放器,在目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据303,向上述视频编码器传输所采集到的视频数据,以使上述视频编码器对所采集到的视频数据进行编码。
本申请的上述实施例提供的方法,通过启动视频编码器,在检测到恢复录制指令后,将音频播放器的播放进度设置为已编码的视频的时长,而后启动音频播放器,在目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据,向视频编码器传输所采集到的视频数据,以使视频编码器对所采集到的视频数据进行编码。从而,可以将已编码的视频的时长设定为音频播放器的 播放进度,避免了由于播放进度的偏差所导致所录制的视频出现音视频不同步的情况。同时,提前启动视频编码器,在恢复录制后,可以不执行视频编码器的启动操作,使恢复录制后所执行的操作的复杂程度降低,提高了响应用户所触发的恢复录制指令的效率。同时,在目标音频数据被播放至上述播放进度的情况下,再向视频编码器传输所采集到的视频数据,实现了视频数据编码与音频数据播放的同步进行,提升了配乐视频录制过程中的音视频同步效果。
继续参见图7,图7是本申请实施例提供的另一种录制视频的方法的流程图。本实施例提供的方法包括以下步骤。
步骤410,启动视频编码器。
在本实施例中,录制视频的方法的执行主体(例如图1所示的终端设备101、终端设备102、终端设备103)中可以安装或部署有视频编码器。上述执行主体控制上述视频编码器的启动或停止。在本实施例中,上述执行主体可以启动上述启动视频编码器。
在本实施例中,在启动视频编码器之前,上述执行主体还可以将预先建立的编码标识设置为第一预设值(例如“NO”,或者“N”,或者“0”等)。在本实施例中,上述第一预设值可以用于指示将当前采集的视频数据删除。
在本实施例中,上述执行主体可以安装有图像采集装置,例如摄像头。上述执行主体可以利用上述摄像头进行视频数据的采集。上述在执行步骤410之前,即在启动视频编码器之前,摄像头可以处于已开启状态。上述执行主体可以利用上述摄像头持续进行图像采集。响应于采集到视频数据(即采集到每一帧),可以确定当前的编码标识的值是否为上述第一预设值。在确定编码标识的值为上述第一预设值的情况下,可以将当前采集的视频数据删除(即,进行丢帧处理),直至确定上述编码标识的值为第二预设值(例如“YES”,或者“Y”,或者“1”等)。在本实施例中,上述第二预设值可以用于指示向上述视频编码器传输当前采集的视频数据。
步骤420,响应于检测到恢复录制指令,确定视频编码器已编码的视频的时长,将音频播放器的播放进度设置为该时长。
在本实施例中,上述执行主体响应于检测到恢复录制指令,可以确定视频编码器已编码的视频的时长,将音频播放器的播放进度设置为该时长。在本实施例中,恢复录制指令可以用于指示继续采集视频数据并利用音频播放器继续播放目标音频数据。
步骤430,启动音频播放器。
在本实施例中,上述执行主体中可以安装或部署有音频播放器。在本实施例中,上述音频播放器用于进行音频数据的播放。在执行步骤420之后,上述执行主体可以启动音频播放器。在本实施例中,上述执行主体可以控制上述音频解码器的启动或停止。
步骤440,在目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据,向视频编码器传输所采集到的视频数据,以使视频编码器对所采集到的视频数据进行编码。
在本实施例中,在目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据,可以向视频编码器传输所采集到的视频数据,以使视频编码器对所采集到的视频数据进行编码。由此,可以在目标音频数据被播放至上述播放进度后,正式开始进行视频数据的编码,从而实现音频数据的播放与视频数据的编码同步进行,以提升配乐视频录制过程中的音视频同步效果。
在一实施例中,在上述目标音频数据被播放至上述播放进度的情况下,上述执行主体还可以将上述编码标识设置为上述第二预设值,以指示在采集到视频数据的情况下,向上述视频编码器传输当前所采集到的视频数据。
步骤450,响应于检测到停止录制指令,停止向视频编码器传输所采集到的视频数据,并控制音频播放器停止播放。
在本实施例中,响应于检测到停止录制指令,上述执行主体可以停止向上述视频编码器传输所采集到的视频数据,同时,控制上述音频播放器停止播放。
在一实施例中,响应于检测到停止录制指令,上述执行主体还可以将上述编码标识设置为上述第一预设值,以指示在继续捕捉到视频数据的情况下,将所继续捕捉到的视频数据丢弃。
步骤460,控制视频编码器停止编码。
在本实施例中,在停止向视频编码器传输所采集到的视频数据,并控制音频播放器停止播放之后,上述执行主体可以控制视频编码器停止编码。即,停止上述视频编码器。
步骤470,确定视频编码器已编码的视频数据的总时长。
在本实施例中,在控制视频编码器停止编码后,上述执行主体可以确定上述视频编码器已编码的视频数据的总时长。上述已编码的视频数据,包括步骤410前已录制的视频数据。
步骤480,将总时长确定为音频播放器的最终播放进度。
在本实施例中,上述执行主体可以将所确定的总时长确定为音频播放器的 最终播放进度。
步骤490,启动视频编码器。
在本实施例中,上述执行主体可以在确定音频播放器的最终播放进度后,重新启动视频编码器,以便进行下一段视频的录制。
步骤4100,将最终播放进度所指示的已播放的目标音频数据作为目标音频数据区间,提取目标音频数据区间。
在本实施例中,上述执行主体可以首先确定最终播放进度所对应的目标音频数据的播放结束位置。而后,可以将目标音频数据的播放起始位置到播放结束位置所构成的区间确定为目标音频数据区间。最后,可以对目标音频数据区间进行提取。
步骤4110,将已编码的视频数据和目标音频数据区间进行存储。
在本实施例中,上述执行主体可以将上述目标音频数据区间和包含已编码的视频数据分别存储至两个文件中,并建立上述两个文件的映射。在一实施例中,也可以将上述目标音频数据区间和已编码的视频数据存储至同一个文件中。
从图7中可以看出,与图6对应的实施例相比,本实施例中的录制视频的方法体现了检测到停止录制指令后所执行的操作。由于在停止录制的情况下,在停止向视频编码器传输视频数据的同时停止音频编码器播放目标音频数据。因此,实现了视频编码与音频播放的同步停止。由此,进一步提升了配乐视频录制过程中的音视频同步效果。此外,本实施例提供的方法还突出了对音视频数据存储的操作。由此,可以实现音视频文件的生成,以便于后续的播放、上传等。
继续参见图8,图8是本申请实施例提供的另一种录制视频的装置的结构示意图。作为对上述多图所示方法的实现,本申请实施例提供了一种录制视频的装置,该装置实施例与图6所示的方法实施例相对应,该装置可以应用于多种电子设备中。
如图8所示,本实施例所述的录制视频的装置包括:第一启动单元510,被配置成启动视频编码器;第一设置单元520,被配置成响应于检测到恢复录制指令,确定已录制的视频的时长,将音频播放器的播放进度设置为上述时长,其中,上述恢复录制指令用于指示继续采集视频数据并利用上述音频播放器继续播放目标音频数据;第二启动单元530,被配置成启动上述音频播放器;传输单元540,被配置成在上述目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据,向上述视频编码器传输所采集到的视频数据,以使上述视频 编码器对所采集到的视频数据进行编码。
在一实施例中,该装置还可以包括控制单元(图中未示出)。其中,上述控制单元可以被配置成响应于检测到停止录制指令,停止向上述视频编码器传输所采集到的视频数据,并控制上述音频播放器停止播放;控制上述视频编码器停止编码。
在一实施例中,该装置还可以包括第一确定单元、第二确定单元和第三启动单元(图中未示出)。其中,上述第一确定单元可以被配置成确定上述视频编码器已编码的视频数据的总时长。上述第二确定单元可以被配置成将上述总时长确定为上述音频播放器的最终播放进度。上述第三启动单元可以被配置成启动上述视频编码器。
在一实施例中,该装置还可以包括提取单元和存储单元(图中未示出)。其中,上述提取单元可以被配置成将上述最终播放进度所指示的已播放的目标音频数据作为目标音频数据区间,提取上述目标音频数据区间。上述存储单元可以被配置成将已编码的视频数据和上述目标音频数据区间进行存储。
在一实施例中,该装置还可以包括删除单元(图中未示出)。其中,上述删除单元可以被配置成在目标音频数据被播放至播放进度之前,响应于采集到视频数据,将所采集到的视频数据删除。
在一实施例中,该装置还可以包括第二设置单元(图中未示出)。其中,上述第二设置单元可以被配置成在启动视频编码器之前,将预先建立的编码标识设置为第一预设值,其中,上述第一预设值用于指示将当前采集的视频数据删除。
在一实施例中,该装置还可以包括第三设置单元(图中未示出)。其中,上述第三设置单元可以被配置成在上述目标音频数据被播放至上述播放进度的情况下,将上述编码标识设置为第二预设值,其中,上述第二预设值用于指示向上述视频编码器传输当前采集的视频数据。
在一实施例中,该装置还可以包括第四设置单元(图中未示出)。其中,上述第四设置单元可以被配置成响应于检测到停止录制指令,将上述编码标识设置为上述第一预设值。
本申请的上述实施例提供的装置,通过第一启动单元510启动视频编码器,第一设置单元520在检测到恢复录制指令后,将音频播放器的播放进度设置为已编码的视频的时长,而后第二启动单元530启动音频播放器,最后传输单元540在确定目标音频数据被播放至上述播放进度的情况下,响应于采集到视频数据,向视频编码器传输所采集到的视频数据,以使视频编码器对所采集到的视 频数据进行编码。从而,可以将已编码的视频的时长设定为音频播放器的播放进度,避免了由于播放进度的偏差所导致所录制的视频出现音视频不同步的情况。同时,提前启动视频编码器,能够使恢复录制后所执行的操作的复杂程度降低。在目标音频数据被播放至上述播放进度的情况下,再向视频编码器传输所采集到的视频数据,实现了视频数据编码与音频数据播放的同步进行,提升了配乐视频录制过程中的音视频同步效果。
下面参见图9,图9是本申请实施例提供的一种终端设备的计算机系统的结构示意图。图9示出的终端设备仅仅是一个示例,不应对本申请实施例的功能和使用范围带来任何限制。
如图9所示,计算机系统600包括中央处理单元(Central Processing Unit,CPU)601,CPU01可以根据存储在只读存储器(Read-Only Memory,ROM)602中的程序或者从存储部分608加载到随机访问存储器(Random Access Memory,RAM)603中的程序而执行多种适当的动作和处理。在RAM 603中,还存储有系统600操作所需的多种程序和数据。CPU 601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(Input/Ouput,I/O)接口605也连接至总线604。
以下部件连接至I/O接口605:包括键盘、鼠标等的输入部分606;包括诸如液晶显示器(Liquid Crystal Display,LCD)等以及扬声器等的输出部分607;包括硬盘等的存储部分608;以及包括诸如局域网(Local Area Network,LAN)卡、调制解调器等的网络接口卡的通信部分609。通信部分609经由诸如因特网的网络执行通信处理。驱动器610也根据需要连接至I/O接口605。可拆卸介质611,诸如半导体存储器等等,根据需要安装在驱动器610上,以便于驱动器10从可拆卸介质611上读出的计算机程序根据需要被安装入存储部分608。
根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,计算机程序产品包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分609从网络上被下载和安装,和/或从可拆卸介质611被安装。在该计算机程序被CPU601执行时,执行本申请的方法中限定的上述功能。在一实施例中,本申请所述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质可以包括但不限于:具有一个或多个导线的电 连接、便携式计算机磁盘、硬盘、RAM、ROM、可擦式可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM)或闪存、光纤、便携式紧凑磁盘只读存储器(Compact Disc Read-Only Memory,CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本申请中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本申请中,计算机可读的信号介质可以包括在基带中或者作为载波一部分传播的数据信号,数据信号中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读的信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读介质可以发送、传播或者传输用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:无线、电线、光缆、射频(Radio Frequency,RF)等等,或者上述的任意合适的组合。
附图中的流程图和框图,图示了按照本申请实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本申请实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元也可以设置在处理器中,例如,可以描述为:一种处理器包括设置单元、启动单元和传输单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,设置单元还可以被描述为“设置音乐播放器的播放进度的单元”。又例如,可以描述为:一种处理器包括第一启动单元、设置单元、第二启动单元和传输单元。其中,这些单元的名称在某种情况下并不构成对该单元本身的限定,例如,第一启动单元还可以被描述为“启动视频编码器的单元”。
作为另一方面,本申请还提供了一种计算机可读介质,该计算机可读介质可以是上述实施例中描述的装置中所包含的;也可以是单独存在,而未装配入该装置中。上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该装置执行时,使得该装置:响应于检测到恢复录制指令,确定视频 编码器已编码的视频的时长,将音频播放器的播放进度设置为该时长,其中,该恢复录制指令用于指示继续采集视频数据并利用该音频播放器继续播放目标音频数据;依次启动该视频编码器和该音频播放器;在该目标音频数据被播放至该播放进度的情况下,响应于采集到视频数据,向该视频编码器传输所采集到的视频数据,以使该视频编码器对所采集到的视频数据进行编码;或者,使得该装置:启动视频编码器;响应于检测到恢复录制指令,确定已录制的视频的时长,将音频播放器的播放进度设置为该时长,其中,该恢复录制指令用于指示继续采集视频数据并利用该音频播放器继续播放目标音频数据;启动该音频播放器;在该目标音频数据被播放至该播放进度的情况下,响应于采集到视频数据,向该视频编码器传输所采集到的视频数据,以使该视频编码器对所采集到的视频数据进行编码。

Claims (22)

  1. 一种录制视频的方法,包括:
    响应于检测到恢复录制指令,确定视频编码器已编码的视频的时长,将音频播放器的播放进度设置为所述时长,其中,所述恢复录制指令用于指示继续采集视频数据并利用所述音频播放器继续播放目标音频数据;
    启动所述音频播放器;其中,所述视频编码器在启动所述音频播放器之前启动;
    在所述目标音频数据被播放至所述播放进度的情况下,响应于采集到视频数据,向所述视频编码器传输所采集到的视频数据,以使所述视频编码器对所采集到的视频数据进行编码。
  2. 根据权利要求1所述的方法,还包括:
    响应于检测到停止录制指令,停止向所述视频编码器传输所采集到的视频数据,并控制所述音频播放器停止播放;控制所述视频编码器停止编码。
  3. 根据权利要求2所述的方法,在所述响应于检测到恢复录制指令之后并在所述启动所述音频播放器之前,启动所述视频编码器的情况下,在所述控制所述视频编码器停止编码之后,还包括:
    确定所述视频编码器已编码的视频数据的总时长;
    将所述总时长确定为所述音频播放器的最终播放进度。
  4. 根据权利要求2所述的方法,在所述响应于检测到恢复录制指令之前,启动所述视频编码器的情况下,在所述控制所述视频编码器停止编码之后,还包括:
    确定所述视频编码器已编码的视频数据的总时长;
    将所述总时长确定为所述音频播放器的最终播放进度;
    启动所述视频编码器。
  5. 根据权利要求3或4所述的方法,在所述将所述总时长确定为所述音频播放器的最终播放进度之后,还包括:
    将所述最终播放进度所指示的已播放的目标音频数据作为目标音频数据区间,提取所述目标音频数据区间;
    将已编码的视频数据和所述目标音频数据区间进行存储。
  6. 根据权利要求1所述的方法,还包括:
    在所述目标音频数据被播放至所述播放进度之前,响应于采集到视频数据, 将所采集到的视频数据删除。
  7. 根据权利要求1所述的方法,在所述响应于检测到恢复录制指令之后并在所述启动所述音频播放器之前,启动所述视频编码器的情况下,还包括:
    响应于检测到恢复录制指令,将预先建立的编码标识设置为第一预设值,其中,所述第一预设值用于指示将当前采集的视频数据删除。
  8. 根据权利要求1所述的方法,在所述响应于检测到恢复录制指令之前,启动所述视频编码器的情况下,在所述启动视频编码器之前,还包括:
    将预先建立的编码标识设置为第一预设值,其中,所述第一预设值用于指示将当前采集的视频数据删除。
  9. 根据权利要求7或8所述的方法,还包括:
    在所述目标音频数据被播放至所述播放进度的情况下,将所述编码标识设置为第二预设值,其中,所述第二预设值用于指示向所述视频编码器传输当前采集的视频数据。
  10. 根据权利要求9所述的方法,还包括:
    响应于检测到停止录制指令,将所述编码标识设置为所述第一预设值。
  11. 一种用于录制视频的装置,包括:
    第一设置单元,被配置成响应于检测到恢复录制指令,确定视频编码器已编码的视频的时长,将音频播放器的播放进度设置为所述时长,其中,所述恢复录制指令用于指示继续采集视频数据并利用所述音频播放器继续播放目标音频数据;
    第一启动单元,被配置成启动所述音频播放器;
    传输单元,被配置成在所述目标音频数据被播放至所述播放进度的情况下,响应于采集到视频数据,向所述视频编码器传输所采集到的视频数据,以使所述视频编码器对所采集到的视频数据进行编码;
    第二启动单元,被配置成在所述启动所述音频播放器之前,启动所述视频编码器。
  12. 根据权利要求11所述的装置,还包括:
    控制单元,被配置成响应于检测到停止录制指令,停止向所述视频编码器传输所采集到的视频数据,并控制所述音频播放器停止播放;控制所述视频编码器停止编码。
  13. 根据权利要求12所述的装置,在所述第二启动单元被配置成在响应于 检测到恢复录制指令之后并在所述启动所述音频播放器之前,启动所述视频编码器的情况下,所述装置还包括:
    第一确定单元,被配置成确定所述视频编码器已编码的视频数据的总时长;
    第二确定单元,被配置成将所述总时长确定为所述音频播放器的最终播放进度。
  14. 根据权利要求12所述的装置,在所述第二启动单元被配置成在所述响应于检测到恢复录制指令之前,启动所述视频编码器的情况下,所述装置还包括:
    第一确定单元,被配置成确定所述视频编码器已编码的视频数据的总时长;
    第二确定单元,被配置成将所述总时长确定为所述音频播放器的最终播放进度;
    第三启动单元,被配置成启动所述视频编码器。
  15. 根据权利要求13或14所述的装置,还包括:
    提取单元,被配置成将所述最终播放进度所指示的已播放的目标音频数据作为目标音频数据区间,提取所述目标音频数据区间;
    存储单元,被配置成将已编码的视频数据和所述目标音频数据区间进行存储。
  16. 根据权利要求11所述的装置,还包括:
    删除单元,被配置成在所述目标音频数据被播放至所述播放进度之前,响应于采集到视频数据,将所采集到的视频数据删除。
  17. 根据权利要求11所述的装置,在所述第二启动单元被配置成在响应于检测到恢复录制指令之后并在所述启动所述音频播放器之前,启动所述视频编码器的情况下,所述装置还包括:
    第二设置单元,被配置成响应于检测到恢复录制指令,将预先建立的编码标识设置为第一预设值,其中,所述第一预设值用于指示将当前采集的视频数据删除。
  18. 根据权利要求11所述的装置,在所述第二启动单元被配置成在所述响应于检测到恢复录制指令之前,启动所述视频编码器的情况下,所述装置还包括:
    第二设置单元,被配置成在启动视频编码器之前,将预先建立的编码标识设置为第一预设值,其中,所述第一预设值用于指示将当前采集的视频数据删 除。
  19. 根据权利要求17或18所述的装置,还包括:
    第三设置单元,被配置成在所述目标音频数据被播放至所述播放进度的情况下,将所述编码标识设置为第二预设值,其中,所述第二预设值用于指示向所述视频编码器传输当前采集的视频数据。
  20. 根据权利要求19所述的装置,还包括:
    第四设置单元,被配置成响应于检测到停止录制指令,将所述编码标识设置为所述第一预设值。
  21. 一种终端设备,包括:
    至少一个处理器;
    存储装置,被配置成存储有至少一个程序,
    当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如权利要求1-10中任一所述的方法。
  22. 一种计算机可读介质,存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1-10中任一所述的方法。
PCT/CN2019/098460 2018-08-01 2019-07-30 录制视频的方法和装置 Ceased WO2020024950A1 (zh)

Priority Applications (5)

Application Number Priority Date Filing Date Title
JP2021504427A JP7008870B2 (ja) 2018-08-01 2019-07-30 ビデオを録画する方法および装置
EP19845332.6A EP3833010A4 (en) 2018-08-01 2019-07-30 VIDEO RECORDING METHOD AND APPARATUS
KR1020207035557A KR102625410B1 (ko) 2018-08-01 2019-07-30 비디오 녹화 방법 및 장치
BR112020024621-2A BR112020024621B1 (pt) 2018-08-01 2019-07-30 Método e aparelho de gravação de vídeo, dispositivo terminal e meio legível por computador
US17/014,391 US11114133B2 (en) 2018-08-01 2020-09-08 Video recording method and device

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
CN201810865723.6 2018-08-01
CN201810865722.1A CN109600660B (zh) 2018-08-01 2018-08-01 用于录制视频的方法和装置
CN201810865723.6A CN109600562B (zh) 2018-08-01 2018-08-01 用于录制视频的方法和装置
CN201810865722.1 2018-08-01

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/014,391 Continuation US11114133B2 (en) 2018-08-01 2020-09-08 Video recording method and device

Publications (1)

Publication Number Publication Date
WO2020024950A1 true WO2020024950A1 (zh) 2020-02-06

Family

ID=69231413

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/098460 Ceased WO2020024950A1 (zh) 2018-08-01 2019-07-30 录制视频的方法和装置

Country Status (5)

Country Link
US (1) US11114133B2 (zh)
EP (1) EP3833010A4 (zh)
JP (1) JP7008870B2 (zh)
KR (1) KR102625410B1 (zh)
WO (1) WO2020024950A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113038193A (zh) * 2021-03-24 2021-06-25 Vidaa美国公司 一种自动修复音视频不同步的方法及显示设备

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113301424B (zh) * 2021-05-21 2023-07-11 北京字跳网络技术有限公司 播放控制方法、设备、存储介质及程序产品
US12067384B2 (en) * 2021-05-28 2024-08-20 Vizio, Inc. Consumer device firmware updating via HDMI
US20230421525A1 (en) * 2022-06-22 2023-12-28 Whatsapp Llc Facilitating pausing while recording audio and/or visual messages in social media messaging applications

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010033741A1 (en) * 2000-04-24 2001-10-25 Mamoru Miyashita Camera
CN101296452A (zh) * 2008-05-08 2008-10-29 北京天宇朗通通信设备股份有限公司 手机中视频流的处理系统和方法
CN103208298A (zh) * 2012-01-11 2013-07-17 三星电子(中国)研发中心 一种摄像方法及系统
CN105959776A (zh) * 2016-04-29 2016-09-21 高翔 音视频文件生成方法、装置及系统
CN106131475A (zh) * 2016-07-28 2016-11-16 努比亚技术有限公司 一种视频处理方法、装置及终端
CN107566769A (zh) * 2017-09-27 2018-01-09 维沃移动通信有限公司 一种视频录制方法及移动终端
CN107959873A (zh) * 2017-11-02 2018-04-24 深圳天珑无线科技有限公司 在视频中植入背景音乐的方法、装置、终端及存储介质
CN109600660A (zh) * 2018-08-01 2019-04-09 北京微播视界科技有限公司 用于录制视频的方法和装置
CN109600562A (zh) * 2018-08-01 2019-04-09 北京微播视界科技有限公司 用于录制视频的方法和装置

Family Cites Families (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH09106662A (ja) * 1995-10-09 1997-04-22 Roland Corp 録画装置用の音楽同時記録装置
US6396874B1 (en) * 1997-11-12 2002-05-28 Sony Corporation Decoding method and apparatus and recording method and apparatus for moving picture data
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
JP4062724B2 (ja) 2002-05-27 2008-03-19 富士フイルム株式会社 画像記録装置並びに画像記録方法
CN100479511C (zh) * 2003-04-04 2009-04-15 日本胜利株式会社 音频/视频记录装置、记录方法、再现装置、再现方法
TWI314017B (en) 2006-07-12 2009-08-21 Quanta Comp Inc System and method for synchronizing video frames and audio frames
JP2010518459A (ja) 2007-02-14 2010-05-27 ミューズアミ, インコーポレイテッド 配布オーディオファイル編集用ウェブポータル
CN101483753A (zh) 2008-01-10 2009-07-15 华为技术有限公司 一种录制业务的实现方法和设备
CN101740084B (zh) 2009-11-25 2012-05-09 中兴通讯股份有限公司 多媒体片段的剪辑方法及移动终端
CN102348086A (zh) 2010-08-03 2012-02-08 中兴通讯股份有限公司 一种在录像过程中加载背景音的方法及移动终端
US9544649B2 (en) * 2013-12-03 2017-01-10 Aniya's Production Company Device and method for capturing video
US10096337B2 (en) * 2013-12-03 2018-10-09 Aniya's Production Company Device and method for capturing video
CN103702041A (zh) 2013-12-30 2014-04-02 乐视网信息技术(北京)股份有限公司 一种视频暂停续拍的方法及装置
CN104023192B (zh) 2014-06-27 2016-04-13 努比亚技术有限公司 一种录制视频的方法和装置
CN105407379A (zh) 2014-08-26 2016-03-16 天脉聚源(北京)教育科技有限公司 多种媒体的同步录制方法
CN104835520A (zh) 2015-03-27 2015-08-12 广州荔支网络技术有限公司 一种在移动设备上录音的方法及装置
US9583142B1 (en) * 2015-07-10 2017-02-28 Musically Inc. Social media platform for creating and sharing videos
CN105516485B (zh) 2015-12-04 2019-03-01 小米科技有限责任公司 录音方法及装置
CN106899880B (zh) 2015-12-19 2020-02-18 联芯科技有限公司 将多媒体数据分段保存的方法及系统
CN106385525A (zh) 2016-09-07 2017-02-08 天脉聚源(北京)传媒科技有限公司 一种视频播放方法及装置

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010033741A1 (en) * 2000-04-24 2001-10-25 Mamoru Miyashita Camera
CN101296452A (zh) * 2008-05-08 2008-10-29 北京天宇朗通通信设备股份有限公司 手机中视频流的处理系统和方法
CN103208298A (zh) * 2012-01-11 2013-07-17 三星电子(中国)研发中心 一种摄像方法及系统
CN105959776A (zh) * 2016-04-29 2016-09-21 高翔 音视频文件生成方法、装置及系统
CN106131475A (zh) * 2016-07-28 2016-11-16 努比亚技术有限公司 一种视频处理方法、装置及终端
CN107566769A (zh) * 2017-09-27 2018-01-09 维沃移动通信有限公司 一种视频录制方法及移动终端
CN107959873A (zh) * 2017-11-02 2018-04-24 深圳天珑无线科技有限公司 在视频中植入背景音乐的方法、装置、终端及存储介质
CN109600660A (zh) * 2018-08-01 2019-04-09 北京微播视界科技有限公司 用于录制视频的方法和装置
CN109600562A (zh) * 2018-08-01 2019-04-09 北京微播视界科技有限公司 用于录制视频的方法和装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3833010A4

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113038193A (zh) * 2021-03-24 2021-06-25 Vidaa美国公司 一种自动修复音视频不同步的方法及显示设备
CN113038193B (zh) * 2021-03-24 2023-08-11 Vidaa美国公司 一种自动修复音视频不同步的方法及显示设备

Also Published As

Publication number Publication date
EP3833010A4 (en) 2022-05-04
EP3833010A1 (en) 2021-06-09
BR112020024621A2 (pt) 2021-03-02
KR20210008066A (ko) 2021-01-20
JP7008870B2 (ja) 2022-01-25
US11114133B2 (en) 2021-09-07
JP2021524720A (ja) 2021-09-13
KR102625410B1 (ko) 2024-01-17
US20200402543A1 (en) 2020-12-24

Similar Documents

Publication Publication Date Title
WO2020024945A1 (zh) 确定时间戳的方法和装置
US20230164273A1 (en) Systems and methods to automatically join conference
US11114133B2 (en) Video recording method and device
CN109600665B (zh) 用于处理数据的方法和装置
CN105828107A (zh) 一种直播延时方法及装置
EP2661863A1 (en) Apparatus and method for transmitting live media content
CN109600661B (zh) 用于录制视频的方法和装置
WO2023024290A1 (zh) 视频录制方法、摄像设备、控制终端及视频录制系统
WO2020024962A1 (zh) 处理数据的方法和装置
CN110798458B (zh) 数据同步方法、装置、设备及计算机可读存储介质
CN109600660B (zh) 用于录制视频的方法和装置
US12342055B2 (en) Simultaneous recording and uploading of multiple audio files of the same conversation and audio drift normalization systems and methods
WO2020024960A1 (zh) 处理数据的方法和装置
CN110912948B (zh) 一种问题上报的方法和装置
CN109600562B (zh) 用于录制视频的方法和装置
CN113948054A (zh) 音轨处理方法、装置、电子设备和存储介质
WO2020024949A1 (zh) 确定时间戳的方法和装置
US11522936B2 (en) Synchronization of live streams from web-based clients
CN111510787A (zh) 多媒体剪辑方法、装置、终端及存储介质
BR112020024621B1 (pt) Método e aparelho de gravação de vídeo, dispositivo terminal e meio legível por computador
CN108228829B (zh) 用于生成信息的方法和装置
US11876850B2 (en) Simultaneous recording and uploading of multiple audio files of the same conversation and audio drift normalization systems and methods
CN111210837B (zh) 音频处理方法和装置
WO2019227431A1 (zh) 一种用于生成多媒体内容的模板分享方法、装置和终端设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19845332

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 20207035557

Country of ref document: KR

Kind code of ref document: A

REG Reference to national code

Ref country code: BR

Ref legal event code: B01A

Ref document number: 112020024621

Country of ref document: BR

ENP Entry into the national phase

Ref document number: 2021504427

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 112020024621

Country of ref document: BR

Kind code of ref document: A2

Effective date: 20201202

ENP Entry into the national phase

Ref document number: 2019845332

Country of ref document: EP

Effective date: 20210301