DGDemux development

User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

It was easy. Next build.
User avatar
Bullwinkle
Posts: 338
Joined: Thu Sep 05, 2019 6:37 pm

Re: DGDemux development

Post by Bullwinkle »

Rocky, Sherman told me Natasha is like a mosquito. It's not her fault.
User avatar
Mr. Peabody
Posts: 45
Joined: Tue Dec 24, 2019 9:20 am

Re: DGDemux development

Post by Mr. Peabody »

Give a little, get a little, but do not give away your soul.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

You guys are too deep for me.
DAE avatar
RGB

Re: DGDemux development

Post by RGB »

DGDemux works fine for me on Wine stable (installed after adding the WineHQ and Wine OBS repos) on Debian 10. Both GUI...

Code: Select all

wine DGDemuxGUI.exe
...and CLI (following the example given in DGDemux.txt)...

Code: Select all

wine DGDemux.exe -i filepath/BDMV/PLAYLIST/filename.mpls -o ~/Videos/whatever
...versions work fine. I didn't have to use winepath or anything like that. So far, I have tested one UHD BD and one standard BD. Thanks for making this tool!
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

Thank you RGB! It's great to hear that things are working under Wine. Takes a little pressure off to make a native Linux version.
DAE avatar
domy
Posts: 28
Joined: Fri Mar 20, 2020 10:50 am

Re: DGDemux development

Post by domy »

Hi,

I've noticed an issue with duplicated audio frames in the Dolby TrueHD stream. This is the Moana US UHD blu-ray, and playlist 00800 consists of the segments 55,59,61. The TrueHD audio frames between segments 55 and 59 are duplicated: (same between 59 and 61, but this one's easier to see)

moana-dgdemux-annotated.png
  • The top track is remuxed with DGDemux from the BD.

    Code: Select all

    DGDemux -i "BDMV\PLAYLIST\00800.mpls" -o "moana-dgdemux-00800" -demux 1100
    eac3to moana-dgdemux-00800.thd moana-dgdemux-00800.flac -mono
    
  • The second track is the TrueHD stream from 55.m2ts, which is the first segment of the film.

    Code: Select all

    eac3to "BDMV\STREAM\00055.m2ts" 2: 1_55.flac -mono
  • The third track is the TrueHD stream from 59.m2ts, which is the second segment of the film.

    Code: Select all

    eac3to "BDMV\STREAM\00059.m2ts" 2: 2_59.flac -mono
I've aligned 55 and 59 so that the audio frames overlap, but DGDemux appears to concatenate them together.

There's two issues I see with that: (1) This introduces a +40 samples (.083ms) delay on every such boundary, and (2) in some situations this could result in an audible crack/pop/whatever. Of course the delay itself isn't noticeable at all on its own, but with movies like Toy Story 4 (which has 60-some segments) it could be significantly out-of-sync by the end of it. I'd also argue that in the pursuit of perfection, there should be a 0ms delay throughout :)

Every Disney/Pixar film I've analyzed so far (Brave, Frozen, Frozen II, Moana, and more) has these overlapping audio frames at the segment boundaries.

MakeMKV has the same issue and CloneBD does too (among other things), which makes me wonder if this is even fixable. But I thought you should know about it.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

Thank you for your report, domy, and welcome to the forum!

There are two approaches for dealing with file gaps: 1) delete duplicate frames at the gaps, and 2) do a Bresenham-like algorithm just deleting frames as needed. Method 1 was working for most blurays but is now failing for UHD titles. Method 2 was working correctly for the UHD titles. Yes, the duplicates are not touched but there should be good audio sync throughout. DGDemux uses method 2. You speculate that audio sync could be off but have you actually tested it? If you report any audio sync issue I will buy the disk and investigate, but I am not planning to do anything regarding duplicate frames (could change depending on what we see in the wild).
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

Hey domy, what application did you use for the screenshot above? I'm going to look deeper into all this.
DAE avatar
zqslzwzw
Posts: 18
Joined: Fri Nov 29, 2019 8:35 am

Re: DGDemux development

Post by zqslzwzw »

Hi,

