WO2022135105A1 - Video dubbing method and apparatus for functional machine, terminal device and storage medium - Google Patents

Video dubbing method and apparatus for functional machine, terminal device and storage medium Download PDF

Info

Publication number
WO2022135105A1
WO2022135105A1 PCT/CN2021/135090 CN2021135090W WO2022135105A1 WO 2022135105 A1 WO2022135105 A1 WO 2022135105A1 CN 2021135090 W CN2021135090 W CN 2021135090W WO 2022135105 A1 WO2022135105 A1 WO 2022135105A1
Authority
WO
WIPO (PCT)
Prior art keywords
audio
audio data
file
video
dma buffer
Prior art date
Application number
PCT/CN2021/135090
Other languages
French (fr)
Chinese (zh)
Inventor
黄瑞
李京
Original Assignee
展讯半导体(成都)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 展讯半导体(成都)有限公司 filed Critical 展讯半导体(成都)有限公司
Publication of WO2022135105A1 publication Critical patent/WO2022135105A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/439Processing of audio elementary streams
    • 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/44Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs
    • H04N21/4402Processing of video elementary streams, e.g. splicing a video clip retrieved from local storage with an incoming video stream or rendering scenes according to encoded video stream scene graphs involving reformatting operations of video signals for household redistribution, storage or real-time display
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/472End-user interface for requesting content, additional data or services; End-user interface for interacting with content, e.g. for content reservation or setting reminders, for requesting event notification, for manipulating displayed content

