[Ffmpeg-devel] Sample code for overlaying audio on top of video and encoding

Michel Bardiaux mbardiaux
Thu Oct 26 11:08:37 CEST 2006

Joel Reymont wrote:
> Folks,
> Is there any sample code that shows how to decode audio and video, add 
> the two together and encode as a video again?
>     Thanks, Joel
I assume you mean 'merge an audio file and a video file into a 
video-with-sound file'? You dont need to write any code, nor do you need 
to decode then re-encode.

ffmpeg -i vid.mpg -i aud.wav -acodec copy -vcodec copy dst.mpg

If you really need code, ffmpeg.c itself is a good source of info.

Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles

More information about the ffmpeg-devel mailing list