I would like to report two minor issues of the latest DGDemux 1.0.0.20 with regard to the option 'Do not split THD'.
1) With the latest DGDemux, no matter whether the option is checked, the THD stream(s) will be demuxed.
2) If the option is checked, the language property of the generated .thd file is missed, such as '00800 PID 1100.thd'.
DAE avatar
domy
Posts: 28
Joined: Fri Mar 20, 2020 10:50 am

Re: DGDemux development

Post by domy »

The software is called Audacity, it's free.

I suppose that begs the question how we define out of sync. I consider "in sync" to be each segment's (.m2ts) raw audio stream, concatenated together with duplicated frames at the tips overlapping, regardless of the video signal. This only holds if we assume that .m2ts files are in sync and that there aren't any duplicated video frames (I'm not sure how to verify the latter). In that case the total length is 1:47:12.635. DGDemux's TrueHD stream duration is 1:47:12.6367. Both are perfectly in sync up until the end of segment #1. By the third segment, DGDemux's output (top track) is 80 samples late - this is 8 seconds before the film ends:

moana-dgdemux-total-sync-annotated.png

By that definition, I'd say this is out of sync.

Sidenote: If I count the video frames of the movie, I get a total length of 1:47:12.6345: 154,229 * (24000 / 1001):

Code: Select all

$ ffmpeg -i "Moana.mkv" -map 0:v:0 -c copy -f null -
154,229
If you already have any Disney/Pixar UHD blu-ray, tell me which and I'll most likely find the same issue. I chose Moana for this example because it's only three segments and you can quite easily see the duplicated waveforms. I can also try this with a disc that has many more segments and see how much it accumulates, if you want.

Oh and since I forgot to mention it before, I used DGDemux 1.0.0.20.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

I define it as audio within 50 ms of the video at all points in the movie. There should be no perceptible async at any point. The desync you show appears to be 1ms if I read the app correctly.

Let's continue with CARS_2 for now (I will buy Moana). I also have TOY_STORY_4_3D. I will get Audacity.

I do not currently do any gaps processing for THD but only for the embedded AC3 (when it is demuxed to a separate file). That is because the THD frames are so short that they do not accumulate to an out of sync condition (per my definition), even for a large number of M2TS files. Nevertheless, I do not rule out doing processing for THD. It may also be possible to combine methods 1 and 2 for gaps correction, and achieve what you call perfect sync.
DAE avatar
domy
Posts: 28
Joined: Fri Mar 20, 2020 10:50 am

Re: DGDemux development

Post by domy »

So I just took a look at Toy Story 4 (US, UHD)'s THD situation. It's a ridiculous disc with 61 segments for the 00800 playlist. All but three segment boundaries have duplicated audio frames. (segments #76-77, #81-82 and #109-110 did not overlap)

Movie length: 143,939 video frames, 1:40:03.4557916666...
THD tracks end-to-end aligned: 288,168,120 samples, 1:40:03.5025
THD tracks aligned with dupe frames overlapping: 288,165,840 samples, 1:40:03.455

So by the end, the audio is 47.5 ms late. That meets your goal of <50 ms, and Toy Story 4 is one of the most segmented UHD blu-rays out there that I know of, so this is definitely an extreme case ...

Until I discovered that Monsters University (US, UHD) has 135 segments, wow. It appears that it suffers from the same issue: the movie is 1:43:48.389, but DGDemux's THD track of that disc is 109ms longer, coming in at 1:43:48.498. After muxing DGDemux's THD and HEVC stream back together, I've measured a 92ms delay (+/- 20ms or so*) at the very end (the pixar lamp scene) against the reference 00160.m2ts. It is noticeable if you know what to look/listen for. This one exceeds the 50ms threshold around midway through the film.

Aside from that:
  • I don't get any pops/cracks during THD playback, unlike with MakeMKV, which is great :)
  • The GUI crashes when selecting a playlist if the disc's path contains a ] (closing square bracket).
(* It's a comparison of 120fps slow-motion recordings taken of the movie overlayed with Windows's volume mixer - kinda jank but works).
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

Thank you, domy, for your test results. That Monsters University is pretty insane with 135 segments. I'm going to have to implement gaps processing for THD. I'll buy the disk and get on it when I finish up HEVC seeking.

Let's calculate: 135 x 0.8ms (size of a THD frame) = 108 milliseconds. That is close to your 92ms and 109ms, so this is theoretically understood and thus fixable.

I have the ] bug fixed locally and will include it in the next slipstream.

Stay safe and well, my friend!
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

zqslzwzw wrote:
Sat Mar 21, 2020 7:37 am
I would like to report two minor issues of the latest DGDemux 1.0.0.20 with regard to the option 'Do not split THD'.
1) With the latest DGDemux, no matter whether the option is checked, the THD stream(s) will be demuxed.
2) If the option is checked, the language property of the generated .thd file is missed, such as '00800 PID 1100.thd'.
I just noticed this as it got scrolled off. I'll look into it tomorrow. Thank you for your report.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