Definitions

  • the present application relates to the technical field of audio and video, and in particular, to a method, device, terminal device and storage medium for video soundtracking of a functional machine.
  • the soundtrack function has been implemented on the smart phone (android operating system), and the specific music selected by the user is configured for the video recorded by the user.
  • the operating system of the function machine is not compatible with the application code on the smart machine, for example, a real-time operating system (RTOS), and the function machine does not have a java layer.
  • RTOS real-time operating system
  • the function machine is constrained by cost and hardware conditions, and its performance is far lower than that of the smart machine.
  • the realization of the video soundtrack function of the function machine needs to rely on its existing function modules as much as possible to reduce the overhead of software and hardware. Therefore, how to The problem of realizing the video soundtrack function of the feature phone and saving the software and hardware resources of the feature phone needs to be solved.
  • the embodiments of the present application provide a method and device for video soundtracking of a functional machine, which can realize the video soundtracking function of the functional machine and save the software and hardware resources of the functional machine.
  • an embodiment of the present application provides a method for soundtracking a video of a functional machine, the method comprising:
  • the audio data stream and the video data stream are synthesized to obtain a second video file.
  • an embodiment of the present application provides a video soundtrack device for a functional machine, the device comprising:
  • a processing unit for transcoding the first audio file to obtain a transcoded second audio file
  • the obtaining unit is also used to obtain the first video file to be composed
  • the processing unit is further configured to decode the second audio file to obtain a first audio data stream, and encode the first video file to obtain a video data stream;
  • the processing unit is further configured to synthesize the audio data stream and the video data stream to obtain a second video file.
  • embodiments of the present application provide a terminal device, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory, and are configured to be processed by the above-mentioned
  • the above program includes instructions for executing the steps in the method described in the first aspect of the embodiments of the present application.
  • an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program causes a computer to execute the first aspect of the embodiment of the present application. some or all of the steps described in the method.
  • an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute as implemented in the present application.
  • the computer program product may be a software installation package.
  • the first audio file required for the soundtrack is obtained; the first audio file is transcoded to obtain the transcoded second audio file; the first video file to be soundtracked is obtained; Decoding the second audio file to obtain a first audio data stream, and encoding the first video file to obtain a video data stream; synthesizing the audio data stream and the video data stream to obtain a second video file,
  • the video soundtrack function of the function machine can be realized, and the software and hardware resources of the function machine can be saved.
  • 1A is a schematic flowchart of a method for soundtracking a video for a feature phone provided by an embodiment of the present application
  • 1B is a schematic diagram illustrating the writing and reading of second audio data in a DMA buffer provided by an embodiment of the present application
  • FIG. 2 is a schematic flowchart of another function machine video soundtrack method provided by an embodiment of the present application.
  • FIG. 3 is a schematic structural diagram of a terminal device provided by an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of a video soundtrack device for a functional machine provided by an embodiment of the present application.
  • the terminal device in the embodiment of the present application is a function machine, and the operating system of the terminal device may be RTOS, for example, and the operating system of the smart machine is generally an android operating system, an ios operating system, etc., which is compatible with many applications. program, but the operating system of the function machine does not have a java layer and cannot be compatible with many functional applications.
  • the function machine is constrained by cost and hardware conditions, and its performance is far lower than that of the smart machine.
  • the realization of the video soundtrack function of the function machine needs to rely on its existing function modules as much as possible to reduce the overhead of software and hardware.
  • the terminal device in this embodiment of the present application has a wireless communication function, and can be deployed on land, including indoor or outdoor, handheld, wearable, or vehicle-mounted; it can also be deployed on water (such as ships, etc.); or Deployed in the air (eg aircraft, balloons, satellites, etc.).
  • the terminal device can be a mobile phone (mobile phone), a tablet computer (pad), a computer with a wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, an industrial control (industrial) terminal device wireless terminal in control), wireless terminal in self-driving, wireless terminal in remote medical, wireless terminal in smart grid, wireless terminal in smart home terminal etc.
  • the terminal device may also be a handheld device with wireless communication function, a vehicle-mounted device, a wearable device, a computer device, or other processing device connected to a wireless modem.
  • FIG. 1A is a schematic flowchart of a method for soundtracking a video for a feature phone provided by an embodiment of the application.
  • the method for soundtracking a video for a feature phone is applied to a terminal device, and the terminal device belongs to a feature phone.
  • the method includes the following steps:
  • the audio format of the first audio file may be any of the following: mp3, wav, midi, or amr, etc.
  • the first audio file may be an audio file recorded by a user through a terminal device, or may be downloaded from the Internet, downloaded from other devices
  • the audio file to be transmitted is not limited in this embodiment of the present application.
  • the second audio file may be a pulse code modulation (pulse code modulation, pcm) type audio file in wav format.
  • pulse code modulation pulse code modulation
  • the first audio file can be transcoded, specifically, the audio file whose audio format is mp3, wav, midi or amr can be converted into a pcm-type wav-format audio file, because the pcm-type wav-format audio file can be It is implemented in the multimedia interface (multimedia interface, MMI) layer in the operating system of the function machine, wherein, the MMI layer can be realized by the C language code, so that it can be compatible with the function machine, so that the defect that the function machine does not have the java layer can be solved.
  • MMI multimedia interface
  • the transcoding of the first audio file to obtain a transcoded second audio file may include:
  • the first audio file is separated to obtain the separated audio file
  • the first preset type may be a pcm type
  • the file header of the first audio format may be a wav file header.
  • the first audio file can be separated to obtain the separated audio file; the separated audio file can be decoded to obtain the first audio data of the first preset type, for example, the first audio data of the pcm type; Then, the first audio data of the pcm type is output as a file to a storage device such as a flash memory, and finally a file header of the first audio format can be added to the first audio data of the pcm type, for example, a wav file header can be added to obtain the second The audio file, for example, a pcm-type wav format audio file, so that the second audio file can realize the function of video soundtrack on the function machine, wherein the second audio file can be temporarily stored as an intermediate file in the storage space of the function machine .
  • obtaining the first video file to be composed may be recording the first video file through a video application, or may be receiving the first video file transmitted by an external device, or may be downloading from the network or calling the locally stored first video file. a video file.
  • obtaining the first video file to be composed may include the following steps:
  • the first video data is encoded to obtain an encoded first video file.
  • the recording of the first video file may be performed simultaneously with the transcoding of the first audio file.
  • the second audio file is decoded into the first audio data stream, and the first video file is encoded to obtain the video data stream, so that the video data stream can be The function of realizing video soundtrack on the function machine.
  • the decoding of the second audio file to obtain the first audio data stream may include:
  • the file header in the second audio file is removed to obtain the decoded first audio data
  • the decoded first audio data is synthesized into the first audio data stream.
  • the wav file header in the pcm-type wav format audio file can be removed to obtain the pcm-type first audio data, and then the decoded pcm-type first audio data can be synthesized into the first audio data stream.
  • the second audio file can be used cyclically. Specifically, after the second audio file is decoded, the Two audio files are decoded, or, video playback can be paused.
  • the first audio data stream and the first video file may be synthesized to obtain the second video file, so that the audio data and the video data are stored and transmitted as one file.
  • step 104 the following steps may also be included:
  • DMA direct memory access
  • the second video file may also be played.
  • the second video file may be decomposed first to obtain decomposed second audio data and first video data.
  • you may Write the second audio data into the DMA buffer, then read the second audio data from the DMA buffer, perform encoding and decoding processing, obtain the second audio data stream after encoding and decoding processing, and transmit the second audio data stream to playback
  • a hardware device such as a speaker, an earpiece or an earphone; at the same time, the first video data is transmitted to the display screen for playback in the same time line.
  • the present application does not need to write the second audio data into the track buffer, so that the amount of data transmitted in the DMA buffer increases, and the interruption in the DMA transmission process is greatly reduced. , so that the terminal device can listen to music for a longer time in the same environment.
  • the second audio data includes multiple sets of audio data frames, the number of DMA buffers is multiple, and each set of audio data frames includes at least one frame of audio data.
  • the The second audio data is written into the DMA buffer, including:
  • the multiple DMA buffers include a first DMA buffer and a second DMA buffer, and write a second audio into the second DMA buffer
  • the data frame set is performed at the same time as the first audio data frame set is read from the first DMA buffer, and the first audio data frame set and the second audio data frame set are among the plurality of audio data frame sets. A collection of any two distinct audio data frames.
  • the second audio data may be written into different multiple DMA buffers.
  • FIG. 1B FIG. Demonstration schematic diagram of writing and reading, wherein at least one frame of audio data of the first set of audio data frames can be written into the first DMA buffer, and after the writing is completed, at least one frame of the second set of audio data frames can be written.
  • the audio data is written into the second DMA buffer, and in the process of writing into the second DMA buffer, at least one frame of audio data of the first audio data frame set can be read from the first DMA buffer at the same time, and encoding and decoding processing is performed, The encoding and decoding processing is obtained, and the audio data stream after the encoding and decoding processing is obtained, in this way, the efficiency of processing the audio data by the terminal device can be improved.
  • the operation of writing the set of audio data frames to the DMA buffer and the operation of reading audio data from the DMA buffer are stopped according to the play pause instruction.
  • the user may pause the playback of the second video file, and at this time, the operation of writing the set of audio data frames to the DMA buffer and the reading of audio data from the DMA buffer may be stopped.
  • this solution does not need to write the second audio data into the track buffer first, and then read the second audio data from the track buffer and write it into the DMA buffer, therefore, when the DMA interrupt is triggered by pausing the video playback, reduce the The operation of copying the second audio data in sequence from the track buffer to the DMA buffer, thereby reducing the power consumption of the terminal device and improving the audio data processing efficiency.
  • the first audio file required for the soundtrack is obtained; the first audio file is transcoded to obtain the transcoded second audio file; the first video file to be soundtracked is obtained; Decoding the second audio file to obtain a first audio data stream, and encoding the first video file to obtain a video data stream; synthesizing the audio data stream and the video data stream to obtain a second video file,
  • the video soundtrack function of the function machine can be realized, and the software and hardware resources of the function machine can be saved.
  • FIG. 2 is a schematic flowchart of another feature machine video soundtrack method provided by an embodiment of the present application.
  • the feature machine video soundtrack method is applied to a terminal device, and the terminal device belongs to a feature machine.
  • the method includes the following steps:
  • the audio format of the first audio file may be any one of the following: mp3, wav, midi, or amr.
  • the user can select the first audio file required for the soundtrack.
  • the first preset type may be a pcm type.
  • the file header of the first audio format may be a wav file header
  • the second audio file may be a pcm-type wav format audio file.
  • the user may perform video recording through the terminal device to obtain the first video file.
  • the wav file header in the pcm-type wav format audio file may be removed to obtain the pcm-type first audio data.
  • the first audio file required for the soundtrack is obtained, the first audio file is separated to obtain the separated audio file, and the separated audio file is decoded to obtain
  • For the first audio data of the first preset type add a file header of the first audio format to the first audio data, obtain the second audio file, obtain the first video file to be accompanied by music, and add the second audio file to the second audio file.
  • the file header in the audio file is removed, the decoded first audio data is obtained, the decoded first audio data is synthesized into the first audio data stream, and the first audio data stream and the first audio data stream are combined.
  • a video file is synthesized to obtain a second video file, the second video file is decomposed, the decomposed second audio data and the first video data are obtained, and the second audio data is written into the direct memory access DMA buffer area, read the second audio data of the DMA buffer, perform encoding and decoding processing, obtain the second audio data stream after the encoding and decoding processing, and combine the first video data with the second audio after the encoding and decoding processing.
  • the data stream is played synchronously, in this way, the video soundtrack function of the function machine can be realized, and the software and hardware resources of the function machine can be saved.
  • FIG. 3 is a schematic structural diagram of a terminal device provided by an embodiment of the present application, including: one or more processors, one or more memories, one or more communication interfaces, and one or more programs ;
  • the one or more programs are stored in the memory and configured to be executed by the one or more processors;
  • the program includes instructions for performing the following steps:
  • the second audio file is decoded to obtain the first audio data stream
  • the first audio data stream and the first video file are synthesized to obtain a second video file.
  • the program includes instructions for performing the following steps:
  • the first audio file is separated to obtain the separated audio file
  • a file header of a first audio format is added to the first audio data to obtain the second audio file.
  • the program includes instructions for performing the following steps:
  • the file header in the second audio file is removed to obtain the decoded first audio data
  • the decoded first audio data is synthesized into the first audio data stream.
  • the program includes instructions for performing the following steps:
  • the first video data is encoded to obtain an encoded first video file.
  • the program after synthesizing the first audio data stream and the first video file to obtain the second video file, the program includes an instruction for performing the following steps:
  • the second video file is decomposed to obtain the decomposed second audio data and the first video data;
  • the first video data and the encoded and decoded second audio data stream are played synchronously.
  • the second audio data includes multiple sets of audio data frames, the number of DMA buffers is multiple, and each set of audio data frames includes at least one frame of audio data.
  • the program includes instructions for performing the following steps:
  • the multiple DMA buffers include a first DMA buffer and a second DMA buffer, and write a second frame of audio data to the second DMA buffer
  • the collection is performed simultaneously with the reading of the first set of audio data frames from the first DMA buffer, and the first set of audio data frames and the second set of audio data frames are any of the plurality of sets of audio data frames. Two distinct collections of audio dataframes.
  • the program further includes instructions for performing the following steps:
  • the operation of writing the set of audio data frames to the DMA buffer and the operation of reading audio data from the DMA buffer are stopped according to the play pause instruction.
  • the first audio file required for the soundtrack is obtained; the first audio file is transcoded to obtain the transcoded second audio file; the first video file to be soundtracked is obtained; Decoding the second audio file to obtain a first audio data stream, and encoding the first video file to obtain a video data stream; synthesizing the audio data stream and the video data stream to obtain a second video file,
  • the video soundtrack function of the function machine can be realized, and the software and hardware resources of the function machine can be saved.
  • FIG. 4 is a schematic structural diagram of a video soundtrack device for a functional machine provided by an embodiment of the present application, applied to a terminal device, and the device includes:
  • Obtaining unit 401 for obtaining the first audio file required for the soundtrack
  • the obtaining unit 401 is further configured to obtain the first video file to be composed
  • the processing unit 402 is further configured to decode the second audio file to obtain a first audio data stream, and encode the first video file to obtain a video data stream;
  • the processing unit 402 is further configured to synthesize the audio data stream and the video data stream to obtain a second video file.
  • the processing unit 402 is specifically configured to:
  • the first audio file is separated to obtain the separated audio file
  • the processing unit 402 is specifically configured to:
  • the file header in the second audio file is removed to obtain the decoded first audio data
  • the decoded first audio data is synthesized into the first audio data stream.
  • the obtaining unit 401 is specifically configured to:
  • the first video data is encoded to obtain an encoded first video file.
  • the processing unit 402 is further configured to:
  • the second video file is decomposed to obtain the decomposed second audio data and the first video data;
  • the first video data and the encoded and decoded second audio data stream are played synchronously.
  • the second audio data includes multiple sets of audio data frames, the number of DMA buffers is multiple, and each set of audio data frames includes at least one frame of audio data.
  • the above-mentioned processing unit 402 is specifically used for:
  • the multiple DMA buffers include a first DMA buffer and a second DMA buffer, and write a second frame of audio data to the second DMA buffer
  • the collection is performed simultaneously with the reading of the first set of audio data frames from the first DMA buffer, and the first set of audio data frames and the second set of audio data frames are any of the plurality of sets of audio data frames. Two distinct collections of audio dataframes.
  • processing unit 402 is further configured to:
  • the operation of writing the set of audio data frames to the DMA buffer and the operation of reading audio data from the DMA buffer are stopped according to the play pause instruction.
  • the first audio file required for the soundtrack is obtained; the first audio file is transcoded to obtain the transcoded second audio file; the first video file to be soundtracked is obtained; Decoding the second audio file to obtain a first audio data stream, and encoding the first video file to obtain a video data stream; synthesizing the audio data stream and the video data stream to obtain a second video file,
  • the video soundtrack function of the function machine can be realized, and the software and hardware resources of the function machine can be saved.
  • the obtaining unit 401 and the processing unit 402 in the apparatus may be implemented by a processor.
  • the obtaining unit 401 and the processing unit 402 in the apparatus may be implemented by a processor.
  • Embodiments of the present application further provide a computer storage medium, wherein the computer storage medium stores a computer program for storing a computer program, and the computer program causes a computer to execute part or all of the steps of any method described in the above method embodiments. Including user equipment.
  • Embodiments of the present application further provide a computer program product, where the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute any one of the method embodiments described above. some or all of the steps of the method.
  • the computer program product may be a software installation package, and the computer includes user equipment.
  • the disclosed apparatus may be implemented in other manners.
  • the apparatus embodiments described above are only illustrative, for example, the division of the above-mentioned units is only a logical function division, and other division methods may be used in actual implementation, for example, multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented.
  • the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical or other forms.
  • the above-mentioned units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • the above-mentioned integrated units if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable memory.
  • the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art, or all or part of the technical solution, and the computer software product is stored in a memory.
  • a computer device which may be a personal computer, a server, or a network device, etc.
  • the aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Human Computer Interaction (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

Embodiments of the present application provide a video dubbing method and apparatus for a functional machine, which are applied to a terminal device, and the terminal device belongs to a functional machine. Said method comprises: acquiring a first audio file required for dubbing; transcoding the first audio file to obtain a transcoded second audio file; acquiring a first video file to be dubbed; decoding the second audio file to obtain first audio data streams, and encoding the first video file to obtain video data streams; and synthesizing the audio data streams and the video data streams to obtain a second video file, so that the video dubbing function of the functional machine can be realized, and the software and hardware resources of the functional machine can be saved.

Description

功能机视频配乐方法、装置、终端设备及存储介质Function machine video soundtrack method, device, terminal device and storage medium 技术领域technical field
本申请涉及音视频技术领域,具体涉及一种功能机视频配乐方法、装置、终端设备及存储介质。The present application relates to the technical field of audio and video, and in particular, to a method, device, terminal device and storage medium for video soundtracking of a functional machine.
背景技术Background technique
在智能机(android操作系统)上配乐功能已经实现,为用户录制的视频配置其选择的特定音乐,其方法是通过位于应用层的软件实现,但是,目前对于功能机来说是无法兼容的,功能机的操作系统不能兼容智能机上的应用代码,例如,实时操作系统(Real-time operating system,RTOS),功能机没有java层。The soundtrack function has been implemented on the smart phone (android operating system), and the specific music selected by the user is configured for the video recorded by the user. The operating system of the function machine is not compatible with the application code on the smart machine, for example, a real-time operating system (RTOS), and the function machine does not have a java layer.
功能机受到成本和硬件条件的约束,其性能远远低于智能机,功能机的视频配乐功能的实现,需要尽量依靠其现有的功能模块来实现,以减少软硬件的开销,因此,如何实现功能机的视频配乐功能,并节省功能机的软硬件资源的问题需要解决。The function machine is constrained by cost and hardware conditions, and its performance is far lower than that of the smart machine. The realization of the video soundtrack function of the function machine needs to rely on its existing function modules as much as possible to reduce the overhead of software and hardware. Therefore, how to The problem of realizing the video soundtrack function of the feature phone and saving the software and hardware resources of the feature phone needs to be solved.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供了一种功能机视频配乐方法及装置,能够实现功能机的视频配乐功能,并节省功能机的软硬件资源。The embodiments of the present application provide a method and device for video soundtracking of a functional machine, which can realize the video soundtracking function of the functional machine and save the software and hardware resources of the functional machine.
第一方面,本申请实施例提供一种功能机视频配乐方法,该方法包括:In a first aspect, an embodiment of the present application provides a method for soundtracking a video of a functional machine, the method comprising:
获取配乐所需的第一音频文件;将所述第一音频文件进行转码,得到转码后的第二音频文件;obtaining the first audio file required for the soundtrack; transcoding the first audio file to obtain the transcoded second audio file;
获取待配乐的第一视频文件;Obtain the first video file to be composed;
将所述第二音频文件进行解码,得到第一音频数据流,以及,将所述第一视频文件进行编码,得到视频数据流;Decoding the second audio file to obtain a first audio data stream, and encoding the first video file to obtain a video data stream;
将所述音频数据流和所述视频数据流进行合成,得到第二视频文件。The audio data stream and the video data stream are synthesized to obtain a second video file.
第二方面,本申请实施例提供一种功能机视频配乐装置,所述装置包括:In a second aspect, an embodiment of the present application provides a video soundtrack device for a functional machine, the device comprising:
获取单元,用于获取配乐所需的第一音频文件;an acquisition unit for acquiring the first audio file required for the soundtrack;
处理单元,用于将所述第一音频文件进行转码,得到转码后的第二音频文件;a processing unit for transcoding the first audio file to obtain a transcoded second audio file;
所述获取单元,还用于获取待配乐的第一视频文件;The obtaining unit is also used to obtain the first video file to be composed;
所述处理单元,还用于将所述第二音频文件进行解码,得到第一音频数据流,以及,将所述第一视频文件进行编码,得到视频数据流;The processing unit is further configured to decode the second audio file to obtain a first audio data stream, and encode the first video file to obtain a video data stream;
所述处理单元,还用于将所述音频数据流和所述视频数据流进行合成,得到第二视频文件。The processing unit is further configured to synthesize the audio data stream and the video data stream to obtain a second video file.
第三方面,本申请实施例提供一种终端设备,包括处理器、存储器、通信接口以及一个或多个程序,其中,上述一个或多个程序被存储在上述存储器中,并且被配置由上述处理器执行,上述程序包括用于执行本申请实施例第一方面所述的方法中的步骤的指令。In a third aspect, embodiments of the present application provide a terminal device, including a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory, and are configured to be processed by the above-mentioned The above program includes instructions for executing the steps in the method described in the first aspect of the embodiments of the present application.
第四方面,本申请实施例提供了一种计算机可读存储介质,其中,上述计算机可读存储介质存储用于计算机程序,其中,上述计算机程序使得计算机执行如本申请实施例第一方面所述的方法中所描述的部分或全部步骤。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program causes a computer to execute the first aspect of the embodiment of the present application. some or all of the steps described in the method.
第五方面,本申请实施例提供了一种计算机程序产品,其中,上述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,上述计算机程序可操作来使计算机执行如本申请实施例第一方面所述的方法中所描述的部分或全部步骤。该计算机程序产品可以为一个软件安装包。In a fifth aspect, an embodiment of the present application provides a computer program product, wherein the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute as implemented in the present application. For example, some or all of the steps described in the method described in the first aspect. The computer program product may be a software installation package.
可以看出,在本申请实施例中,获取配乐所需的第一音频文件;将第一音频文件进行转码,得到转码后的第二音频文件;获取待配乐的第一视频文件;将所述第二音频文件进行解码,得到第一音频数据流,以及,将第一视频文件进行编码,得到视频数据流;将音频数据流和所述视频数据流进行合成,得到第二视频文件,如此,可实现功能机的视频配乐功能,并节省功能机的软硬件资源。It can be seen that, in the embodiment of the present application, the first audio file required for the soundtrack is obtained; the first audio file is transcoded to obtain the transcoded second audio file; the first video file to be soundtracked is obtained; Decoding the second audio file to obtain a first audio data stream, and encoding the first video file to obtain a video data stream; synthesizing the audio data stream and the video data stream to obtain a second video file, In this way, the video soundtrack function of the function machine can be realized, and the software and hardware resources of the function machine can be saved.
附图说明Description of drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1A是本申请实施例提供的一种功能机视频配乐方法的流程示意图;1A is a schematic flowchart of a method for soundtracking a video for a feature phone provided by an embodiment of the present application;
图1B是本申请实施例提供的一种DMA缓冲区进行第二音频数据的写入和读取的演示示意图;1B is a schematic diagram illustrating the writing and reading of second audio data in a DMA buffer provided by an embodiment of the present application;
图2是本申请实施例提供的另一种功能机视频配乐方法的流程示意图;2 is a schematic flowchart of another function machine video soundtrack method provided by an embodiment of the present application;
图3是本申请实施例提供的一种终端设备的结构示意图;3 is a schematic structural diagram of a terminal device provided by an embodiment of the present application;
图4是本申请实施例提供的一种功能机视频配乐装置的结构示意图。FIG. 4 is a schematic structural diagram of a video soundtrack device for a functional machine provided by an embodiment of the present application.
具体实施方式Detailed ways
本申请的实施方式部分使用的术语仅用于对本申请的具体实施例进行解释,而非旨在限定本申请。本申请的说明书和权利要求书及所述附图中的术语“第一”、“第二”、“第三”和“第四”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。The terms used in the embodiments of the present application are only used to explain specific embodiments of the present application, and are not intended to limit the present application. The terms "first", "second", "third" and "fourth" in the description and claims of the present application and the drawings are used to distinguish different objects, rather than to describe a specific order . Furthermore, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion.
本申请实施例中的终端设备是一种功能机,终端设备的操作系统例如可 以是RTOS,与智能机不同,智能机的操作系统一般为android操作系统,ios操作系统等,可以兼容较多应用程序,但是功能机的操作系统没有java层,无法兼容很多功能的应用程序。此外,功能机受到成本和硬件条件的约束,其性能远远低于智能机,功能机的视频配乐功能的实现,需要尽量依靠其现有的功能模块来实现,以减少软硬件的开销。The terminal device in the embodiment of the present application is a function machine, and the operating system of the terminal device may be RTOS, for example, and the operating system of the smart machine is generally an android operating system, an ios operating system, etc., which is compatible with many applications. program, but the operating system of the function machine does not have a java layer and cannot be compatible with many functional applications. In addition, the function machine is constrained by cost and hardware conditions, and its performance is far lower than that of the smart machine. The realization of the video soundtrack function of the function machine needs to rely on its existing function modules as much as possible to reduce the overhead of software and hardware.
具体地,本申请实施例中的终端设备具有无线通信功能的设备,可以部署在陆地上,包括室内或室外、手持、可穿戴或车载;也可以部署在水面上(如轮船等);还可以部署在空中(例如飞机、气球、卫星上等)。该终端设备可以是手机(mobile phone)、平板电脑(pad)、带无线收发功能的电脑、虚拟现实(virtual reality,VR)终端设备、增强现实(augmented reality,AR)终端设备、工业控制(industrial control)中的无线终端、无人驾驶(self driving)中的无线终端、远程医疗(remote medical)中的无线终端、智能电网(smart grid)中的无线终端、智能家庭(smart home)中的无线终端等。终端设备也可以是具有无线通信功能的手持设备、车载设备、可穿戴设备、计算机设备或连接到无线调制解调器的其他处理设备等。Specifically, the terminal device in this embodiment of the present application has a wireless communication function, and can be deployed on land, including indoor or outdoor, handheld, wearable, or vehicle-mounted; it can also be deployed on water (such as ships, etc.); or Deployed in the air (eg aircraft, balloons, satellites, etc.). The terminal device can be a mobile phone (mobile phone), a tablet computer (pad), a computer with a wireless transceiver function, a virtual reality (VR) terminal device, an augmented reality (AR) terminal device, an industrial control (industrial) terminal device wireless terminal in control), wireless terminal in self-driving, wireless terminal in remote medical, wireless terminal in smart grid, wireless terminal in smart home terminal etc. The terminal device may also be a handheld device with wireless communication function, a vehicle-mounted device, a wearable device, a computer device, or other processing device connected to a wireless modem.
请参见图1A,图1A为本申请实施例提供的一种功能机视频配乐方法的流程示意图,该功能机视频配乐方法应用于终端设备,终端设备属于功能机,本方法包括以下步骤:Please refer to FIG. 1A . FIG. 1A is a schematic flowchart of a method for soundtracking a video for a feature phone provided by an embodiment of the application. The method for soundtracking a video for a feature phone is applied to a terminal device, and the terminal device belongs to a feature phone. The method includes the following steps:
101、获取配乐所需的第一音频文件;将所述第一音频文件进行转码,得到转码后的第二音频文件。101. Obtain a first audio file required for the soundtrack; transcode the first audio file to obtain a transcoded second audio file.
其中,第一音频文件的音频格式可为以下任意一种:mp3、wav、midi或amr等,第一音频文件可以是用户通过终端设备录制的音频文件,也可以是从网上下载,从其他设备传输的音频文件,本申请实施例不作限制。The audio format of the first audio file may be any of the following: mp3, wav, midi, or amr, etc. The first audio file may be an audio file recorded by a user through a terminal device, or may be downloaded from the Internet, downloaded from other devices The audio file to be transmitted is not limited in this embodiment of the present application.
其中,第二音频文件可以是脉冲编码调制(pulse code modulation,pcm)类型的wav格式音频文件。Wherein, the second audio file may be a pulse code modulation (pulse code modulation, pcm) type audio file in wav format.
具体实施中,可将第一音频文件进行转码,具体可将音频格式为mp3、wav、midi或amr等的音频文件转换为pcm类型的wav格式音频文件,由于pcm类型的wav格式音频文件可以在功能机的操作系统中的多媒体接口(multi media interface,MMI)层实现,其中,MMI层可由c语言代码实现,如此,可被功能机兼容,从而可以解决功能机没有java层的缺陷。In the specific implementation, the first audio file can be transcoded, specifically, the audio file whose audio format is mp3, wav, midi or amr can be converted into a pcm-type wav-format audio file, because the pcm-type wav-format audio file can be It is implemented in the multimedia interface (multimedia interface, MMI) layer in the operating system of the function machine, wherein, the MMI layer can be realized by the C language code, so that it can be compatible with the function machine, so that the defect that the function machine does not have the java layer can be solved.
可选地,上述步骤101中,所述将所述第一音频文件进行转码,得到转码后的第二音频文件,可包括:Optionally, in the above step 101, the transcoding of the first audio file to obtain a transcoded second audio file may include:
11、将所述第一音频文件进行分离,得到分离后的音频文件;11. The first audio file is separated to obtain the separated audio file;
12、将所述分离后的音频文件进行解码,得到第一预设类型的第一音频数据;12. Decoding the separated audio file to obtain the first audio data of the first preset type;
13、对所述第一音频数据加装第一音频格式的文件头,得到所述第二音频文件。13. Add a file header of the first audio format to the first audio data to obtain the second audio file.
其中,第一预设类型可以为pcm类型,第一音频格式的文件头可以为wav文件头。The first preset type may be a pcm type, and the file header of the first audio format may be a wav file header.
具体实施中,可将第一音频文件进行分离,得到分离后的音频文件;将分离后的音频文件进行解码,得到第一预设类型的第一音频数据,例如pcm类型的第一音频数据;然后将pcm类型的第一音频数据输出为文件至闪存等存储设备,最后可对pcm类型的第一音频数据加装第一音频格式的文件头,例如,可加装wav文件头,得到第二音频文件,例如,pcm类型的wav格式音频文件,如此,可使第二音频文件可在功能机上实现视频配乐的功能,其中,第二音频文件可作为中间文件暂时存储在功能机的存储空间中。In a specific implementation, the first audio file can be separated to obtain the separated audio file; the separated audio file can be decoded to obtain the first audio data of the first preset type, for example, the first audio data of the pcm type; Then, the first audio data of the pcm type is output as a file to a storage device such as a flash memory, and finally a file header of the first audio format can be added to the first audio data of the pcm type, for example, a wav file header can be added to obtain the second The audio file, for example, a pcm-type wav format audio file, so that the second audio file can realize the function of video soundtrack on the function machine, wherein the second audio file can be temporarily stored as an intermediate file in the storage space of the function machine .
102、获取待配乐的第一视频文件。102. Acquire a first video file to be composed.
其中,获取待配乐的第一视频文件,可以是通过视频应用程序录制第一视频文件,或者,可以是接收外部设备传输的第一视频文件,或者还可以是从网络下载或者调用本地存储的第一视频文件。Wherein, obtaining the first video file to be composed may be recording the first video file through a video application, or may be receiving the first video file transmitted by an external device, or may be downloading from the network or calling the locally stored first video file. a video file.
可选地,上述步骤102中,获取待配乐的第一视频文件,可包括以下步骤:Optionally, in the above-mentioned step 102, obtaining the first video file to be composed may include the following steps:
录制第一视频数据;record first video data;
将所述第一视频数据进行编码,得到编码后的第一视频文件。The first video data is encoded to obtain an encoded first video file.
本申请实施例中,录制第一视频文件可与将第一音频文件进行转码同时进行。In this embodiment of the present application, the recording of the first video file may be performed simultaneously with the transcoding of the first audio file.
103、将所述第二音频文件进行解码,得到第一音频数据流。103. Decode the second audio file to obtain a first audio data stream.
具体实施中,不需要进行视频录音编码,而是基于功能机的现有功能,将第二音频文件解码为第一音频数据流,将第一视频文件进行编码,得到视频数据流,从而可以在功能机上实现视频配乐的功能。In the specific implementation, it is not necessary to perform video recording encoding, but based on the existing functions of the functional machine, the second audio file is decoded into the first audio data stream, and the first video file is encoded to obtain the video data stream, so that the video data stream can be The function of realizing video soundtrack on the function machine.
可选地,上述步骤103中,所述将所述第二音频文件进行解码,得到第一音频数据流,可包括:Optionally, in the above step 103, the decoding of the second audio file to obtain the first audio data stream may include:
将所述第二音频文件中的所述文件头去除,得到解码后的第一音频数据;The file header in the second audio file is removed to obtain the decoded first audio data;
将所述解码后的第一音频数据合成所述第一音频数据流。The decoded first audio data is synthesized into the first audio data stream.
具体实施中,可将pcm类型的wav格式音频文件中的wav文件头去除,得到pcm类型的第一音频数据,然后,将解码后的pcm类型的第一音频数据合成第一音频数据流。In a specific implementation, the wav file header in the pcm-type wav format audio file can be removed to obtain the pcm-type first audio data, and then the decoded pcm-type first audio data can be synthesized into the first audio data stream.
可选地,若第一视频文件的视频时长大于所述第二音频文件的音频时长,则可循环使用该第二音频文件,具体地,可在将第二音频文件进行解码之后,重新将第二音频文件进行解码,或者,可以暂停视频播放。Optionally, if the video duration of the first video file is greater than the audio duration of the second audio file, the second audio file can be used cyclically. Specifically, after the second audio file is decoded, the Two audio files are decoded, or, video playback can be paused.
104、将所述第一音频数据流和所述第一视频文件进行合成,得到第二视 频文件。104. Synthesize the first audio data stream and the first video file to obtain a second video file.
本申请实施例中,可将第一音频数据流和第一视频文件进行合成,得到第二视频文件,从而将音频数据和视频数据作为一个文件进行存储和传输。In this embodiment of the present application, the first audio data stream and the first video file may be synthesized to obtain the second video file, so that the audio data and the video data are stored and transmitted as one file.
可选地,上述步骤104之后,还可包括以下步骤:Optionally, after the above step 104, the following steps may also be included:
105、将所述第二视频文件进行分解,得到分解后的第二音频数据和第一视频数据;105, decompose the second video file to obtain the decomposed second audio data and the first video data;
106、将所述第二音频数据写入直接存储器访问(direct memory access,DMA)缓冲区;106, write the second audio data into a direct memory access (direct memory access, DMA) buffer;
107、读取所述DMA缓冲区的第二音频数据,进行编解码处理,得到编解码处理后的第二音频数据流;107, read the second audio data of the DMA buffer, carry out encoding and decoding processing, and obtain the second audio data stream after encoding and decoding processing;
108、将所述第一视频数据与所述编解码处理后的第二音频数据流进行同步播放。108. Synchronously play the first video data and the encoded and decoded second audio data stream.
本申请实施例中,还可将第二视频文件进行播放,具体地,可先将第二视频文件进行分解,得到分解后的第二音频数据和第一视频数据,针对第二音频数据,可将第二音频数据写入DMA缓冲区,然后,从DMA缓冲区读取第二音频数据,进行编解码处理,得到编解码处理后的第二音频数据流,将第二音频数据流传输至播放硬件装置,例如喇叭、听筒或耳机;同时,将第一视频数据以相同的时间线传输至显示屏进行播放。In the embodiment of the present application, the second video file may also be played. Specifically, the second video file may be decomposed first to obtain decomposed second audio data and first video data. For the second audio data, you may Write the second audio data into the DMA buffer, then read the second audio data from the DMA buffer, perform encoding and decoding processing, obtain the second audio data stream after encoding and decoding processing, and transmit the second audio data stream to playback A hardware device, such as a speaker, an earpiece or an earphone; at the same time, the first video data is transmitted to the display screen for playback in the same time line.
可见,本申请通过将第二音频数据直接写入DMA缓冲区,不需要将第二音频数据写入磁道缓冲区,使DMA缓冲区传输的数据量增大,使DMA传输过程中的中断大量减少,可以使终端设备在相同环境下,听更长时间的音乐。It can be seen that by directly writing the second audio data into the DMA buffer, the present application does not need to write the second audio data into the track buffer, so that the amount of data transmitted in the DMA buffer increases, and the interruption in the DMA transmission process is greatly reduced. , so that the terminal device can listen to music for a longer time in the same environment.
可选地,所述第二音频数据包括多个音频数据帧集合,DMA缓冲区的数量有多个,每一所述音频数据帧集合包括至少一帧音频数据,上述步骤106中,所述将所述第二音频数据写入DMA缓冲区,包括:Optionally, the second audio data includes multiple sets of audio data frames, the number of DMA buffers is multiple, and each set of audio data frames includes at least one frame of audio data. In the above step 106, the The second audio data is written into the DMA buffer, including:
61、将所述多帧音频数据写入多个DMA缓冲区,其中,多个DMA缓冲区包括第一DMA缓冲区和第二DMA缓冲区,对所述第二DMA缓冲区写入第二音频数据帧集合与从所述第一DMA缓冲区读取第一音频数据帧集合同时进行,所述第一音频数据帧集合和所述第二音频数据帧集合为所述多个音频数据帧集合中的任意两个不同的音频数据帧集合。61. Write the multi-frame audio data into multiple DMA buffers, wherein the multiple DMA buffers include a first DMA buffer and a second DMA buffer, and write a second audio into the second DMA buffer The data frame set is performed at the same time as the first audio data frame set is read from the first DMA buffer, and the first audio data frame set and the second audio data frame set are among the plurality of audio data frame sets. A collection of any two distinct audio data frames.
本申请实施例中,可将第二音频数据写入不同的多个DMA缓冲区,例如,如图1B所示,图1B为本申请实施例提供的一种DMA缓冲区进行第二音频数据的写入和读取的演示示意图,其中,可首先将第一音频数据帧集合的至少一帧音频数据写入第一DMA缓冲区,写入完成之后,将第二音频数据帧集合的至少一帧音频数据写入第二DMA缓冲区,在写入第二DMA缓冲区的过程中,可同时从第一DMA缓冲区读取第一音频数据帧集合的至少一帧音频数据,进行编解码处理,得到编解码处理,得到编解码处理后的音频数据流, 如此,可提升终端设备处理音频数据的效率。In this embodiment of the present application, the second audio data may be written into different multiple DMA buffers. For example, as shown in FIG. 1B , FIG. Demonstration schematic diagram of writing and reading, wherein at least one frame of audio data of the first set of audio data frames can be written into the first DMA buffer, and after the writing is completed, at least one frame of the second set of audio data frames can be written. The audio data is written into the second DMA buffer, and in the process of writing into the second DMA buffer, at least one frame of audio data of the first audio data frame set can be read from the first DMA buffer at the same time, and encoding and decoding processing is performed, The encoding and decoding processing is obtained, and the audio data stream after the encoding and decoding processing is obtained, in this way, the efficiency of processing the audio data by the terminal device can be improved.
可选地,本申请实施例中,还可包括以下步骤:Optionally, in this embodiment of the present application, the following steps may also be included:
接收对所述第二视频文件的暂停播放指令;receiving a pause play instruction for the second video file;
根据所述暂停播放指令停止向所述DMA缓冲区写入音频数据帧集合的操作,以及停止从所述DMA缓冲区读取音频数据的操作。The operation of writing the set of audio data frames to the DMA buffer and the operation of reading audio data from the DMA buffer are stopped according to the play pause instruction.
本申请实施例中,用户可对第二视频文件进行暂停播放,此时,可停止向所述DMA缓冲区写入音频数据帧集合的操作,以及停止从所述DMA缓冲区读取音频数据的操作,由于本方案不需要先将第二音频数据写入磁道缓冲区,再从磁道缓冲区读取第二音频数据写入DMA缓冲区,因此,可在暂停播放视频等触发DMA中断时,减少从磁道缓冲区向DMA缓冲区拷贝依次第二音频数据的操作,从而减少终端设备的功耗,提升音频数据处理效率。In this embodiment of the present application, the user may pause the playback of the second video file, and at this time, the operation of writing the set of audio data frames to the DMA buffer and the reading of audio data from the DMA buffer may be stopped. operation, because this solution does not need to write the second audio data into the track buffer first, and then read the second audio data from the track buffer and write it into the DMA buffer, therefore, when the DMA interrupt is triggered by pausing the video playback, reduce the The operation of copying the second audio data in sequence from the track buffer to the DMA buffer, thereby reducing the power consumption of the terminal device and improving the audio data processing efficiency.
可以看出,在本申请实施例中,获取配乐所需的第一音频文件;将第一音频文件进行转码,得到转码后的第二音频文件;获取待配乐的第一视频文件;将所述第二音频文件进行解码,得到第一音频数据流,以及,将第一视频文件进行编码,得到视频数据流;将音频数据流和所述视频数据流进行合成,得到第二视频文件,如此,可实现功能机的视频配乐功能,并节省功能机的软硬件资源。It can be seen that, in the embodiment of the present application, the first audio file required for the soundtrack is obtained; the first audio file is transcoded to obtain the transcoded second audio file; the first video file to be soundtracked is obtained; Decoding the second audio file to obtain a first audio data stream, and encoding the first video file to obtain a video data stream; synthesizing the audio data stream and the video data stream to obtain a second video file, In this way, the video soundtrack function of the function machine can be realized, and the software and hardware resources of the function machine can be saved.
请参见图2,图2为本申请实施例提供的另一种功能机视频配乐方法的流程示意图,该功能机视频配乐方法应用于终端设备,终端设备属于功能机,本方法包括以下步骤:Please refer to FIG. 2. FIG. 2 is a schematic flowchart of another feature machine video soundtrack method provided by an embodiment of the present application. The feature machine video soundtrack method is applied to a terminal device, and the terminal device belongs to a feature machine. The method includes the following steps:
201、获取配乐所需的第一音频文件。201. Obtain a first audio file required for the soundtrack.
其中,第一音频文件的音频格式可为以下任意一种:mp3、wav、midi或amr等。The audio format of the first audio file may be any one of the following: mp3, wav, midi, or amr.
具体实施中,用户可选择配乐所需的第一音频文件。In a specific implementation, the user can select the first audio file required for the soundtrack.
202、将所述第一音频文件进行分离,得到分离后的音频文件。202. Separate the first audio file to obtain a separated audio file.
203、将所述分离后的音频文件进行解码,得到第一预设类型的第一音频数据。203. Decode the separated audio file to obtain first audio data of a first preset type.
其中,第一预设类型可以为pcm类型。Wherein, the first preset type may be a pcm type.
204、对所述第一音频数据加装第一音频格式的文件头,得到所述第二音频文件。204. Add a file header of a first audio format to the first audio data to obtain the second audio file.
其中,第一音频格式的文件头可以为wav文件头,第二音频文件可以是pcm类型的wav格式音频文件。The file header of the first audio format may be a wav file header, and the second audio file may be a pcm-type wav format audio file.
205、获取待配乐的第一视频文件。205. Acquire a first video file to be composed.
具体实施中,用户可通过终端设备进行视频录制,得到第一视频文件。In a specific implementation, the user may perform video recording through the terminal device to obtain the first video file.
206、将所述第二音频文件中的所述文件头去除,得到解码后的第一音频 数据。206. Remove the file header in the second audio file to obtain decoded first audio data.
具体实施中,可将pcm类型的wav格式音频文件中的wav文件头去除,得到pcm类型的第一音频数据。In a specific implementation, the wav file header in the pcm-type wav format audio file may be removed to obtain the pcm-type first audio data.
207、将所述解码后的第一音频数据合成所述第一音频数据流。207. Synthesize the decoded first audio data into the first audio data stream.
208、将所述第一音频数据流和所述第一视频文件进行合成,得到第二视频文件。208. Synthesize the first audio data stream and the first video file to obtain a second video file.
209、将所述第二视频文件进行分解,得到分解后的第二音频数据和第一视频数据。209. Decompose the second video file to obtain decomposed second audio data and first video data.
210、将所述第二音频数据写入直接存储器访问DMA缓冲区。210. Write the second audio data into the direct memory access DMA buffer.
211、读取所述DMA缓冲区的第二音频数据,进行编解码处理,得到编解码处理后的第二音频数据流。211. Read the second audio data in the DMA buffer, perform encoding and decoding processing, and obtain a second audio data stream after encoding and decoding processing.
212、将所述第一视频数据与所述编解码处理后的第二音频数据流进行同步播放。212. Synchronously play the first video data and the encoded and decoded second audio data stream.
其中,上述步骤201-步骤212的具体实现过程可参照步骤101-步骤104中相应的描述,在此不再赘述。The specific implementation process of the above steps 201 to 212 may refer to the corresponding descriptions in the steps 101 to 104, which will not be repeated here.
可以看出,在本申请实施例中,获取配乐所需的第一音频文件,将所述第一音频文件进行分离,得到分离后的音频文件,将所述分离后的音频文件进行解码,得到第一预设类型的第一音频数据,对所述第一音频数据加装第一音频格式的文件头,得到所述第二音频文件,获取待配乐的第一视频文件,将所述第二音频文件中的所述文件头去除,得到解码后的第一音频数据,将所述解码后的第一音频数据合成所述第一音频数据流,将所述第一音频数据流和所述第一视频文件进行合成,得到第二视频文件,将所述第二视频文件进行分解,得到分解后的第二音频数据和第一视频数据,将所述第二音频数据写入直接存储器访问DMA缓冲区,读取所述DMA缓冲区的第二音频数据,进行编解码处理,得到编解码处理后的第二音频数据流,将所述第一视频数据与所述编解码处理后的第二音频数据流进行同步播放,如此,可实现功能机的视频配乐功能,并节省功能机的软硬件资源。It can be seen that, in the embodiment of the present application, the first audio file required for the soundtrack is obtained, the first audio file is separated to obtain the separated audio file, and the separated audio file is decoded to obtain For the first audio data of the first preset type, add a file header of the first audio format to the first audio data, obtain the second audio file, obtain the first video file to be accompanied by music, and add the second audio file to the second audio file. The file header in the audio file is removed, the decoded first audio data is obtained, the decoded first audio data is synthesized into the first audio data stream, and the first audio data stream and the first audio data stream are combined. A video file is synthesized to obtain a second video file, the second video file is decomposed, the decomposed second audio data and the first video data are obtained, and the second audio data is written into the direct memory access DMA buffer area, read the second audio data of the DMA buffer, perform encoding and decoding processing, obtain the second audio data stream after the encoding and decoding processing, and combine the first video data with the second audio after the encoding and decoding processing. The data stream is played synchronously, in this way, the video soundtrack function of the function machine can be realized, and the software and hardware resources of the function machine can be saved.
请参见图3,图3是本申请实施例提供的一种终端设备的结构示意图,包括:一个或多个处理器、一个或多个存储器、一个或多个通信接口,以及一个或多个程序;Please refer to FIG. 3. FIG. 3 is a schematic structural diagram of a terminal device provided by an embodiment of the present application, including: one or more processors, one or more memories, one or more communication interfaces, and one or more programs ;
所述一个或多个程序被存储在所述存储器中,并且被配置由所述一个或多个处理器执行;the one or more programs are stored in the memory and configured to be executed by the one or more processors;
所述程序包括用于执行以下步骤的指令:The program includes instructions for performing the following steps:
获取配乐所需的第一音频文件;将所述第一音频文件进行转码,得到转码后的第二音频文件;obtaining the first audio file required for the soundtrack; transcoding the first audio file to obtain the transcoded second audio file;
获取待配乐的第一视频文件;Obtain the first video file to be composed;
将所述第二音频文件进行解码,得到第一音频数据流;The second audio file is decoded to obtain the first audio data stream;
将所述第一音频数据流和所述第一视频文件进行合成,得到第二视频文件。The first audio data stream and the first video file are synthesized to obtain a second video file.
在本申请的一实现方式中,在所述将所述第一音频文件进行转码,得到转码后的第二音频文件方面,所述程序包括还用于执行以下步骤的指令:In an implementation manner of the present application, in the aspect of transcoding the first audio file to obtain the transcoded second audio file, the program includes instructions for performing the following steps:
将所述第一音频文件进行分离,得到分离后的音频文件;The first audio file is separated to obtain the separated audio file;
将所述分离后的音频文件进行解码,得到第一预设类型的第一音频数据;Decoding the separated audio file to obtain the first audio data of the first preset type;
对所述第一音频数据加装第一音频格式的文件头,得到所述第二音频文件。A file header of a first audio format is added to the first audio data to obtain the second audio file.
在本申请的一实现方式中,在所述将所述第二音频文件进行解码,得到第一音频数据流方面,所述程序包括还用于执行以下步骤的指令:In an implementation manner of the present application, in the aspect of decoding the second audio file to obtain the first audio data stream, the program includes instructions for performing the following steps:
将所述第二音频文件中的所述文件头去除,得到解码后的第一音频数据;The file header in the second audio file is removed to obtain the decoded first audio data;
将所述解码后的第一音频数据合成所述第一音频数据流。The decoded first audio data is synthesized into the first audio data stream.
在本申请的一实现方式中,在所述获取待配乐的第一视频文件方面,所述程序包括用于执行以下步骤的指令:In an implementation manner of the present application, in the aspect of obtaining the first video file to be composed, the program includes instructions for performing the following steps:
录制第一视频数据;record first video data;
将所述第一视频数据进行编码,得到编码后的第一视频文件。The first video data is encoded to obtain an encoded first video file.
在本申请的一实现方式中,在所述将所述第一音频数据流和所述第一视频文件进行合成,得到第二视频文件之后,所述程序包括还用于执行以下步骤的指令:In an implementation manner of the present application, after synthesizing the first audio data stream and the first video file to obtain the second video file, the program includes an instruction for performing the following steps:
将所述第二视频文件进行分解,得到分解后的第二音频数据和第一视频数据;The second video file is decomposed to obtain the decomposed second audio data and the first video data;
将所述第二音频数据写入直接存储器访问DMA缓冲区;writing the second audio data into a direct memory access DMA buffer;
读取所述DMA缓冲区的第二音频数据,进行编解码处理,得到编解码处理后的第二音频数据流;Read the second audio data of the DMA buffer, carry out encoding and decoding processing, and obtain the second audio data stream after encoding and decoding processing;
将所述第一视频数据与所述编解码处理后的第二音频数据流进行同步播放。The first video data and the encoded and decoded second audio data stream are played synchronously.
在本申请的一实现方式中,所述第二音频数据包括多个音频数据帧集合,DMA缓冲区的数量有多个,每一所述音频数据帧集合包括至少一帧音频数据,在所述将所述第二音频数据写入DMA缓冲区方面,所述程序包括用于执行以下步骤的指令:In an implementation manner of the present application, the second audio data includes multiple sets of audio data frames, the number of DMA buffers is multiple, and each set of audio data frames includes at least one frame of audio data. In terms of writing the second audio data to a DMA buffer, the program includes instructions for performing the following steps:
将所述多帧音频数据写入多个DMA缓冲区,其中,多个DMA缓冲区包括第一DMA缓冲区和第二DMA缓冲区,对所述第二DMA缓冲区写入第二音频数据帧集合与从所述第一DMA缓冲区读取第一音频数据帧集合同时进行,所述第一音频数据帧集合和所述第二音频数据帧集合为所述多个音频数 据帧集合中的任意两个不同的音频数据帧集合。Write the multi-frame audio data into multiple DMA buffers, wherein the multiple DMA buffers include a first DMA buffer and a second DMA buffer, and write a second frame of audio data to the second DMA buffer The collection is performed simultaneously with the reading of the first set of audio data frames from the first DMA buffer, and the first set of audio data frames and the second set of audio data frames are any of the plurality of sets of audio data frames. Two distinct collections of audio dataframes.
在本申请的一实现方式中,所述程序还包括用于执行以下步骤的指令:In an implementation of the present application, the program further includes instructions for performing the following steps:
接收对所述第二视频文件的暂停播放指令;receiving a pause play instruction for the second video file;
根据所述暂停播放指令停止向所述DMA缓冲区写入音频数据帧集合的操作,以及停止从所述DMA缓冲区读取音频数据的操作。The operation of writing the set of audio data frames to the DMA buffer and the operation of reading audio data from the DMA buffer are stopped according to the play pause instruction.
可以看出,在本申请实施例中,获取配乐所需的第一音频文件;将第一音频文件进行转码,得到转码后的第二音频文件;获取待配乐的第一视频文件;将所述第二音频文件进行解码,得到第一音频数据流,以及,将第一视频文件进行编码,得到视频数据流;将音频数据流和所述视频数据流进行合成,得到第二视频文件,如此,可实现功能机的视频配乐功能,并节省功能机的软硬件资源。It can be seen that, in the embodiment of the present application, the first audio file required for the soundtrack is obtained; the first audio file is transcoded to obtain the transcoded second audio file; the first video file to be soundtracked is obtained; Decoding the second audio file to obtain a first audio data stream, and encoding the first video file to obtain a video data stream; synthesizing the audio data stream and the video data stream to obtain a second video file, In this way, the video soundtrack function of the function machine can be realized, and the software and hardware resources of the function machine can be saved.
需要说明的是,本实施例的具体实现过程可参见上述方法实施例所述的具体实现过程,在此不再叙述。It should be noted that, for the specific implementation process of this embodiment, reference may be made to the specific implementation process described in the foregoing method embodiment, which is not described herein again.
请参见图4,图4是本申请实施例提供的一种功能机视频配乐装置的结构示意图,应用于终端设备,该装置包括:Please refer to FIG. 4. FIG. 4 is a schematic structural diagram of a video soundtrack device for a functional machine provided by an embodiment of the present application, applied to a terminal device, and the device includes:
获取单元401,用于获取配乐所需的第一音频文件;Obtaining unit 401, for obtaining the first audio file required for the soundtrack;
处理单元402,用于将所述第一音频文件进行转码,得到转码后的第二音频文件;a processing unit 402 for transcoding the first audio file to obtain a transcoded second audio file;
所述获取单元401,还用于获取待配乐的第一视频文件;The obtaining unit 401 is further configured to obtain the first video file to be composed;
所述处理单元402,还用于将所述第二音频文件进行解码,得到第一音频数据流,以及,将所述第一视频文件进行编码,得到视频数据流;The processing unit 402 is further configured to decode the second audio file to obtain a first audio data stream, and encode the first video file to obtain a video data stream;
所述处理单元402,还用于将所述音频数据流和所述视频数据流进行合成,得到第二视频文件。The processing unit 402 is further configured to synthesize the audio data stream and the video data stream to obtain a second video file.
在本申请的一实现方式中,在所述将所述第一音频文件进行转码,得到转码后的第二音频文件方面,上述处理单元402具体用于:In an implementation manner of the present application, in the aspect of transcoding the first audio file to obtain the transcoded second audio file, the processing unit 402 is specifically configured to:
将所述第一音频文件进行分离,得到分离后的音频文件;The first audio file is separated to obtain the separated audio file;
将所述分离后的音频文件进行解码,得到第一预设类型的第一音频数据;Decoding the separated audio file to obtain the first audio data of the first preset type;
对所述第一音频数据加装第一音频格式的文件头,得到所述第二音频文件Add the file header of the first audio format to the first audio data to obtain the second audio file
在本申请的一实现方式中,在所述将所述第二音频文件进行解码,得到第一音频数据流方面,上述处理单元402具体用于:In an implementation manner of the present application, in the aspect of decoding the second audio file to obtain the first audio data stream, the processing unit 402 is specifically configured to:
将所述第二音频文件中的所述文件头去除,得到解码后的第一音频数据;The file header in the second audio file is removed to obtain the decoded first audio data;
将所述解码后的第一音频数据合成所述第一音频数据流。The decoded first audio data is synthesized into the first audio data stream.
在本申请的一实现方式中,在所述获取待配乐的第一视频文件方面,上述获取单元401具体用于:In an implementation manner of the present application, in the aspect of obtaining the first video file to be composed, the obtaining unit 401 is specifically configured to:
录制第一视频数据;record first video data;
将所述第一视频数据进行编码,得到编码后的第一视频文件。The first video data is encoded to obtain an encoded first video file.
在本申请的一实现方式中,在所述将所述第一音频数据流和所述第一视频文件进行合成,得到第二视频文件之后,上述处理单元402还用于:In an implementation manner of the present application, after synthesizing the first audio data stream and the first video file to obtain the second video file, the processing unit 402 is further configured to:
将所述第二视频文件进行分解,得到分解后的第二音频数据和第一视频数据;The second video file is decomposed to obtain the decomposed second audio data and the first video data;
将所述第二音频数据写入直接存储器访问DMA缓冲区;writing the second audio data into a direct memory access DMA buffer;
读取所述DMA缓冲区的第二音频数据,进行编解码处理,得到编解码处理后的第二音频数据流;Read the second audio data of the DMA buffer, carry out encoding and decoding processing, and obtain the second audio data stream after encoding and decoding processing;
将所述第一视频数据与所述编解码处理后的第二音频数据流进行同步播放。The first video data and the encoded and decoded second audio data stream are played synchronously.
在本申请的一实现方式中,所述第二音频数据包括多个音频数据帧集合,DMA缓冲区的数量有多个,每一所述音频数据帧集合包括至少一帧音频数据,在所述将所述第二音频数据写入DMA缓冲区方面,上述处理单元402具体用于:In an implementation manner of the present application, the second audio data includes multiple sets of audio data frames, the number of DMA buffers is multiple, and each set of audio data frames includes at least one frame of audio data. In terms of writing the second audio data into the DMA buffer, the above-mentioned processing unit 402 is specifically used for:
将所述多帧音频数据写入多个DMA缓冲区,其中,多个DMA缓冲区包括第一DMA缓冲区和第二DMA缓冲区,对所述第二DMA缓冲区写入第二音频数据帧集合与从所述第一DMA缓冲区读取第一音频数据帧集合同时进行,所述第一音频数据帧集合和所述第二音频数据帧集合为所述多个音频数据帧集合中的任意两个不同的音频数据帧集合。Write the multi-frame audio data into multiple DMA buffers, wherein the multiple DMA buffers include a first DMA buffer and a second DMA buffer, and write a second frame of audio data to the second DMA buffer The collection is performed simultaneously with the reading of the first set of audio data frames from the first DMA buffer, and the first set of audio data frames and the second set of audio data frames are any of the plurality of sets of audio data frames. Two distinct collections of audio dataframes.
在本申请的一实现方式中,上述处理单元402还用于:In an implementation manner of the present application, the above-mentioned processing unit 402 is further configured to:
接收对所述第二视频文件的暂停播放指令;receiving a pause play instruction for the second video file;
根据所述暂停播放指令停止向所述DMA缓冲区写入音频数据帧集合的操作,以及停止从所述DMA缓冲区读取音频数据的操作。The operation of writing the set of audio data frames to the DMA buffer and the operation of reading audio data from the DMA buffer are stopped according to the play pause instruction.
可以看出,在本申请实施例中,获取配乐所需的第一音频文件;将第一音频文件进行转码,得到转码后的第二音频文件;获取待配乐的第一视频文件;将所述第二音频文件进行解码,得到第一音频数据流,以及,将第一视频文件进行编码,得到视频数据流;将音频数据流和所述视频数据流进行合成,得到第二视频文件,如此,可实现功能机的视频配乐功能,并节省功能机的软硬件资源。It can be seen that, in the embodiment of the present application, the first audio file required for the soundtrack is obtained; the first audio file is transcoded to obtain the transcoded second audio file; the first video file to be soundtracked is obtained; Decoding the second audio file to obtain a first audio data stream, and encoding the first video file to obtain a video data stream; synthesizing the audio data stream and the video data stream to obtain a second video file, In this way, the video soundtrack function of the function machine can be realized, and the software and hardware resources of the function machine can be saved.
需要说明的是,所述装置中获取单元401、以及处理单元402可通过处理器实现。本申请实施例中的具体实施步骤和其他实施步骤,可参见上述方法实施例所述的具体实现过程,在此不再叙述。It should be noted that, the obtaining unit 401 and the processing unit 402 in the apparatus may be implemented by a processor. For the specific implementation steps and other implementation steps in the embodiments of the present application, reference may be made to the specific implementation processes described in the foregoing method embodiments, which are not described herein again.
本申请实施例还提供一种计算机存储介质,其中,该计算机存储介质存储用于存储计算机程序,该计算机程序使得计算机执行如上述方法实施例中 记载的任一方法的部分或全部步骤,上述计算机包括用户设备。Embodiments of the present application further provide a computer storage medium, wherein the computer storage medium stores a computer program for storing a computer program, and the computer program causes a computer to execute part or all of the steps of any method described in the above method embodiments. Including user equipment.
本申请实施例还提供一种计算机程序产品,上述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,上述计算机程序可操作来使计算机执行如上述方法实施例中记载的任一方法的部分或全部步骤。该计算机程序产品可以为一个软件安装包,上述计算机包括用户设备。Embodiments of the present application further provide a computer program product, where the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute any one of the method embodiments described above. some or all of the steps of the method. The computer program product may be a software installation package, and the computer includes user equipment.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that, for the sake of simple description, the foregoing method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described action sequence. Because in accordance with the present application, certain steps may be performed in other orders or concurrently. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如上述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the apparatus embodiments described above are only illustrative, for example, the division of the above-mentioned units is only a logical function division, and other division methods may be used in actual implementation, for example, multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical or other forms.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The above-mentioned units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
上述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例上述方法的全部或部分步骤。而前述的存储器包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。The above-mentioned integrated units, if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art, or all or part of the technical solution, and the computer software product is stored in a memory, Several instructions are included to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the above-mentioned methods in the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令相关的硬件来完成,该程序可以存储于一计算机可读存储器中,存储器可以包括:闪存盘、只读存储器(英文:Read-Only Memory,简称:ROM)、随机存取器(英文:Random Access Memory,简称:RAM)、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a program, and the program can be stored in a computer-readable memory, and the memory can include: a flash disk , Read-only memory (English: Read-Only Memory, referred to as: ROM), random access device (English: Random Access Memory, referred to as: RAM), magnetic disk or optical disk, etc.
以上对本申请实施例进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The embodiments of the present application are described in detail above, and specific examples are used in this paper to illustrate the principles and implementations of the present application. The descriptions of the above embodiments are only used to help understand the methods and core ideas of the present application; at the same time, for Persons of ordinary skill in the art, based on the idea of the present application, will have changes in the specific implementation manner and application scope. In summary, the contents of this specification should not be construed as limitations on the present application.

