#!/bin/bash # filename=andvidenc #USAGE: # andvidenc low "input.video" # andvidenc high "input.video" # # --output: "input.video.mp4" # # Note 1: if input video is INTERLACED, add "kerndeint" to -vf, # i.e. ... -vf kerndeint,dsize.... # # Note 2: if 2-pass encoding is not desired, comment out the FIRST mencoder line # from each case and remove "-passlogfile "$2.log"" and ":pass=2" from remaining # mencoder lines. # # Note 3: for testing purposes, I have verified that HTC dream is able to play high # bitrate files without trouble. Tested with bitrate up to 1024. Visual difference # between 512 and 1024 is minimal. Up to you to choose a bitrate that balances # quality with size. # yes, this script is really stupid and has a lot of room for enhancement. Feel free # to improve it. #EITHER: # mencoder "$1" -o "$1.tmp.mp4" \ # -vf dsize=480:352:2,scale=-8:-8,harddup \ # -oac faac -faacopts mpeg=4:object=2:raw:br=96 \ # -of lavf -lavfopts format=mp4 -ovc x264 \ # -sws 9 -x264encopts nocabac:level_idc=30:bframes=0:bitrate=512:threads=auto:global_header:subq=5:frameref=6:partitions=all:trellis=1:chroma_me:me=umh mencoder "$1" -o "$1.tmp.mp4" \ -vf dsize=480:352:2,scale=-8:-8,harddup \ -oac faac -faacopts mpeg=4:object=2:raw \ -of lavf -lavfopts format=mp4 -ovc lavc \ -lavcopts acodec=libfaac:abitrate=96:vcodec=mpeg4:vbitrate=386 \ # mencoder ./input.avi -forceidx -o ./output.mp4 -oac faac -vf scale=480:320 -ovc lavc -lavcopts acodec=libfaac:abitrate=96:vcodec=mpeg4:vbitrate=695 -of lavf -lavfopts format=mp4 -faacopts object=2:br=0 #THEN: ffmpeg -i "$1.tmp.mp4" -vcodec copy -acodec copy "$1.mp4" rm -f "$1.tmp.mp4" "$1.log"