How to remove an audio track from an avi file

If you want to remove an unwanted audio track from a dual audio avi movie file, you can use the following command with Mencoder:

mencoder original_dual_audio_file.avi -o target_file.avi -oac copy -ovc copy -aid 2

or with Ffmpeg:

ffmpeg -i original_dual_audio_file.avi -vcodec copy -map 0:0 -acodec copy -map 0:2 target_file.avi

These will create a file named target_file.avi retaining only the second audio track (aid 2).


FFprobe how to

This one line command will search for all avi video files in a volume (dvd) with find, analyzes the specs with ffprobe, and filters the output through grep

find /media/cdrom/ -name '*.avi' -exec ffprobe {} \; 2>&1 | grep -F -f patternfile


2>&1 is necessary because the ffprobe output is in stderr, not stdout

patternfile contains all the patterns to be matched by grep, one in each line.

Join multiple AVI or MPEG videos into a single file with mencoder

I have some videos I wish to concatenate into a single one, without re-encoding.

It’s very easy with mencoder.

If they are avi:

mencoder -forceidx -ovc copy -oac copy part1.avi part2.avi part3.avi -o total.avi

-forceidx forces to rebuild the index, for seeking.

But if they are MPG files i should use the MPEG container (mencoder uses avi as default, regardless of file extension)

mencoder -forceidx -of mpeg -noskip -mc 0 -ovc copy -oac copy part1.mpg part2.mpg part3.mpg -o total.mpg

The mencoder manual advises the use of -noskip -mc 0 when muxing mpeg files.
For MPEG1 format this has to be specified, because MPEG2 is the default:

mencoder -forceidx -of mpeg -noskip -mc 0 -mpegopts format=mpeg1 -ovc copy -oac copy part1.mpg part2.mpg part3.mpg -o -o total.mpg