Claims (21)

  1. 一种功能机视频配乐方法,其特征在于,所述方法包括:A function machine video soundtrack method, characterized in that the method comprises:
    获取配乐所需的第一音频文件;将所述第一音频文件进行转码,得到转码后的第二音频文件;Obtain the first audio file required for the soundtrack; transcode the first audio file to obtain the transcoded second audio file;
    获取待配乐的第一视频文件;Obtain the first video file to be composed;
    将所述第二音频文件进行解码,得到第一音频数据流;The second audio file is decoded to obtain the first audio data stream;
    将所述第一音频数据流和所述第一视频文件进行合成,得到第二视频文件。The first audio data stream and the first video file are synthesized to obtain a second video file.
  2. 根据权利要求1所述的方法,其特征在于,所述将所述第一音频文件进行转码,得到转码后的第二音频文件,包括:The method according to claim 1, wherein the transcoding the first audio file to obtain the transcoded second audio file comprises:
    将所述第一音频文件进行分离,得到分离后的音频文件;The first audio file is separated to obtain the separated audio file;
    将所述分离后的音频文件进行解码,得到第一预设类型的第一音频数据;Decoding the separated audio file to obtain the first audio data of the first preset type;
    对所述第一音频数据加装第一音频格式的文件头,得到所述第二音频文件。A file header of a first audio format is added to the first audio data to obtain the second audio file.
  3. 根据权利要求1或2所述的方法,其特征在于,所述将所述第二音频文件进行解码,得到第一音频数据流,包括:The method according to claim 1 or 2, wherein the decoding the second audio file to obtain the first audio data stream comprises:
    将所述第二音频文件中的所述文件头去除,得到解码后的第一音频数据;The file header in the second audio file is removed to obtain the decoded first audio data;
    将所述解码后的第一音频数据合成所述第一音频数据流。The decoded first audio data is synthesized into the first audio data stream.
  4. 根据权利要求3所述的方法,其特征在于,所述获取待配乐的第一视频文件,包括:The method according to claim 3, wherein the acquiring the first video file to be composed comprises:
    录制第一视频数据;record first video data;
    将所述第一视频数据进行编码,得到编码后的第一视频文件。The first video data is encoded to obtain an encoded first video file.
  5. 根据权利要求4所述的方法,其特征在于,在所述将所述第一音频数据流和所述第一视频文件进行合成,得到第二视频文件之后,所述方法还包括:The method according to claim 4, wherein after synthesizing the first audio data stream and the first video file to obtain the second video file, the method further comprises:
    将所述第二视频文件进行分解,得到分解后的第二音频数据和第一视频数据;The second video file is decomposed to obtain the decomposed second audio data and the first video data;
    将所述第二音频数据写入直接存储器访问DMA缓冲区;writing the second audio data into a direct memory access DMA buffer;
    读取所述DMA缓冲区的第二音频数据,进行编解码处理,得到编解码处理后的第二音频数据流;Read the second audio data of the DMA buffer, carry out encoding and decoding processing, and obtain the second audio data stream after encoding and decoding processing;
    将所述第一视频数据与所述编解码处理后的第二音频数据流进行同步播放。The first video data and the encoded and decoded second audio data stream are played synchronously.
  6. 根据权利要求5所述的方法,其特征在于,所述第二音频数据包括多个音频数据帧集合,DMA缓冲区的数量有多个,每一所述音频数据帧集合包括至少一帧音频数据,所述将所述第二音频数据写入DMA缓冲区,包括:The method according to claim 5, wherein the second audio data includes multiple sets of audio data frames, the number of DMA buffers is multiple, and each set of audio data frames includes at least one frame of audio data , the writing of the second audio data into the DMA buffer includes:
    将所述多帧音频数据写入多个DMA缓冲区,其中,多个DMA缓冲区包括第一DMA缓冲区和第二DMA缓冲区,对所述第二DMA缓冲区写入第二音频数据帧集合与从所述第一DMA缓冲区读取第一音频数据帧集合同时进行,所述第一音频数据帧集合和所述第二音频数据帧集合为所述多个音频数据帧集合中的任意两个不同的音频数据帧集合。Write the multi-frame audio data into multiple DMA buffers, wherein the multiple DMA buffers include a first DMA buffer and a second DMA buffer, and write a second frame of audio data to the second DMA buffer The collection is performed simultaneously with the reading of the first set of audio data frames from the first DMA buffer, and the first set of audio data frames and the second set of audio data frames are any of the plurality of sets of audio data frames. Two distinct collections of audio dataframes.
  7. 根据权利要求6所述的方法,其特征在于,所述方法还包括:The method according to claim 6, wherein the method further comprises:
    接收对所述第二视频文件的暂停播放指令;receiving a pause play instruction for the second video file;
    根据所述暂停播放指令停止向所述DMA缓冲区写入音频数据帧集合的操作,以及停止从所述DMA缓冲区读取音频数据的操作。The operation of writing the set of audio data frames to the DMA buffer and the operation of reading audio data from the DMA buffer are stopped according to the play pause instruction.
  8. 如权利要求1所述的方法,其特征在于,所述第一音频文件是用户通过终端设备录制的音频文件,或者,是从网上下载的。The method of claim 1, wherein the first audio file is an audio file recorded by a user through a terminal device, or downloaded from the Internet.
  9. 如权利要求1所述的方法,其特征在于,所述第一音频文件的音频格式为mp3、wav、midi或amr格式,所述第二音频文件的音频格式为pcm类型的wav格式。The method of claim 1, wherein the audio format of the first audio file is mp3, wav, midi or amr format, and the audio format of the second audio file is the wav format of pcm type.
  10. 一种功能机视频配乐装置,其特征在于,所述装置包括:A function machine video soundtrack device, characterized in that the device comprises:
    获取单元,用于获取配乐所需的第一音频文件;an acquisition unit for acquiring the first audio file required for the soundtrack;
    处理单元,用于将所述第一音频文件进行转码,得到转码后的第二音频文件;a processing unit for transcoding the first audio file to obtain a transcoded second audio file;
    所述获取单元,还用于获取待配乐的第一视频文件;The obtaining unit is also used to obtain the first video file to be composed;
    所述处理单元,还用于将所述第二音频文件进行解码,得到第一音频数据流,以及,将所述第一视频文件进行编码,得到视频数据流;The processing unit is further configured to decode the second audio file to obtain a first audio data stream, and encode the first video file to obtain a video data stream;
    所述处理单元,还用于将所述音频数据流和所述视频数据流进行合成,得到第二视频文件。The processing unit is further configured to synthesize the audio data stream and the video data stream to obtain a second video file.
  11. 如权利要求10所述的装置,其特征在于,所述处理单元具体用于:The apparatus of claim 10, wherein the processing unit is specifically configured to:
    将所述第一音频文件进行分离,得到分离后的音频文件;The first audio file is separated to obtain the separated audio file;
    将所述分离后的音频文件进行解码,得到第一预设类型的第一音频数据;Decoding the separated audio file to obtain the first audio data of the first preset type;
    对所述第一音频数据加装第一音频格式的文件头,得到所述第二音频文件。A file header of a first audio format is added to the first audio data to obtain the second audio file.
  12. 如权利要求10或11所述的装置,其特征在于,所述处理单元402具体用于:The apparatus according to claim 10 or 11, wherein the processing unit 402 is specifically configured to:
    将所述第二音频文件中的所述文件头去除,得到解码后的第一音频数据;The file header in the second audio file is removed to obtain the decoded first audio data;
    将所述解码后的第一音频数据合成所述第一音频数据流。The decoded first audio data is synthesized into the first audio data stream.
  13. 如权利要求12所述的装置,其特征在于,所述获取单元401具体用于:The device according to claim 12, wherein the obtaining unit 401 is specifically configured to:
    录制第一视频数据;record first video data;
    将所述第一视频数据进行编码,得到编码后的第一视频文件。The first video data is encoded to obtain an encoded first video file.
  14. 如权利要求13所述的装置,其特征在于,所述处理单元402还用于:The apparatus of claim 13, wherein the processing unit 402 is further configured to:
    将所述第二视频文件进行分解,得到分解后的第二音频数据和第一视频数据;The second video file is decomposed to obtain the decomposed second audio data and the first video data;
    将所述第二音频数据写入直接存储器访问DMA缓冲区;writing the second audio data into a direct memory access DMA buffer;
    读取所述DMA缓冲区的第二音频数据,进行编解码处理,得到编解码处理后的第二音频数据流;Read the second audio data of the DMA buffer, carry out encoding and decoding processing, and obtain the second audio data stream after encoding and decoding processing;
    将所述第一视频数据与所述编解码处理后的第二音频数据流进行同步播放。The first video data and the encoded and decoded second audio data stream are played synchronously.
  15. 如权利要求14所述的装置,其特征在于,所述第二音频数据包括多个音频数据帧集合,DMA缓冲区的数量有多个,每一所述音频数据帧集合包括至少一帧音频数据,在所述将所述第二音频数据写入DMA缓冲区方面,上述处理单元402具体用于:The apparatus of claim 14, wherein the second audio data includes multiple sets of audio data frames, the number of DMA buffers is multiple, and each set of audio data frames includes at least one frame of audio data , in the aspect of writing the second audio data into the DMA buffer, the above processing unit 402 is specifically used for:
    将所述多帧音频数据写入多个DMA缓冲区,其中,多个DMA缓冲区包括第一DMA缓冲区和第二DMA缓冲区,对所述第二DMA缓冲区写入第二音频数据帧集合与从所述第一DMA缓冲区读取第一音频数据帧集合同时进行,所述第一音频数据帧集合和所述第二音频数据帧集合为所述多个音频数据帧集合中的任意两个不同的音频数据帧集合。Write the multi-frame audio data into multiple DMA buffers, wherein the multiple DMA buffers include a first DMA buffer and a second DMA buffer, and write a second frame of audio data to the second DMA buffer The collection is performed simultaneously with the reading of the first set of audio data frames from the first DMA buffer, and the first set of audio data frames and the second set of audio data frames are any of the plurality of sets of audio data frames. Two distinct collections of audio dataframes.
  16. 如权利要求15所述的装置,其特征在于,所述处理单元402还用于:The apparatus of claim 15, wherein the processing unit 402 is further configured to:
    接收对所述第二视频文件的暂停播放指令;receiving a pause play instruction for the second video file;
    根据所述暂停播放指令停止向所述DMA缓冲区写入音频数据帧集合的 操作,以及停止从所述DMA缓冲区读取音频数据的操作。The operation of writing the set of audio data frames to the DMA buffer zone is stopped according to the play pause instruction, and the operation of reading audio data from the DMA buffer zone is stopped.
  17. 如权利要求10所述的装置,其特征在于,所述第一音频文件是用户通过终端设备录制的音频文件,或者,是从网上下载的。The apparatus of claim 10, wherein the first audio file is an audio file recorded by a user through a terminal device, or downloaded from the Internet.
  18. 如权利要求10所述的装置,其特征在于,所述第一音频文件的音频格式为mp3、wav、midi或amr格式,所述第二音频文件的音频格式为pcm类型的wav格式。The apparatus according to claim 10, wherein the audio format of the first audio file is mp3, wav, midi or amr format, and the audio format of the second audio file is the wav format of pcm type.
  19. 一种终端设备,其特征在于,所述终端设备包括存储器、通信接口,以及一个或多个程序,所述一个或多个程序被存储在所述存储器中,并且被配置由所述处理器执行,所述程序包括用于执行如权利要求1-7任一项所述的方法中的步骤的指令。A terminal device, characterized in that the terminal device includes a memory, a communication interface, and one or more programs, the one or more programs being stored in the memory and configured to be executed by the processor , the program comprising instructions for performing the steps in the method of any of claims 1-7.
  20. 一种计算机可读存储介质,其特征在于,所述计算机可读存储介质存储有计算机程序,所述计算机程序被处理器执行以实现如权利要求1-7任一项所述的方法。A computer-readable storage medium, characterized in that, the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1-7.
  21. 一种芯片,其特征在于,包括处理器,其中,所述处理器执行权利要求1-9中任一项所述方法的步骤。A chip, characterized by comprising a processor, wherein the processor executes the steps of the method according to any one of claims 1-9.
