More fun with video processing

Dec 05, 2007 19:33


A Makefile which allows you to drag and drop youtube URLs from (e.g.) Firefox to a subfolder, then run "make all" and magically they get turned into ipod-friendly .mp4 files. Tested under Ubuntu Linux. The youtube-dl package does the youtube preprocessing, followed by mencoder grinding away. The sed options took a while...

URLFILES = $(wildcard */*.url) MP4FILES = $(addsuffix .mp4, $(basename $(URLFILES))) MENCODEROPTS = -vf scale=640:-10,harddup -oac faac -faacopts br=160:object=2:mpeg=4 -ofps 29.97 -ovc x264 -x264encopts bitrate=900:nocabac:level_idc=13 %.flv: %.URL youtube-dl -o $@ `sed -n -e 's/URL=//;s/[[:cntrl:]]//g;/http/p' $<` %.avi: %.flv mencoder $< -o /dev/null $(MENCODEROPTS):pass=1 mencoder $< -o $@ $(MENCODEROPTS):pass=2 %.h264: %.avi mplayer $< -dumpvideo -dumpfile $@ %.aac: %.avi mplayer $< -dumpaudio -dumpfile $@ %.mp4: %.h264 %.aac rm -f $@ mp4creator -create=$*.h264 -rate 29.97 $@ mp4creator -create=$*.aac $@ mp4creator -hint=1 $@ mp4creator -hint=2 $@ mp4creator -optimize $@ all: $(MP4FILES)
Previous post Next post
Up