Carl Karsten wrote:
I was given a 30 min 2gig .mov taken with a ntsc camera - taked to post to
youtube (don't worry about the time, I can post big stuff)

I am not exactly sure what youtube does on there end, pretty sure they will
re-encode it or something.  I want to get it to something that doesn't take 10
hours to upload.

Anyone have a recommendation on encoding parameters?

I hear h624 is 'best' for stuff like this.

Carl K


Hi Carl,

I use mencoder and MP4Box from gpac for this sort of thing, with some tcextract for demuxing (which MP4Box will do too), but would be interested to hear how you achieve the same results with transcode. The following creates streaming mp4 files with aac and h264 similar to what youtube uses.

Dave

exec 9< $WDIR/$LIST

while read -u 9 line ; do

 # Set the env variable to quiet -- turns off mencoder ID info
 export MPLAYER_VERBOSE="-10"

 echo -e "Encoding $line on $(hostname -s) at $($DAT '+%F %H:%M')"

 echo -en "\nFirst pass ...\t"

nice -n 19 mencoder $line -ovc x264 -nosound -ni -sws 0 -x264encopts log=0:threads=$CPU:bitrate=$VBR:bframes=3:b-pyramid:\ ref=6:qcomp=0.8:partitions=all:direct=auto:weightb:b-rdo:mixed-refs:bime:8x8dct:trellis=1:pass=1:turbo=1 -passlogfile \ $TDIR/$FIL.log -ofps 29.97 -vf crop=624:480:12:0,scale=$SIZ,pp=md,pp=0x33,harddup -of rawvideo -o $TDIR/$FIL.h264

 echo -e "Second pass starting at $($DAT '+%F %H:%M') ..."

nice -n 19 mencoder $line -ovc x264 -nosound -ni -sws 0 -x264encopts log=0:threads=$CPU:bitrate=$VBR:bframes=3:b-pyramid:\ ref=6:qcomp=0.8:partitions=all:direct=auto:weightb:b-rdo:mixed-refs:bime:8x8dct:trellis=1:pass=2 -passlogfile \ $TDIR/$FIL.log -ofps 29.97 -vf crop=624:480:12:0,scale=$SIZ,pp=md,pp=0x33,harddup -of rawvideo -o $TDIR/$FIL.h264

 # Unset the env variable
 export MPLAYER_VERBOSE=""

 # Extract audio track and convert to wav
 echo -e "\ntcextract -i $line -x mp3 -a 3 > $TDIR/$FIL.mp3"
 nice -n 19 tcextract -i $line -x mp3 -a 3 > $TDIR/$FIL.mp3
 echo -e "\nsox $TDIR/$FIL.mp3 -r 44100 -s -w -c 2 $TDIR/$FIL.wav"
 nice -n 19 sox $TDIR/$FIL.mp3 -r 44100 -s -w -c 2 $TDIR/$FIL.wav

 # Normalize audio
 if [ "$(uname)" = "Darwin" ]
   then echo -e "\nnormalize -q $TDIR/$FIL.wav"
     nice -n 19 normalize -q $TDIR/$FIL.wav
   else echo -e "\nnormalize-audio -q $TDIR/$FIL.wav"
     nice -n 19 normalize-audio -q $TDIR/$FIL.wav
 fi

 # Convert to aac and create the mp4 container
echo -e "\nffmpeg -i $TDIR/$FIL.h264 -i $TDIR/$FIL.wav -y -vn -f mp4 -acodec libfaac -ab "$ABR"000 -ar 44100 -ac 2 -map 1.0:0.0 $FIL.aac.mp4" nice -n 19 ffmpeg.quiet -i $TDIR/$FIL.h264 -i $TDIR/$FIL.wav -y -vn -f mp4 -acodec libfaac -ab "$ABR"000 -ar 44100 -ac 2 -map 1.0:0.0 $TDIR/$FIL.aac.mp4

 # Multiplex audio and video
echo -e "\nMP4Box -quiet -fps 29.97 -add $TDIR/$FIL.h264 -add $TDIR/$FIL.aac.mp4 -new $TDIR/$FIL.mp4\n" nice -n 19 MP4Box -quiet -fps 29.97 -add $TDIR/$FIL.h264 -add $TDIR/$FIL.aac.mp4 -new $TDIR/$FIL.mp4

done


Reply via email to