MakeMKV creating incorrect frame rate mkv.

Please post here for issues related to DVD discs
Post Reply
xekon
Posts: 3
Joined: Sun Jul 24, 2011 6:50 pm

MakeMKV creating incorrect frame rate mkv.

Post by xekon » Sun Jul 24, 2011 6:53 pm

MakeMKV creating incorrect frame rate mkv. It creates an MKV from the DVD, but the reported frame rate is 29.97 when it should be 23.976.

When encoding the mkv using handbrake this creates a problem: https://forum.handbrake.fr/viewtopic.ph ... 12&p=99765

I am using:

MakeMKV v1.6.12 [linux(x64-release)]]
GUI version: v1.6.12 [for x86_64-linux-gnu]

Smithcraft
Posts: 654
Joined: Mon May 02, 2011 8:56 pm
Location: Seattle, WA

Re: MakeMKV creating incorrect frame rate mkv.

Post by Smithcraft » Mon Jul 25, 2011 2:35 am

I would say it's exactly what Rodeo said it was. The pulldown. The FPS is correct in both cases. The source DVD is 29.97 and after the pulldown, it becomes 23.97. If Handbrake didn't follow the pulldown flag you would have the video out of sync with the audio fairly quickly.

SC

xekon
Posts: 3
Joined: Sun Jul 24, 2011 6:50 pm

Re: MakeMKV creating incorrect frame rate mkv.

Post by xekon » Mon Jul 25, 2011 3:05 am

I kinda understand... So any dvd or blu-rays that have pulldown... I should not use MakeMKV if I plan to encode it using handbrake?

If I load the dvd directly into handbrake (without using MakeMKV) then it works correctly.... 23.976, and the frame x to frame x encode is spot on.

Smithcraft
Posts: 654
Joined: Mon May 02, 2011 8:56 pm
Location: Seattle, WA

Re: MakeMKV creating incorrect frame rate mkv.

Post by Smithcraft » Mon Jul 25, 2011 3:53 am

For frame x to frame y, I would say that accessing direct from the disc would be best.

However, if you are gonna transcode the whole thing, then go ahead and rip then transcode.

SC

xekon
Posts: 3
Joined: Sun Jul 24, 2011 6:50 pm

Re: MakeMKV creating incorrect frame rate mkv.

Post by xekon » Mon Jul 25, 2011 3:56 am

Excellent! Thank you very much for the information!

crowfax
Posts: 972
Joined: Thu Feb 18, 2010 5:55 am

Re: MakeMKV creating incorrect frame rate mkv.

Post by crowfax » Mon Jul 25, 2011 3:59 am

NTSC DVD video is 29.97. It is never 23.97.

When you extract the video with MakeMKV it marks the file as having a framerate of 29.97 (because the video *is* 29.97). When you feed the file into Handbrake it sees an MKV file with a framerate of 29.97.

When you insert a DVD into Handbrake it sees an NTSC DVD. However Handbrake is coded so that it will automatically apply the pulldown to the video because it "knows" video is filmed at 23.97 and then has pull-up applied to it to make it 29.97 to comply with NTSC DVD standards. Handbrake does this automatically because there is no real reason why you would want to keep the video at 29.97 when you're encoding it if you can remove the extra frames and save some space.

In short. Handbrake is smart enough to see an NTSC DVD and know it should make a file with a framerate of 23.97. It is not smart enough to see an MKV file with a frame rate of 29.97 and do the same thing. Afterall, the file could have come from anywhere, and applying the pulldown could leave you with a choppy and unwatchable video.

As a side note, try encoding a DVD filmed in the UK (at 25fps) which has been turned into an NTSC DVD (at 29.97fps) via the use of interlacing. The resulting file will look like a horrendous mess, because the logic of "all NTSC DVD's at 23.97 film with a pull-up to 29.97" is hardcoded, and does not take into account any other situations.

I hope this makes sense to you.
Home Theater PC: Assassin HTPC, XBMCbuntu 12.0 (Frodo), Intel i5 3570k 3.4 GHz Ivy Bridge w/ HD 4000, LG BD-ROM
Playback Devices: Mede8er MED600X3D, MyGica EnjoyTV 120, Xtreamer SideWinder 3, Crystal Acoustics MediaMatchBox

Romansh
Posts: 872
Joined: Sat Jan 22, 2011 7:09 pm

Re: MakeMKV creating incorrect frame rate mkv.

Post by Romansh » Mon Jul 25, 2011 4:53 am

Smithcraft wrote:I would say it's exactly what Rodeo said it was. The pulldown. The FPS is correct in both cases. The source DVD is 29.97 and after the pulldown, it becomes 23.97. If Handbrake didn't follow the pulldown flag you would have the video out of sync with the audio fairly quickly.

SC
crowfax wrote:NTSC DVD video is 29.97. It is never 23.97.

