简体   繁体   中英

Libav API: Filtering + Transconding

I need to process a list of several audio files (MP3 and WAV) and mix them to generate an audio stream (AAC codec / fltp) to be included into an mp4 file (using the Libav API).

Currently, I can mix the list of input files to generate a WAV file successfully using filters, nevertheless when I try to create the MP4 file, I always get this error message: ' Resource temporarily unavailable ' (Of course, I tried several audio codec/fmt values to make it work with no luck).

The basic version of my experimental implementation is availableright here

I was checking the AAC transcoding example that comes with the FFMPEG source code, and it works perfectly giving the outcome exactly as I need it.

(The only problem I have with this example is that it doesn't include any filtering process. I tried to extend it but I failed in an epic way... besides, the workflow of the code looked pretty tangled)

So, this is my question: Can I try to achieve the same result as the transcode_aac but using a filter? I would like to keep the mixing feature already implemented using filters without having to make big changes in my workflow to generate the audio stream for the MP4 file. Any ideas or suggestions are pretty welcome!

PS: I was thinking of using the resample filter to solve my problem, but the documentation says: " It is not meant to be used directly ". So, I wonder: is there any clean easy way to implement it as part of my workflow?

After a lot of research, the best approach I could find was this:

  • Create a method to mix all the audio files you need using filters and then, export an output file using the format WAV (Using the audio_mixer source code from the question post).
  • Create a method that transcodes the WAV file generated in the previous step, into a MP4 file, using the AAC transcoding example described in the question post.

PS: I am aware that including the transcoding process as a filter would be a very fancy solution, but I couldn't find any reference of how to do it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM