[MEncoder-users] rip dvd to mkv, ogm, mp4 script

James Hastings-Trew jimht at shaw.ca
Mon Oct 13 21:28:55 CEST 2008


Laine Lee wrote:
> I wouldn't doubt that. I did devise a workaround for the problem by
> introducing an additional line into the undvd executable's encoding process
> that specifies "-ofps 24000/1001". I realize that there shouldn't be a need
> for such a modification, but until I can figure out what's wrong, this seems
> to completely eliminate my problem with the conversion of DVD titles that
> have a 24 fps rate. I would, however, like to find some way to improve
> quality of the output. It looks really good, but the resulting AVI is only
> 1.4G while the sum of the original VOBs adds up to over 5G for the latest
> title I've worked with, so I suspect that some quality is being left behind.
> Not too much, probably, because I am converting to h264.
>   
Any "film-rate" NTSC DVDs should use -vf pullup,softskip,....,harddup in 
the video filter chain, and -ofps 24000/1001. It's easy to use mplayer 
to detect the actual frame rate of a DVD title. However, relying on 
-identify won't get you that information. All titles will report that 
they are 29.97fps regardless of what they actually play at.

For NTSC DVDs there are generally 4 types of frame rate you are going to 
encounter:

23.976 - its on the DVD at 29.97 will pullup flags so you have to use 
the pullup,softskip filter combo to recover the original 23.976 frames
29.97 - interlaced video format. Generally you'll want to deinterlace 
this stuff with -yadif or -pp=lb
mixed - generally mostly 23.976 progressive content with the occasional 
stretch of 29.97 interlaced material.
hard telecine - really the same as 23.976 content, but has been put on 
the DVD as interlaced video with no pullup flags. You can use mplayer to 
detect the telecine "cadence" to differentiate this from actual video 
content. Generally only found on some Japanese titles.

I'm no PERL programmer, but here is a general "recipe" for determining 
the frame rate of a DVD title:
use MPlayer to play a small portion of the video and log it's output:
mplayer dvd://1 -vf scale -nosound -vo null -frames 1500 >cropfile.txt
read the "cropfile.txt" and count how many times it has the string 
"24000/1001" in it and put it in a variable $film
if $film is greater than or equal to 4 then you have "mixed" film and video
if $film is less than or equal to 3 then you have 23.976 fps material 
(mostly)
if $film is equal to zero then you have 29.97 fps material

If you have 29.97 fps material you need to do a further test to see if 
it is hard-telecined
mplayer dvd://1 -vf pullup,scale -v -ss 60 -frames 60 -nosound >telecine.txt
read the "telecine.txt" file and count how many times it has the string 
"3 2 3 2" in it and put it in a variable $telecine
if $telecine is greater than 4 then you have hard-telecined material, 
and treat it same as mixed.

If you have film, then your command line should have:
-vf pullup,softskip,(other filters),harddup
-ofps 24000/1001

If you have video then your command line should have:
-vf yadif,(other filters),harddup
-fps 30000/1001 -ofps 30000/1001

If you have mixed then your command line should have:
-vf pullup,softskip,yadif,(other filters),harddup
-ofps 24000/1001

You can't just decide to do everything at video rate, or everything at 
film rate, and use the -ofps switch to change the frame rate. Either 
approach will result in video that will not play back smoothly - either 
inserting repeat frames, or dropping frames.



More information about the MEncoder-users mailing list