So, you have a bunch of .avi video files (from your cell phone, for example) that you'd like to combine into one (so you can upload the collection to YouTube)?

Here are two options on how to do this. The first one uses a tool from the transcode package:

avimerge -i one.avi two.avi three.avi -o output.avi

avimerge is appropriately named, and if it works, it works well. Sometimes, however, it produces out-of-sync audio, which is kind of lame if people are actually, you know, talking in your videos.

Second method to the rescue: mencoder is part of the MPlayer family and can also concatenate avi files:

mencoder -oac copy -ovc copy one.avi two.avi three.avi -o output.avi

Note: Both methods are lossless, as neither the video nor audio stream is re-encoded in any way, but they also require all input files to use the same stream formats. If you took the different videos with the same device though, that shouldn't be a problem.

Read more…

Today, I was watching an .avi file that neither allowed me to forward/rewind nor did it say the right total length of the video. At least, it played fine.

Time to fix the AVI index metadata.

Sadly, none of the tools from the "transcode" package whose names so conveniently start with "avi..." (avifix, or aviindex, for example) was able to help. But over here, I found the right command for mencoder (part of the MPlayer package, I think) that will take your audio and video stream, leave it untouched, and rewrite a new, but correctly indexed, file:

mencoder -idx input.avi -ovc copy -oac copy -o output.avi

Hope this helps!

Read more…