[mythtv-users] Is anyone transcoding BBC HD using Mencoder?

John john at vetsurgeon.org.uk
Fri Mar 26 11:25:50 UTC 2010


My bash script for transcoding below, takes about 20 hours to
transcode 1 hr of video on my Intel Celeron CPU 3.06GHz with 1GB
memory at the lowest priority level
I've had major problems getting cuts frame accurate so generally
include 15 seconds of video before and after programme.
You wil need to play the transcoded file out.mkv and use mplayer to
adjust audio/ video sync using using the +/- key (leave to settle for
30 seconds to make sure sync is OK- the mplayer cli should show A-V:
0.001 or so.) You then make another mkv using the a/v sync value you
just found (see in script) (takes about a minute)
Produces very high quality mp4 at about 1.3GB/hr

John


FILE=xxxx.mpg #hd mpg to be transcoded
START=215 #when programme starts in seconds
END=3577 #how long programme is (NOT when ends)
#set mencoder options
XOPTS="subq=6:frameref=5:bitrate=3000:me=umh:partitions=all:bframes=3:me_range=16:cabac:weightb:deblock"

#pass 1
nice -n 19 mencoder $FILE -fps 25 -of rawvideo -nosound -ovc x264
-x264encopts $XOPTS:pass=1:turbo=1 \
-vf kerndeint,scale=1280:720 -ofps 25 -o out.x264
#pass 2
nice -n 19 mencoder $FILE -fps 25 -of rawvideo -nosound -ovc x264
-x264encopts $XOPTS:pass=2 \
-vf kerndeint,scale=1280:720 -ofps 25 -o out.x264

#add video to mp4 container
MP4Box -add out.x264 out.mp4 -fps 25

#trim file
mencoder out.mp4 -ss $START -endpos $END -ovc copy -nosound -fps 25
-ofps 25 -o outtrimmed.mp4

#extract audio
ffmpeg -i $FILE -ss $START -t $END -vn -acodec copy -sameq -map
0.19:0.0 audio.ac3

#add audio and video to mkv container
mkvmerge -o out.mkv outtrimmed.mp4 --track-name 0:Eng audio.ac3

#sync using mplayer -delay and +/-. If video before audio then use +
to delay video
#ie.g. f delay =+1.4 in mplayer then (may ignore track name)
#mkvmerge -o out.mkv -A outtrimmed.mp4  -y 0:-1400 --track-name 0:Eng audio.ac3
#rm out.x264 out.mp4 audio.ac3 out.mpg


More information about the mythtv-users mailing list