#!/bin/bash N_PASSES=1 # number of passes V_BITRATE=384 # video bitrate: 384 is default for simple profile level 3 A_BITRATE=128 # audio bitrate file=${!#} resultName=C2.${V_BITRATE}.${N_PASSES}pass-`echo "$file" | sed 's/\.\w*$//'` #resultName=C2-`echo "$file" | sed 's/\.\w*$//'` # get the framerate of the input file # some code taken from http://www.houghi.org/script/idvid - thanks! cmd="mplayer -vo null -ao null -frames 1 -channels 6 -identify $file" eval `$cmd | grep "^ID_VIDEO_FPS"` echo ID_VIDEO_FPS = $ID_VIDEO_FPS # Set some frequently-used variables # Frames per second VFR=5 #default to 30fps case "$ID_VIDEO_FPS" in "23.976" ) VFR=1 ;; "24.000" | "24.00" | "24.0" | "24" ) VFR=2 ;; "25.000" | "25.00" | "25.0" | "25" ) VFR=3 ;; "29.970" | "29.97" ) VFR=4 ;; "30.000" | "30.00" | "30.0" | "30" ) VFR=5 ;; esac encode2mpeg -o $resultName -avionly -vfr $VFR -encode 2:2:$N_PASSES -acustom "cbr:br=$A_BITRATE" -vf harddup -vbitrate $V_BITRATE -setaspect 320 $file