zqslzwzw wrote:
Sat Mar 21, 2020 7:37 am
1) With the latest DGDemux, no matter whether the option is checked, the THD stream(s) will be demuxed.
I have duplicated this for do_not_split and have it fixed locally. But I can't duplicate it for when do_not_split is not checked. Can you try that again please?
2) If the option is checked, the language property of the generated .thd file is missed, such as '00800 PID 1100.thd'.
The name should be rewritten after the file is closed (when demuxing finishes) with full info in the name. Is that not happening for you?
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

zqslzwzw hasn't been here for a while so I am going to release the fixes that I have:

* Opening MPLS with [] characters.

* Fix always demuxes THD even when disabled for do not split mode.

The second one also needs to be done for DGIndexNV.

After that, back to DGHDRtoSDR stuff.
User avatar
Bullwinkle
Posts: 338
Joined: Thu Sep 05, 2019 6:37 pm

Re: DGDemux development

Post by Bullwinkle »

Rocky wrote:
Sun Mar 22, 2020 11:16 am
That Monsters University is pretty insane with 135 segments.
Still waiting for the disk to arrive. Not an essential product? GTFOOH. STOMP!
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

Monsters disc is here and being ripped right now.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

@domy

How did you get Audacity to open your thd file? I have Audacity 2.3.3 and ffmpeg 2.2.2, and I have set it in Preferences/Library. But still, when I try to open my thd file, it says cannot and suggests installing ffmpeg.

Audacity log:

11:32:08: File name is D:\tmp\DGDemuxGUI test\00801 PID 1100 48000 8ch eng DELAY 0ms.thd
11:32:08: Mime type is *
11:32:08: Opening with libsndfile
11:32:08: Opening with liboggvorbis
11:32:08: Opening with libflac
11:32:08: Opening with lof
11:32:08: Opening with libav
11:32:15: Error: FFmpeg: avformat_find_stream_info() failed for file D:\tmp\DGDemuxGUI test\00801 PID 1100 48000 8ch eng DELAY 0ms.thd
11:32:15: Error: can't flush file descriptor 5 (error 5: Access is denied.)
11:32:15: Error: Importer::Import: Opening failed.

Note that import of the separate embedded AC3 succeeds. Also, when opening Audacity it shows that ffmpeg was loaded.
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

So it will open some sample files I downloaded but fails on anything from a UHD bluray. Any ideas?
DAE avatar
Guest

Re: DGDemux development

Post by Guest »

Did you try to Import as Raw Data?
Worked on my system
User avatar
Rocky
Posts: 3555
Joined: Fri Sep 06, 2019 12:57 pm

Re: DGDemux development

Post by Rocky »

It may appear to work. But raw data is uncompressed and raw with no metadata. A THD file is not that. You can read anything as raw!
DAE avatar
Guest

Re: DGDemux development

Post by Guest »

Well I found this
https://forum.audacityteam.org/viewtopic.php?t=88387
Seems there is a size issue, apparently it will only open smaller thd (size) files
Also ffmpeg plugin 2.2.2 does not support "thd atmos"
DAE avatar
Guest

Re: DGDemux development

Post by Guest »

Quick test
BluRay thd track with no atmos 2.38 GB opens fine
UHD thd track with atmos 4.00 GB does not open
UHD thd track with atmos 3.49 GB does not open
Issue does appear to be atmos
Post Reply