[MEncoder-users] HD-PVR video conversion

L Lee llee040 at sbcglobal.net
Wed Oct 7 05:09:33 CEST 2009


On 10/5/09 11:33 PM, "Andrew Berg" <bahamutzero8825 at gmail.com> wrote:

> How are you converting the HD-PVR's output? I have tried several things,
> and none have worked (only proprietary decoders can handle its 1080i
> video it seems). I've tried using AviSynth scripts, but they either end
> up out of sync (using a graph) or don't use the right decoder (using
> DirectShowSource; it doesn't honor the merit system and uses FFmpeg no
> matter what). Perhaps you could point me in the right direction. I'm
> going a bit nuts trying to figure out how to convert these videos.


Henk can lead you to explore possibilities of which I am scarcely aware (he
certainly opened the door for me to find the methods I'm using now), but,
nevertheless, I'm glad you asked.

Here's my latest routine, developed with Henk's help. when the 1920X1080
picture and 5.1 audio source is clean, these steps have produced excellent
results for me. I'm using recent releases of ffmpeg and MEncoder with x264
support, and the MP4Box I'm using has been around for a while.
I'm using a capture program called EyeTV 3.2. The output file format is film
mpeg-2 that is suitable for DVD authoring. Everything I've ever gotten out
of the Hauppage has been mixed telecine and interlaced. I won't go into my
reasons for choosing mpeg-2 for the output+.

One preliminary note: I often have to split a few seconds of garbage away
from the start of the video to prevent problems. It's not usually too hard
to figure out where to make the split, but it can cause problems that aren't
always too easily noticed until later in the process.

1. Get the raw video out of the EyeTV formatted source file.

ffmpeg -i '/Users/me/Documents/EyeTV
Archive/movie.eyetv/000000001075d8bb.mpg' -an -vcodec copy -f rawvideo
stepone.h264


2. Get the raw audio out of the EyeTV formatted source file.

ffmpeg -i '/Users/me/Documents/EyeTV
Archive/movie.eyetv//000000001075d8bb.mpg' -vn -f ac3 -acodec ac3 -ab 448000
-ar 48000 -ac 6 -map 0.1:0.0 steptwo.ac3


3. Put the raw video into a usable container.

MP4Box -tmp /Users/me -add stepone.h264 -fps 59.94 -delay 2=500 cleaned.mp4


4. Encode the video and re-add the audio (this pullup method seems quite
robust for clean sources). The method isn't built for speed. I don't think
the vb_strategy and brd_scale options are useful without 2-pass encoding,
but I've included them in case I decide to do that. The sad_thres option is
included to prevent bottom-first field warnings, although I'm not sure that
the results are significantly affected. The output bit rate is high, but can
easily be adjusted down by proportionately adjusting the lavc rate values.

mencoder cleaned.mp4 -oac copy -audiofile steptwo.ac3 -ovc lavc -lavcopts
vcodec=mpeg2video:vb_strategy=1:brd_scale=2:trell:mbd=2:precmp=2:subcmp=2:cm
p=2:dia=-10:predia=-10:cbp:mv0:vqmin=1:lmin=1:dc=10:vrc_buf_size=1835:vrc_mi
nrate=7500:vbitrate=9000:vrc_maxrate=9800:keyint=15:aspect=16/9:vstrict=0
-vf 
tfields=0,tinterlace=0,filmdint=fast=0/sad_thres=2048,softskip,scale=720:480
,harddup -noskip -of mpeg -mpegopts format=dvd:tsaf:muxrate=40000:vdelay=200
-fps 60000/1001 -ofps 24000/1001 -o eyetv.mpg

Then I watch to see if there's any a-v offset or if there are real sync
problems, for which I've learned a couple of remedies. If there's just an
offset, I re-mux with a counter-offset. If the audio and video have
substantially different lengths (up to about a second for 2 hours of video),
I usually find that the video has been slightly shortened, and I use a
command recently shared by Socke on this list to pipe the audio into and
back out of SoX's tempo adjustment function using ffmpeg, then re-mux.

For lower quality sources with poor overall consistency, I've just thrown
the whole thing at an ffmpeg method, splitting and re-muxing whenever  a-v
sync issues arise. When I do that, the result is an NTSC mpeg-2 that is
suitable for DVD authoring. It never matches the MEncoder method for picture
quality, but sometimes it's the only way to preserve the smoothest possible
motion.

ffmpeg -y -i '/Users/me/Documents/EyeTV
Archive/movie.eyetv/000000001049db30.mpg' -target ntsc-dvd -nr 100 -aspect
16:9 -minrate 8600k -b 9000k -qscale 1 -bufsize 3072k -s 720x480
movieDVD.mpg

Laine Lee




More information about the MEncoder-users mailing list