[MEncoder-users] AAC encoding

Stephen Norum stephen at mybunnyhug.org
Tue Jan 30 20:43:03 CET 2007


On Jan 30, 2007, at 1:26 AM, Olivier Rolland wrote:

> Back on the initial subject, has anybody ever been able to merge aac
> and x264 in avi or mp4 with audio and video perfectly in sync ?
>
> Regards,
>
> Olivier
>

Below is a makefile I use to convert a .vob into a .avi and .mp4 with  
x264 and aac encoding.  Audio and video is in sync and the video  
plays in Quicktime/iTunes (not iPod).  The script is written for a  
multi-processor computer (MacBook).  If you don't need to play the  
video back in Quicktime, you might want to change the B-frame  
settings.  Comments welcome.


INPUTFILE		= ../eternal.vob
NAME			= eternal
BITRATE			= 200
OFFSET			= #-ss 00:10:15
DURATION		= #-endpos 00:00:10
CROP			= 720:448:0:7
FPS			= -ofps 24000/1001
VF			= -vf pullup,softskip,crop=${CROP},scale=-10:-1,harddup
AID			= 128

H264NAME  =  ${NAME}.h264
MP4NAME   =  ${NAME}-${BITRATE}.mp4
AVINAME   =  ${NAME}.avi
AACNAME   =  ${NAME}.aac
LOG       =  ${NAME}.log

video: pass1 pass2 split create hint open

dvdinfo:
	mplayer -msglevel identify=6 ${INPUTFILE} -aid ${AID}

pass1:
	mencoder ${INPUTFILE} -o /dev/null -passlogfile ${LOG} -ovc x264 \
	${OFFSET} ${DURATION}	\
	-x264encopts pass=1:bitrate=$ 
{BITRATE}:turbo=1:bframes=1:me=umh:trellis=1:direct_pred=auto:partitions 
=all:threads=2 \
	-nosound -of rawvideo \
	${VF} \
	${FPS}

pass2:
	mencoder ${INPUTFILE} -o ${AVINAME} -passlogfile ${LOG} -ovc x264 \
	${OFFSET} ${DURATION}	\
	-x264encopts pass=2:bitrate=$ 
{BITRATE}:frameref=5:subq=6:bframes=1:me=umh:trellis=1:direct_pred=auto: 
partitions=all:threads=2 \
	-aid ${AID} \
	-oac faac -faacopts br=128:mpeg=4:object=1 -channels 2 -srate 48000 \
	${VF} \
	${FPS}

audio:
	mencoder ${INPUTFILE} -o ${AACNAME} \
	${OFFSET} ${DURATION}	\
	-ovc copy -vc null \
	-of rawaudio \
	-aid ${AID} \
	-oac faac -faacopts br=128:mpeg=4:object=1 -channels 2 -srate 48000 \
	${VF} \
	${FPS}

split:
	mplayer ${AVINAME} -dumpaudio -dumpfile ${AACNAME}
	mplayer ${AVINAME} -dumpvideo -dumpfile ${H264NAME}

create:
	-rm ${MP4NAME}
	mp4creator -create=${H264NAME} -rate=23.976 ${MP4NAME}
	mp4creator -create=${AACNAME}  -rate=23.976 ${MP4NAME}

hint:
	mp4creator -hint=1 ${MP4NAME}
	mp4creator -hint=2 ${MP4NAME}
	mp4creator -optimize ${MP4NAME}
	mp4creator -l ${MP4NAME}

open:
	open ${MP4NAME}

clean:
	-rm ${LOG} ${MP4NAME} ${AVINAME} ${AACNAME} ${H264NAME}




More information about the MEncoder-users mailing list