[MEncoder-users] Encodes for slow laptop

Stella-Terra Clemens stellaterraclemens at gmail.com
Thu Jun 12 05:30:30 CEST 2008


On Wed, Jun 11, 2008 at 8:13 PM, James Hastings-Trew <jimht at shaw.ca> wrote:

> Stella-Terra Clemens wrote:
> > Ok, I think I've basically found what I was looking for. I wrote a small
> > script to help with automation, let me know if there is anything
> glaringly
> > wrong here. It's based on h264enc script, RC's suggestions, and a
> > couple of
> > gentoo dvd rip pages.
> >
> > #!/bin/bash
> >
> > TITLE="The Princess Bride"
> > IN_FILE="movie.vob"
> > OUT_FILE="thePrincessBride.mkv"
> > CROP="704:464:10:6"
> > SCALE="384:256"
> > VF_FRAMECONVERT=""
> > #VF_FRAMECONVERT="pullup"
> > FPS="24000/1001"
> > BITRATE=800
> > AID=128
> >
> > # Video
> > mencoder ${IN_FILE} -o /dev/null -ofps ${FPS} -vf
> > ${VF_FRAMECONVERT}crop=${CROP},softskip,scale=${SCALE},harddup
> > -nosound -of
> > rawvideo -ovc x264 -x264encopts
> >
> pass=1:bitrate=${BITRATE}:turbo=2:me=umh:me_range=24:nodct_decimate:nointerlaced:8x8dct:nofast_pskip:trellis=1:partitions=none:mixed_refs:bime:keyint=240:keyint_min=24:frameref=4:bframes=16:b_adapt:b_pyramid:weight_b:direct_pred=auto:subq=6:brdo:chroma_me:nocabac:nodeblock:nossim:nopsnr:threads=auto
> >
> > mencoder ${IN_FILE} -o movie.264 -ofps ${FPS} -vf
> > ${VF_FRAMECONVERT}crop=${CROP},softskip,scale=${SCALE},harddup
> > -nosound -of
> > rawvideo -ovc x264 -x264encopts
> >
> pass=2:bitrate=${BITRATE}:me=umh:me_range=24:nodct_decimate:nointerlaced:8x8dct:nofast_pskip:trellis=1:partitions=none:mixed_refs:keyint=240:keyint_min=24:frameref=4:bframes=16:bime:b_adapt:b_pyramid:weight_b:direct_pred=auto:subq=6:brdo:chroma_me:nocabac:nodeblock:nossim:nopsnr:threads=auto
> >
> > # Audio
> > mplayer movie.vob -aid ${AID} -ao
> pcm:fast:waveheader:file=audio${AID}.wav
> > -vc null -vo null
> > oggenc audio${AID}.wav
> >
> > # Container
> > mkvmerge --title "${TITLE}" -o ${OUT_FILE} --default-duration 0:${FPS}fps
> > movie.264 audio${AID}.ogg
> >
> > The Matrix went off without a hitch,
> > but The Princess Bride came out with the audio 200 ms in front of the
> > video. This wasn't a big problem. Even if I could no longer get at the
> > source files, I was able to change the timing using mkv merge and the
> > existing streams, and even failing that I could just press the minus key
> > twice and things would be alright, but it would be great if there
> > could be a
> > way to prevent this in the future.
> The best way to ensure AV synch is to encode the audio at the same time
> as the video.
> You could do the following (I won't mess with too many of your settings):
>
> #pass 1
> mencoder ${IN_FILE} -o /dev/null -ofps ${FPS} -aid ${AID} -oac pcm
> -channels 2 -srate 48000 -vf
> ${VF_FRAMECONVERT}crop=${CROP},softskip,scale=${SCALE},harddup -ovc x264
> -x264encopts
>
> pass=1:bitrate=${BITRATE}:turbo=2:me=umh:me_range=24:nodct_decimate:nointerlaced:8x8dct:nofast_pskip:trellis=1:partitions=none:mixed_refs:bime:keyint=240:keyint_min=24:frameref=4:bframes=16:b_adapt:b_pyramid:weight_b:direct_pred=auto:subq=6:brdo:chroma_me:nocabac:nodeblock:nossim:nopsnr:threads=auto
>
>
> #pass 2
> mencoder ${IN_FILE} -o temp.avi -ofps ${FPS} -aid ${AID} -oac pcm
> -channels 2 -srate 48000 -vf
> ${VF_FRAMECONVERT}crop=${CROP},softskip,scale=${SCALE},harddup -of avi
> -noodml -ovc x264 -x264encopts
>
> pass=2:bitrate=${BITRATE}:me=umh:me_range=24:nodct_decimate:nointerlaced:8x8dct:nofast_pskip:trellis=1:partitions=none:mixed_refs:keyint=240:keyint_min=24:frameref=4:bframes=16:bime:b_adapt:b_pyramid:weight_b:direct_pred=auto:subq=6:brdo:chroma_me:nocabac:nodeblock:nossim:nopsnr:threads=auto
>
> #extract video
> mencoder -o movie.264 -ovc copy -nosound -of rawvideo temp.avi
>
> #extract audio
> mplayer temp.avi -ao pcm:fast:waveheader:file=audio${AID}.wav -vc null
> -vo null
>
> #encode audio
> oggenc audio${AID}.wav
>
> #mux
> mkvmerge --title "${TITLE}" -o ${OUT_FILE} --default-duration
> 0:${FPS}fps movie.264 audio${AID}.ogg
>
> I'll just add in passing that 16 is a LOT of b-frames. Try something
> more reasonable, like a number between 3 and 6. The more bframes your
> stream has, the larger the buffers required to decode the video. You can
> also speed up the first pass by reducing the frameref and subq values to
> 1 without really hurting the final encode too much. I'm actually a
> little curious where you got your 264 options from because they look a
> bit unusual to me.
>
> _______________________________________________
> MEncoder-users mailing list
> MEncoder-users at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/mencoder-users
>

Wow, those suggestions look great!  I'll definitely incorporate them.
I got my settings from h264enc (a script very similar to xvidenc.)
http://h264enc.sourceforge.net/

Thanks a bunch,
Stella



More information about the MEncoder-users mailing list