[FFmpeg-user] Adding Audio to a video without re-encoding?

Meino.Cramer at gmx.de Meino.Cramer at gmx.de
Sun Jan 25 10:54:27 CET 2015


Werner Robitza <werner.robitza at gmail.com> [15-01-25 10:40]:
> On Sun, Jan 25, 2015 at 7:15 AM, <Meino.Cramer at gmx.de> wrote:
> > I have an video file (h264), which is without audio. I want to add
> > music to it and have an audio file of the correct length.
> >
> > Is it possible to add that audio file to the video file without
> > re-encoding one or both files?
> > And if yes, how can I accieve this?
> 
> ffmpeg -i video.mp4 -i audio.m4a -c copy -map 0:v -map 1:a output.mp4
> 
> assuming the audio codec is compatible with MP4 (i.e. AAC, MP3).
> Or use Matroska, since it more or less handles all codecs:
> 
> ffmpeg -i video.mp4 -i audio.ogg -c copy -map 0:v -map 1:a output.mkv
> 
> Here, "0:v" refers to the video stream of the first input, and "1:a"
> to the audio stream of the second input. "-c copy" copies the
> bitstreams instead of re-encoding.
> 
> See also:
> https://trac.ffmpeg.org/wiki/How%20to%20use%20-map%20option
> http://superuser.com/a/800251/48078
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 

Hi Werner,

THANKS for the info ! Great!

Best regards,
mcc




More information about the ffmpeg-user mailing list