2

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

#!/bin/bash
VIDEOCODEC="Xvid"
AUDIOCODEC="MP3"
for FIL in `ls *mp4 | sort` ; do
avidemux2 --video-codec $VIDEOCODEC --audio-codec $AUDIOCODEC --force-alt-h264 --load "$FIL" --save ${FIL%.*}.avi --quit
done

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

by

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?

frepie
  • 554
  • 1
  • 8
  • 29
  • I always use HandBrake for these tasks. There are both GUI and CLI versions in the PPA: https://launchpad.net/~stebbins/+archive/ubuntu/handbrake-releases – Elder Geek Oct 20 '15 at 00:12
  • Do you want a solution using avconv ? which seems to be in default ubuntu installation – EdiD Dec 18 '15 at 13:19

1 Answers1

1
  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.

dessert
  • 39,392
  • 12
  • 115
  • 163