0

I have a video.avi which I have generated with mencoder before. It has a video and audio stream and I'm trying add (mix) a background.mp3 file to it, but I haven't found anything on the internet, thats why I'm asking. The background music is always longer than the audio in video.avi so I have to use something like "shortest" like I know from ffmpeg.

If I do this:

mencoder -ovc copy -audiofile background.mp3 -oac copy video.avi -o output.avi

the existing audio stream from video.avi is overwritten (or not used). Is it even possible to do this with mencoder? If anyone could tell me how to do this with ffmpeg or avconv (any linux command line tool) I would appreciate it.

Johnny
  • 143
  • 1
  • 12
  • 3
    Intra-stack duplicate of [Adding soundtrack to a video using `ffmpeg`](http://superuser.com/a/629638/110524). Note this answer works for `ffmpeg` from FFmpeg and not anything from Libav like their [fake, so-called "`ffmpeg`"](http://stackoverflow.com/a/9477756/1109017) or `avconv`. Get a recent build from the [FFmpeg Download](http://ffmpeg.org/download.html) page or follow a [step-by-step guide to compile `ffmpeg`](http://trac.ffmpeg.org/wiki/UbuntuCompilationGuide). Also, your question is offtopic for [so] which is limited to programming questions only. Your question can be migrated to [su]. – llogan Dec 31 '13 at 23:39
  • I'm not voting to migrate this one since it's already answered, but if you have troubles getting the referenced command to work please post again on [SU] and delete this one here. Thanks! – slhck Dec 31 '13 at 23:43
  • The migration maybe suitable, but i would move it to 'Video' rather than super user. Oh, and i would move LordNeckbeard's comments on avconv (if i come across another one, i will scream) to something like fud.stackoverflow.com – v010dya Apr 22 '15 at 10:31

0 Answers0