woensdag 1 juni 2011

encoding video for ipad with ffmpeg

Hi


I have an ipad at work , but encoding video for it using gaphicla tools is a hassle, and often turns out bad. and itunes (on my mac mini) doesn't reencode the videos... so i made a script

now my debian box can do it
(you need to install libfaac .. on my debian box i folowed the instructions here
for ubuntu users .. i know option C from this post works)

the ffmpeg command i use is
ffmpeg -i input.avi -f mp4 -vcodec libxvid -maxrate 1000 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec libfaac -mbd 2 -s 640x480 -ab 128 -b 400 output.mp4


still meaning everthing has to be done one by one .. still cumbersome
so i made a quick and dirty looping script

so the script becomes

#!/bin/bash

#create a folder for the encodes
mkdir $1/encodedforipad/

#encode away
for i in $(ls $1);
do

ffmpeg -i $dir/$i -f mp4 -vcodec libxvid -maxrate 1000 -qmin 3 -qmax 5 -bufsize 4096 -g 300 -acodec libfaac -mbd 2 -s 640x480 -ab 128 -b 400 $1/encodedforipad/$i.mp4
done

make it executable and call it with the first argument being the folder where you host your video files. (attention: the script is not recursive and does not handle spaces in names well).

Geen opmerkingen: