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!