4

How to merge audio with video through FFMpeg C library.

I have tried muxing.c In this example, audio is created every video frame. But I wanna merge with one full mp3 or wav some other audio format.

And how to encode the audio file (.mp3) while encoding video from images. I encode image to video using muxing.c.

Muthu GM
  • 281
  • 3
  • 11

1 Answers1

2

It is essentially the same thing as in that example (or maybe better example would be transcoding.c) except you need to set up separate demuxer and decoder for your input audio. Basically you need to set up decoding context, get raw audio frames from that and then encode them in encoding context together with video frame. Only caveat here is that you need to modify timestamps to ensure video and audio streams start at the same time.

Andrey Turkin
  • 1,787
  • 9
  • 18