PCT/CN2021/135090 2020-12-21 2021-12-02 Video dubbing method and apparatus for functional machine, terminal device and storage medium WO2022135105A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011523943.4A CN112689194B (en) 2020-12-21 2020-12-21 Functional machine video music matching method and device, terminal equipment and storage medium
CN202011523943.4 2020-12-21

Publications (1)

Publication Number Publication Date
WO2022135105A1 true WO2022135105A1 (en) 2022-06-30

Family

ID=75450265

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/135090 WO2022135105A1 (en) 2020-12-21 2021-12-02 Video dubbing method and apparatus for functional machine, terminal device and storage medium

Country Status (2)

Country Link
CN (1) CN112689194B (en)
WO (1) WO2022135105A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112689194B (en) * 2020-12-21 2023-02-10 展讯半导体(成都)有限公司 Functional machine video music matching method and device, terminal equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20120091868A (en) * 2011-02-10 2012-08-20 주식회사 미디어엑셀코리아 Method for synchronizing an audio and a video in the transcoding system
CN104240739A (en) * 2014-09-04 2014-12-24 广东欧珀移动通信有限公司 Music playing method and device for mobile terminal
CN104602100A (en) * 2014-11-18 2015-05-06 腾讯科技(成都)有限公司 Method and device for recording video and audio in applications
CN105142037A (en) * 2015-09-10 2015-12-09 北京暴风科技股份有限公司 Distributed transcoded audio and video synthesis method and system
CN106230915A (en) * 2016-07-26 2016-12-14 深圳酷泰丰科技有限公司 A kind of method and system realizing function machine intelligent communication
CN112689194A (en) * 2020-12-21 2021-04-20 展讯半导体(成都)有限公司 Functional machine video music matching method and device, terminal equipment and storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
IT1310145B1 (en) * 1999-08-25 2002-02-11 Rai Radiotelevisione Italiana ACQUISITION SYSTEM AND SYNTHETIC PRESENTATION OF TV PROGRAMS
US9135951B2 (en) * 2006-10-10 2015-09-15 Qualcomm Incorporated System and method for dynamic audio buffer management
CN101446932A (en) * 2008-12-24 2009-06-03 北京中星微电子有限公司 Method and device for transmitting audio data
CN101635854B (en) * 2009-08-26 2012-07-04 腾讯科技(深圳)有限公司 Method and device for realizing transcoding merging
CN102055966B (en) * 2009-11-04 2013-03-20 腾讯科技(深圳)有限公司 Compression method and system for media file
CN105024764A (en) * 2015-07-24 2015-11-04 上海斐讯数据通信技术有限公司 Audio-format-based file transmission method and system
CN106792070B (en) * 2016-12-19 2020-06-23 广东威创视讯科技股份有限公司 DMA transmission method and device for audio and video data
CN107239211B (en) * 2017-06-28 2021-04-23 北京金山安全软件有限公司 Mobile terminal control method and device and mobile terminal

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20120091868A (en) * 2011-02-10 2012-08-20 주식회사 미디어엑셀코리아 Method for synchronizing an audio and a video in the transcoding system
CN104240739A (en) * 2014-09-04 2014-12-24 广东欧珀移动通信有限公司 Music playing method and device for mobile terminal
CN104602100A (en) * 2014-11-18 2015-05-06 腾讯科技(成都)有限公司 Method and device for recording video and audio in applications
CN105142037A (en) * 2015-09-10 2015-12-09 北京暴风科技股份有限公司 Distributed transcoded audio and video synthesis method and system
CN106230915A (en) * 2016-07-26 2016-12-14 深圳酷泰丰科技有限公司 A kind of method and system realizing function machine intelligent communication
CN112689194A (en) * 2020-12-21 2021-04-20 展讯半导体(成都)有限公司 Functional machine video music matching method and device, terminal equipment and storage medium

