#!/bin/bash # # Single pass Xvid encoding # def_bitrate=1200 def_WxH=320x240 def_outfile=out.avi def_wave=out.wav def_docrop=false def_interlace=0 def_passnum=0 help(){ cat < xvid4.cfg ;; 1) fields=t dnmode=1 sed "s/^interlaced.*$/interlaced = 1/; s/^topfieldfirst.*$/topfieldfirst = 1/" \ < /usr/local/lib/transcode/xvid4.cfg \ > xvid4.cfg ;; *) fields=b dnmode=1 sed "s/^interlaced.*$/interlaced = 1/; s/^topfieldfirst.*$/topfieldfirst = 0/" \ < /usr/local/lib/transcode/xvid4.cfg \ > xvid4.cfg ;; esac { case $interlace in 0) yuvcorrect -T PROGRESSIVE 2>/dev/null ;; 1) yuvcorrect -T INTERLACED_TOP_FIRST 2>/dev/null ;; *) yuvcorrect -T INTERLACED_BOTTOM_FIRST 2>/dev/null ;; esac } | yuvscaler -O SIZE_$WxH 2>/dev/null | transcode -i /proc/self/fd/0 -p $wave -x yuv4mpeg \ -g $WxH -f 29.970,4 -e 44100,16,2 \ --export_asr 2 --export_par 1 --encode_fields $fields \ -Jyuvdenoise=mode=$dnmode:sharpen=0:border=0x0-$crop \ -R $passnum -y xvid4 -b 192 -w $bitrate -o $outfile #rm xvid4.cfg