0

I need to merge two AVI files where sound tracks are substantially shorter than video ones - i.e. it can be minutes of video without sound at the end. When I merge either with transcode or mencoder, the sound and video are merged together "independently", so I am resulting in an AVI file where all the audio is glued together and all the silence is also glued together and put at the end causing enormous loss of sync between audio and video. Is there any way to merge those files so that the file boundaries are left intact and sound is attached to the proper video frames? I need a Linux command-line solution.

EDIT: Here is the code I am using:

avimerge -i file.avi file2.avi -o result.avi  
mencoder -oac copy -ovc copy -o result.avi file1.avi file2.avi
Michael Pliskin
  • 2,352
  • 4
  • 26
  • 42

1 Answers1

0

There is a tool in the Ubuntu repository called avidemux which seems like it should do what you need.

Jason LeBrun
  • 13,037
  • 3
  • 46
  • 42
  • Tried that and it also behaves in a weird way in fact. It 'tiles' the shorter soundtrack instead of injecting silence.. It looks like I will have to resolve to generating silence manually and joining all together then. – Michael Pliskin Jan 26 '11 at 14:51
  • You can demux the video and audio tracks, use a command line tool to pad the audio track with silence, and then remux the file. – Jason LeBrun Jan 27 '11 at 20:13