Search code examples
c++audioffmpegextractfmod

How to extract audio from a video with ffmpeg in C++?


I'm using FFmpeg to extract informations about a video file. But i want to extract the audio channels to read it with FMOD.

How can I do that ? Is it simple ?

Do you know a good tutorial about FFmpeg in C++ ?

Thanks


Solution

  • For tutorials on FFMPEG, have a look at this question: FFmpeg API books, tutorial, etc. The tutorials are in C, but so is FFMPEG. They're a bit out of date and won't compile with the most recent FFMPEG, but the required changes aren't that great. I've started updating them on my github.

    Work your way through the tutorials (it will take around a week at a slow pace) and you'll enough to know where to grab the audio from. If you just want the stream, you can probably just dump the audio packets to a file. If you want to transcode the audio, then it will require more effort.

    Since the ffmpeg source is open, feel free to look around yourself. The main file to look at is ffmpeg.c. It's big, so you're better off getting your hands dirty with the tutorial first.