I managed to convert avi files to mp4 using avidemux and the result is fully satisfactory. Since I have many files to convert, I would like to batch convert them using the terminal. I found the script

for FIL in `ls *mp4 | sort` ; do
avidemux2 --video-codec $VIDEOCODEC --audio-codec $AUDIOCODEC --force-alt-h264 --load "$FIL" --save ${FIL%.*}.avi --quit

fom the page http://www.avidemux.org/admWiki/doku.php?id=tutorial:batch_processing#command-line_only_batch_processing

but I end up with the error

./scriptAvidemuxBatch: line 5: avidemux2: command not found

I do get something working when I replace

avidemux2 --video-codec $VIDEOCODEC --audio-codec $AUDIOCODEC --force-alt-h264 --load "$FIL" --save ${FIL%.*}.mp4 --quit


avidemux --video-codec $VIDEOCODEC --audio-codec $AUDIOCODEC --force-alt-h264 --load "$FIL" --save ${FIL%.*}.mp4 --quit

("2" removed) but the gui still comes up and request that I click several buttons before going on with the conversion process.

My questions are:

-Is ok to change "avidemux2" to "avidemux" in the script?

-Is there a way to include the selection made when clicking the buttons in the script so the whole process can be done without my intervention?

  1. Yes, you did the right thing.
  2. The tutorial you linked to states that “AVIdemux command-line support doesn't allow you to change all possible options”, so probably: No.

Avidemux is a GUI program, if you want to benefit from bash's power just use a terminal program. Shipped with current *buntus there's avconv for that.

A batch converter is as simple as

for i in *.avi; do avconv -i "$i" "${i/%avi/mp4}"; done

You might want to add some avconv options, see here and here.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.