When you extract the video with MakeMKV it marks the file as having a framerate of 29.97 (because the video *is* 29.97). When you feed the file into Handbrake it sees an MKV file with a framerate of 29.97.

When you insert a DVD into Handbrake it sees an NTSC DVD. However Handbrake is coded so that it will automatically apply the pulldown to the video because it "knows" video is filmed at 23.97 and then has pull-up applied to it to make it 29.97 to comply with NTSC DVD standards. Handbrake does this automatically because there is no real reason why you would want to keep the video at 29.97 when you're encoding it if you can remove the extra frames and save some space.

In short. Handbrake is smart enough to see an NTSC DVD and know it should make a file with a framerate of 23.97. It is not smart enough to see an MKV file with a frame rate of 29.97 and do the same thing. Afterall, the file could have come from anywhere, and applying the pulldown could leave you with a choppy and unwatchable video.
You guys have it backwards. The video is encoded and stored at 23.976 fps on disc, with pulldown flags. The flags are there to indicate (to the player) how to convert it to 29.97 fps (23.976 -> 29.97 fps is 2:3 pulldown, not pullup).

http://en.wikipedia.org/wiki/Telecine

HandBrake does NOT apply pulldown flags and therefore the output is 23.976 fps progressive (AFAIK, this is also what a DVD player does when "progressive scan" is enabled). HB ignores pulldown and outputs 23.976 fps in both cases (MKV and DVD). But in the MKV case, the framerate is misdetected (causing seek issues*).

Note that some DVDs have pulldown hardcoded: instead of flags ("soft" telecine), pulldown is applied before encoding and the video is encoded and stored at 29.97 fps on disc ("hard" telecine). But it isn't the case here.

*
In HandBrake's frame-to-frame encoding, the start frame is converted to a timestamp based on the (incorrectly detected) framerate, then HandBrake seeks to the incorrect timestamp and starts at the wrong frame.

mike admin
Posts: 3888
Joined: Wed Nov 26, 2008 2:26 am
Contact:

Re: MakeMKV creating incorrect frame rate mkv.

Post by mike admin » Fri Jul 29, 2011 9:08 am

The bigger problem is that pulldown flags are per frame. It's quite common to see mixed content on NTSC documentaries - interviews are 23.976 telecined and raw content is 29.976 interlaced. In short, in order to properly apply inverse telecine, one must first scan entire video stream and confirm that all frames have pulldown flags. It should be job of handbrake to scan an MKV file, as it will be much faster to scan than a VOB file on the disc.

p.s. Long time ago avisynth used to have an excellent adaptive inv.telecine filter that could properly handle soft and hard telecine, as well as mixed content with interlaced video. Shame it's not used by handbrake.

Smithcraft
Posts: 654
Joined: Mon May 02, 2011 8:56 pm
Location: Seattle, WA

Re: MakeMKV creating incorrect frame rate mkv.

Post by Smithcraft » Fri Jul 29, 2011 10:48 am

Romansh, thanks for pointing that out!

However, I'm stymied by that explanation. When I did an inquiry with Media Info on a VOB copied from a commercial DVD(Criterion reissue of Seven Samurai), Media Info reported the frame rate for the VOB as 29.97, and not 23.97. Inquiring several other VOBs returned the same fps.

If the VOBs are actually 23.97, then why would Media Info report them as 29.97?

SC

Romansh
Posts: 872
Joined: Sat Jan 22, 2011 7:09 pm

Re: MakeMKV creating incorrect frame rate mkv.

Post by Romansh » Fri Jul 29, 2011 2:49 pm

mike admin wrote:The bigger problem is that pulldown flags are per frame. It's quite common to see mixed content on NTSC documentaries - interviews are 23.976 telecined and raw content is 29.976 interlaced. In short, in order to properly apply inverse telecine, one must first scan entire video stream and confirm that all frames have pulldown flags.
That seems a bit silly (scan the whole thing for pulldown flags, decode, apply pulldown flags only to then apply inverse telecine). As I understand it, HandBrake does something much simpler: "ignore/don't apply pulldown flags". Though to be sure of exactly what it does, I'd have to ask a dev who's actually familiar with this part of the code - I'm by no means an expert when it comes to this.

