Monday 24 September 2007

vlc transcoding for portable players

Here's the script I use to transcode all the video files in the current directory to 320 pixel wide MP4 format files suitable for playback on devices limited in both CPU and RAM - in my case my mobile phone.

Total bitrate (video and audio) is 128kbps, which works out as roughly 1MB a minute. This works better on cartoons than it does on live action or CG. Audio is downsampled to mono 11025hz to avoid excessive artifacting.

#!/bin/bash
vcodec="mp4v"
acodec="mp4a"
bitrate="96"
w=320
arate="32"
asrate="11025"
achannels="1"
ext="mp4"
mux="mp4"
vlc="vlc"
out="/media/files/video/portable/"

for a in *; do
if ! [ -f "$out$a.$ext" ]
then
$vlc -I dummy -vvv "$a" --sout "#transcode{vcodec=$vcodec,vb=$bitrate,width=$w,autocrop,scale,deinterlace,audio-sync,acodec=$acodec,ab=$arate,samplerate=$asrate,channels=$achannels}:standard{mux=$mux,dst=\"$out$a.$ext\",access=file}" vlc:quit
fi
done

Labels: , , , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home