#!/bin/ksh if [ -z "$1" ]; then echo Usage: $0 input.mpg exit 1 fi output=$(basename "$1") dest=/home/inittab/public_html format=med-wide case "$format" in std-wide) # Low Def Widescreen @ 368x208 (PSP/PS3) ffmpeg -i "$1" -f psp -r 29.97 -b 768k -ar 24000 -ab 64k -aspect "16:9" -s "368x208" -title "${output}" "${dest}/${output}.mp4" ;; med-wide) ffmpeg -i "$1" -f psp -r 29.97 -b 768k -ar 24000 -ab 64k -aspect "16:9" -s "480x272" -title "${output}" "${dest}/${output}.mp4" ;; std-tv) # Low Def 4:3 @ 320x240 (PSP/PS3) ffmpeg -i "$1" -f psp -r 29.97 -b 768k -ar 24000 -ab 64k -aspect "4:3" -s "320x240" -title "${output}" "${dest}/${output}.mp4" ;; dvd) # Low Def 4:3 @ 640x480 (PS3 only) ffmpeg -i "$1" -f mp4 -r 29.97 -b 1024k -ar 24000 -ab 64k -aspect "4:3" -s "640x480" -title "${output}" -y -vcodec h264 -acodec aac -mbd rd -flags 4mv+trell+aic+qprd+mv0 -threads 2 -cmp 2 -subcmp 2 -flags2 dct8x8+skiprd -level 41 -bf 3 -ac 2 "${dest}/${output}.mp4" ;; hd) # High Def Widescreen @ 1920x1080 (PS3 only) ffmpeg -i "$1" -f mp4 -r 29.97 -b 2048k -ar 24000 -ab 64k -aspect "16:9" -s "1920x1080" -title "${output}" -y -vcodec h264 -acodec aac -mbd rd -flags 4mv+trell+aic+qprd+mv0 -threads 2 -cmp 2 -subcmp 2 -flags2 dct8x8+skiprd -level 41 -bf 3 -ac 2 "${dest}/${output}.mp4" ;; esac