timing sync in physical dvd versus vob versus mp4

This forum is about all development around libVLC.
airesoft
New Cone
New Cone
Posts: 3
Joined: 10 Jan 2018 05:44

timing sync in physical dvd versus vob versus mp4

Postby airesoft » 10 Jan 2018 06:35

Hi,

I have built most of an app that uses libvlc 2.2.6 or 2.2.8. App is written in C on win7 x64 and leverages the WINAPI, but uses libvlc via cygwin. Am using CLion, not Visual Studio, not that it much matters. My app depends heavily on media timings. The way my app works is it uses libvlc to play video content into a window that I control via the window handle.
I am also using my own multi-threaded environment for one subtask.

My desktop application works beautifully so far, and after three months of dev this is the first time I feel really "stuck", though I had some dark days :)

The problem I'm having is with timing. My test cases occur from ripped DVDs and Blu-rays. When I rip a commercial dvd to an MP4 or even VOB format, the timing of movie events is "off" from when I compare with the same physical dvd playing. For instance, in a movie, a scene might appear at exactly 1 minute 10 seconds on the digital version (MP4) but when I play the exact same physical DVD, the timing of that same event is off by a seemingly random amount. Today I timed a sequence of events that were off by 6998ms, 3714ms, 1156ms, and 1092ms from their digital counterparts, on my blu-ray drives. While the intervals decrease in this test case, it is not always the same. Sometimes it increases, then decreases, or other random timings emerge. I have not discovered a pattern of any kind in how the timings are off.

This only seems to happen between digital formats versus physical dvd format. Digital is almost always perfect, and mechanical DVD player is almost always off, sometimes by significant amounts.

The DVD players I use for test comparisons are: An external LG USB slot drive DVD-only player, circa 2016. For blu-ray and DVD I use an LG player inside a usb3 nexstar 5.25" enclosure, both probably circa 2010 or so. I am willing to buy some other dvd and blu-ray players if someone thinks this might be hardware-related. I use the slot-drive external usb dvd drive on desktops and laptops for testing. The blu-ray I've used only on my main dev desktop machine.

Also, the digital formats - especially MP4 - are spot-on with timings BUT the timings BETWEEN an MP4 and a VOB are sometimes off by seemingly small amounts. During one test session, an MP4 and a VOB were off on only the very first event timing, and nailed every one after that.
I can locate scene start and end points down to hundredths of a ms with decent accuracy, and it is repeatable, in a digital format. But as soon as I go to the physical counterpart, I get seeming random timings.

Last, I have compared my timings with closed caption timings on at least one commercial disk, and the CC timings are almost spot-on to the digital versions. I used ccextractor to retrieve these timings BUT the timings came from ripping the original DVD to its VOB components, into a folder, and loading those VOB files into CCextractor to parse the timings of speech and events. There is no way in ccextractor to pull CC off of a live physical and commercial DVD, because it must first be decoded somehow for it to read the CC data. Still, since the CC are encoded into the disk, they don't change, so they are a pretty good benchmark for timing accuracy.

Here are my own thoughts of what could be causing this discrepancy.
1. The modern slot-drive DVD is far more accurate than the older blu-ray in the external enclosure. While both are USB, the modern one has fewer issues with timing, but still has them. My first successful test run was using this drive and it worked pretty well, but it was still at least occasionally off from the disc's digital counterpart. Am I just using tech that is too old? Is it perhaps the USB connection that may be faulty?

2. The physical DVDs and blu-rays appear to run at 29.97fps, whereas when I rip to MP4, it is a 23.976fps rate. Of course, the VOBs are also 29.97fps. What is the behaviour of a ripping program when it rips to a lower frame rate - does it drop frames to shrink the number? Does it combine them? Could this cause the timings to be off in random ways?

3. Is it a dvd caching issue, per here: https://wiki.videolan.org/WindowsFAQ-1. ... 2C_etc..29
If so, how do I increase the cache via libvlc?

Ideas? Am I missing something?

Thanks for any help!

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: timing sync in physical dvd versus vob versus mp4

Postby Jean-Baptiste Kempf » 14 Jan 2018 11:11

I'd argue the issue is related to 23.97 vs 29.97. You should set your ripping program to get it at the native fps of the DVD.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

airesoft
New Cone
New Cone
Posts: 3
Joined: 10 Jan 2018 05:44

Re: timing sync in physical dvd versus vob versus mp4

Postby airesoft » 16 Jan 2018 18:14

You may well be right.

Upon investigation, it appears that the ripping program is not consistently ripping "same as source" as the default setting suggests. Examining the final mp4 file with mediainfo, It is ripping BOTH dvd and bluray at the same framerate, which surprised me. Thus, when ripping a retail dvd it appears it is reducing the fps from 29.97fps to 23.976fps. Bluray is consistent at 24p when ripping. This looks like a great starting point to confirm this is the problem. Even if it is not, it is likely this would eventually cause some other problem, so it's a significant find.

The reason this needs to be solid is my application uses the digital/ripped version of media to establish a timing baseline, but all media consumers will be using retail spinning media, for now.

I'll postback with my findings after a few days of testing.

I truly appreciate your valuable input.

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: timing sync in physical dvd versus vob versus mp4

Postby Jean-Baptiste Kempf » 17 Jan 2018 11:58

I'll postback with my findings after a few days of testing.
I'll wait, yes.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.

airesoft
New Cone
New Cone
Posts: 3
Joined: 10 Jan 2018 05:44

Re: timing sync in physical dvd versus vob versus mp4

Postby airesoft » 26 Jan 2018 07:14

It turns out the ripping program appears to be defaulting to 24p and is not responding to settings changes. (I'm putting in a bug request with the ripping program author.)

Therefore, I am unable to properly compare ripped DVDs to spinning DVD timings because I can decode at least some of the spinning media in VLC, at 30P, but I am comparing it to the ripped version at 24P.
As for bluray, I am unable to compare due to the inability to decrypt spinning blu-ray media in VLC, though both the bluray disc and the decrypted hard drive version are both 24P.

So, I've decided to advance to "epic 2" in my project, which was already part of my original plan after this proof of concept phase. In epic 2 I rearchitect my application to abstract the player. This should allow me to play the spinning blu-ray media in player software that can decrypt spinning media, and thus compare the timings to my baseline ripped version.

Kind thanks for your help.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 12 guests