All pastes #183468 Raw Edit

Mine

public shellscript v1 · immutable
#183468 ·published 2006-09-26 23:03 UTC
rendered paste body
#!/bin/bashX264="subq=6:4x4mv:8x8dct:frameref=3:me=3:weight_b:b_pyramid:bframes=3:mixed_refs:b_pyramid:brdo:bime:trellis=2:qcomp=1"VB=$2[ "$#" -lt 2 ] && exec echo "usage: $0 <file> <bitrate> [outfile]"clean_tmp(){	[ -z "$KEEPTEMP" ] && rm -f /tmp/*$$*	exit 0}OUTFILE="${1%.*}.mp4"[ "$#" -gt 2 ] && OUTFILE="$3"trap clean_tmp SIGINTtrap clean_tmp SIGQUITtrap clean_tmp SIGKILLFPS=$(mplayer -frames 0 "$1" -vc null -vo null -nosound -identify 2>/dev/null |awk -F= '/ID_VIDEO_FPS/{print$2}')#CROP=$(mplayer "$1" -vo null -ac null -fps 100 -vf cropdetect -ss 100 -frames 250 2>/dev/null |grep '[CROP]' |tail -n 1 |cut -d '(' -f 2 | cut -d ')' -f 1)echo -e "\e[32mRipping Audio...\e[39;49m"mplayer "$1" -vo null -vc null -ao pcm:fast:file=/tmp/audio.$$.wav -af lavcresample=44100 -msglevel all=0:avsync=5 || clean_tmpnormalize-audio --peak /tmp/audio.$$.wav || clean_tmpmplayer /tmp/audio.$$.wav -ao pcm:fast:file=/tmp/audio2.$$.wav || clean_tmpmv /tmp/audio2.$$.wav /tmp/audio.$$.wavecho -e "\e[32mEncoding Audio...\e[39;49m"neroaacenc -hev2 -q 0.15 -if /tmp/audio.$$.wav -of /tmp/audio.$$.mp4 || clean_tmpMP4Box -raw 1 /tmp/audio.$$.mp4mv /tmp/audio.$$_track1.aac /tmp/audio.$$.aacecho -e "\e[32mEncoding Video (1° pass)\e[39;49m"mencoder "$1" -o /dev/null -of rawvideo -ovc x264 -nosound $CROP -x264encopts $X264:bitrate=$VB:turbo=1:pass=1 -passlogfile /tmp/mkmp4pass.$$.log -msglevel all=0:avsync=5 || clean_tmpecho -e "\e[32mEncoding Video (2° pass)\e[39;49m"mencoder "$1" -o /tmp/video.$$.264 -of rawvideo -ovc x264 -nosound $CROP -x264encopts $X264:bitrate=$VB:pass=2 -passlogfile /tmp/mkmp4pass.$$.log -msglevel all=0:avsync=5 || clean_tmpecho -e "\e[32mPutting all together\e[39;49m"MP4Box -fps $FPS -sbrx -new -add /tmp/audio.$$.264 -add /tmp/video.$$.aac "$OUTFILE" || clean_tmpecho -e "Saved to \e[32m$OUTFILE\e[39;49m"clean_tmp