Also Published As

Publication number Publication date
CN112689194B (en) 2023-02-10
CN112689194A (en) 2021-04-20

Similar Documents

Publication Publication Date Title
US11336953B2 (en) Video processing method, electronic device, and computer-readable medium
TWI547954B (en) Electronic device and audio playing method
WO2019062541A1 (en) Real-time digital audio signal mixing method and device
WO2018152679A1 (en) Audio file transmitting method and apparatus, audio file receiving method and apparatus, devices and system
CN104159150A (en) Cloud terminal, cloud server, media data stream playing system and method
CN106528040A (en) Method and apparatus for improving audio quality of android device
CN104834623A (en) Audio playing method and audio playing device
CN102427465B (en) Voice service proxy method and device and system for integrating voice application through proxy
JP2003195870A (en) General decoder for use by communication network media player
CN108235052A (en) Multi-audio-frequency channel hardware audio mixing, acquisition and the method for broadcasting may be selected based on IOS
WO2020155964A1 (en) Audio/video switching method and apparatus, and computer device and readable storage medium
JP6280215B2 (en) Video conference terminal, secondary stream data access method, and computer storage medium
JP2019015951A (en) Wake up method for electronic device, apparatus, device and computer readable storage medium
CN102819851B (en) Method for implementing sound pictures by using computer
WO2022135105A1 (en) Video dubbing method and apparatus for functional machine, terminal device and storage medium
CN112562638A (en) Voice preview method and device and electronic equipment
CN112689197B (en) File format conversion method and device and computer storage medium
CN113971969B (en) Recording method, device, terminal, medium and product
US10027994B2 (en) Interactive audio metadata handling
JP2008299610A (en) Multiprocessor
CN109697987A (en) A kind of the far field voice interaction device and implementation method of circumscribed
KR20120139666A (en) Portable computer having multiple embedded audio controllers
WO2023024983A1 (en) Video recording method and device, storage medium, and program product
CN101656089A (en) Apparatus and method for playing digital audio and video
TW201248496A (en) Method and system for processing audio signals in a central audio hub

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: 21909102

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21909102

Country of ref document: EP

Kind code of ref document: A1