BTW, I'm nitpicking but 30000/1001 ~= 29.970, not 29.976 :-)
mike admin wrote:It should be job of handbrake to scan an MKV file, as it will be much faster to scan than a VOB file on the disc.
MKV demuxing and parsing (including nominal fps detection) is done by libavformat. Which is why the framerate is detected as 29.97 fps. When you encode the source, however, you get the actual source framerate (HandBrake passes the source timestamps through).
mike admin wrote:p.s. Long time ago avisynth used to have an excellent adaptive inv.telecine filter that could properly handle soft and hard telecine, as well as mixed content with interlaced video. Shame it's not used by handbrake.
HandBrake has a detelecine filter (ported from MPlayer's pullup). But it's not required or useful to revert soft telecine, since - AFAIK - HandBrake doesn't apply that in the first place (see above).

FWIW, unlike the original poster, I'm by no means convinced that MakeMKV is doing something incorrect.
Smithcraft wrote:However, I'm stymied by that explanation. When I did an inquiry with Media Info on a VOB copied from a commercial DVD(Criterion reissue of Seven Samurai), Media Info reported the frame rate for the VOB as 29.97, and not 23.97. Inquiring several other VOBs returned the same fps.

If the VOBs are actually 23.97, then why would Media Info report them as 29.97?
Not sure. When the source is played with pulldown flags applied, it is (or at least should be) 29.97 fps though.

Romansh
Posts: 872
Joined: Sat Jan 22, 2011 7:09 pm

Re: MakeMKV creating incorrect frame rate mkv.

Post by Romansh » Fri Jul 29, 2011 3:15 pm

FWIW, I did manage to find a VOB file which MediaInfo reports as 23.976 fps. It's from an AnyDVD folder rip of A New Hope (2004):

Code: Select all

* * * Media Inspector 0.7.442 file analysis report.
* * * Media Inspector is ©2011 by Diego Massanti - http://mediainfo.massanti.com
* * * MediaInfoLib by Jerome Martinez - http://mediainfo.sourceforge.net
Created on: Jul 29, 2011 5:09:44 PM GMT+02:00
Report for file: VTS_01_1.VOB

General / Container Stream #1
	Total Video Streams for this File.................1
	Total Audio Streams for this File.................2
	Total Subtitle Streams for this File..............9
	Video Codecs Used.................................MPEG-2 Video
	Audio Codecs Used.................................AC3 / AC3
	SubTitle Codecs Used..............................RLE / RLE / RLE / RLE / RLE / RLE / RLE / RLE / 
	File Format.......................................MPEG-PS
	Play Time.........................................18mn 17s
	Total File Size...................................1 024 MiB
	Total Stream BitRate..............................7 824 Kbps
Video Stream #1
	Codec (Human Name)................................MPEG Video
	Codec Profile.....................................Main@Main
	Frame Width.......................................720 pixels
	Frame Height......................................480 pixels
	Frame Rate........................................23.976 fps
	Total Frames......................................26322
	Display Aspect Ratio..............................16:9
	Video Standard....................................Component
	Scan Type.........................................Progressive
	Scan Order........................................2:3 Pulldown
	Color Space.......................................YUV
	QF (like Gordian Knot)............................0.848
	Codec Settings (Matrix)...........................Default
	Video Stream Length...............................18mn 17s 859ms
	Video Stream BitRate..............................7 029 Kbps
	Video Stream BitRate (Nominal)....................9 800 Kbps
	Video Stream BitRate Mode.........................VBR
	Bit Depth.........................................8 bits
	Video Stream Size.................................920 MiB (90%)
Here's another VOB file (also 23.976 fps progressive when encoded with HandBrake) from the same rip though:

Code: Select all

* * * Media Inspector 0.7.442 file analysis report.
* * * Media Inspector is ©2011 by Diego Massanti - http://mediainfo.massanti.com
* * * MediaInfoLib by Jerome Martinez - http://mediainfo.sourceforge.net
Created on: Jul 29, 2011 5:11:03 PM GMT+02:00
Report for file: VTS_01_3.VOB

General / Container Stream #1
	Total Video Streams for this File.................1
	Total Audio Streams for this File.................2
	Total Subtitle Streams for this File..............5
	Video Codecs Used.................................MPEG-2 Video
	Audio Codecs Used.................................AC3 / AC3
	SubTitle Codecs Used..............................RLE / RLE /  / RLE / RLE
	File Format.......................................MPEG-PS
	Play Time.........................................21mn 30s
	Total File Size...................................1 024 MiB
	Total Stream BitRate..............................6 658 Kbps
Video Stream #1
	Codec (Human Name)................................MPEG Video
	Codec Profile.....................................Main@Main
	Frame Width.......................................720 pixels
	Frame Height......................................480 pixels
	Frame Rate........................................29.970 fps
	Total Frames......................................38663
	Display Aspect Ratio..............................16:9
	Video Standard....................................Component
	Color Space.......................................YUV
	QF (like Gordian Knot)............................0.568
	Codec Settings (Matrix)...........................Default
	Video Stream Length...............................21mn 30s 72ms
	Video Stream BitRate..............................5 885 Kbps
	Video Stream BitRate (Nominal)....................9 800 Kbps
	Video Stream BitRate Mode.........................VBR
	Bit Depth.........................................8 bits
	Video Stream Size.................................905 MiB (88%)
And here's a MakeMKV 1.6.12 rip of the main title (angle 1):

Code: Select all

* * * Media Inspector 0.7.442 file analysis report.
* * * Media Inspector is ©2011 by Diego Massanti - http://mediainfo.massanti.com
* * * MediaInfoLib by Jerome Martinez - http://mediainfo.sourceforge.net
Created on: Jul 29, 2011 5:17:07 PM GMT+02:00
Report for file: title00.mkv

General / Container Stream #1
	Total Video Streams for this File.................1
	Total Audio Streams for this File.................2
	Total Subtitle Streams for this File..............4
	Video Codecs Used.................................MPEG-2 Video
	Audio Codecs Used.................................AC3 / AC3
	SubTitle Codecs Used..............................VobSub / VobSub / VobSub / VobSub
	Available Sutbitle Languages......................English / English / French / English
	File Format.......................................Matroska
	Play Time.........................................2h 4mn
	Total File Size...................................6.16 GiB
	Total Stream BitRate..............................7 068 Kbps
	Encoded with......................................MakeMKV v1.6.12 darwin(x86-release)
	Encoding Library..................................libmakemkv v1.6.12 (1.2.0/1.1.0) darwin(x86-release)
Video Stream #1
	Codec (Human Name)................................MPEG Video
	Codec (FourCC)....................................V_MPEG2
	Codec Profile.....................................Main@Main
	Frame Width.......................................720 pixels
	Frame Height......................................480 pixels
	Frame Rate........................................29.970 fps
	Total Frames......................................224349
	Display Aspect Ratio..............................16:9
	Video Standard....................................Component
	Scan Type.........................................Progressive
	Scan Order........................................TFF
	Color Space.......................................YUV
	QF (like Gordian Knot)............................0.607
	Codec Settings (Matrix)...........................Default
	Video Stream Length...............................2h 4mn 45s 786ms
	Video Stream BitRate..............................6 287 Kbps
	Video Stream BitRate (Nominal)....................9 800 Kbps
	Video Stream BitRate Mode.........................VBR
	Bit Depth.........................................8 bits
	Video Stream Size.................................5.48 GiB (89%)
	Video Stream Language.............................English

Romansh
Posts: 872
Joined: Sat Jan 22, 2011 7:09 pm

Re: MakeMKV creating incorrect frame rate mkv.

Post by Romansh » Wed Sep 14, 2011 4:21 pm

As of SVN revision 4220, the HandBrake nightly builds take pulldown flags into account when detecting the nominal framerate (which was already being done for MPEG-2 in MPEG Program Streams, but has now been extended to all codecs and containers). It will be available in tomorrow's nightly.

This should make the detected framerate closer to what is output when using "Same as source", thus making "Same as source, Constant Framerate" and frame-to-frame encoding a bit more reliable.

As a side note, HandBrake's MPEG-PS demuxer should now support HD-DVD EVOB streams. HB still doesn't support HD-DVD file structures, however, so you'll still want to use MakeMKV if you care about the metadata (chapters, audio track languages, etc.).

MichaelC
Posts: 7
Joined: Sat Aug 27, 2011 9:39 pm

Re: MakeMKV creating incorrect frame rate mkv.

Post by MichaelC » Sun Oct 02, 2011 5:54 pm

Romansh wrote:As of SVN revision 4220, the HandBrake nightly builds take pulldown flags into account when detecting the nominal framerate (which was already being done for MPEG-2 in MPEG Program Streams, but has now been extended to all codecs and containers). It will be available in tomorrow's nightly.
I'll be looking forward to that feature in a release version.

I know I'm a late-comer to this conversation, but I only discovered MakeMKV a couple of months ago when I decided it was time to dump the video closet into a server. It's been a very useful program, and I've happily just paid the license fee. I've finally found the threads that discuss the problems I've had with nearly all of my HD-DVD rips--it seems to be the pulldown flags. If I understand correctly, each frame in the original video may have an optional flag indicating whether the frame (or a field) must be repeated in order to reach the the nominal frame rate. About right?

This has presented a real problem. While I don't mind transcoding DVDs because the original compression scheme is so wasteful, I'd rather leave BluRay and HD-DVD rips alone. But very few media players (I use a Western Digital TV-Live +) are likely ever to deal with this. HD-DVD is dead and there's little interest in dealing with this issue at that level.

I've seen the issue pop up on this forum from time to time, and it would seem to be a very nice option to turn off these flags. As far as I understand it, none of the image bits would be touched by this. Even if the resultant file comes out at the nominal 24FPS, most of the media players already appear to have their own pulldown strategies. Perhaps that's the reason my HD-DVD rips are so jerky. It may be that there's some interaction with between the WD's own strategy and that presented by the pulldown flags in the file.

So if I may renew the request, please consider it renewed.

Post Reply