[RESOLVED] Bad delay values for audio demuxed from bluray with a range set

Support forum for DGDecNV
Post Reply
gonca
Distinguished Member
Distinguished Member
Posts: 607
Joined: Sun Apr 08, 2012 6:12 pm

[RESOLVED] Bad delay values for audio demuxed from bluray with a range set

Post by gonca » Fri Jun 15, 2018 5:25 pm

When using this new feature I tried using the range ability of DGIndexNV, i.e. trim
I demux the audio and subs and save project
The delay that is written in the audio name is off by approximately 500ms, tried two BDs
I read about the offsets but I don't see where the PTS values are or how to use them.
DGIndexNV reports the offset as bytes but the audio delay is reported in ms.
Can someone point me in the right direction

User avatar
admin
Site Admin
Posts: 4002
Joined: Thu Sep 09, 2010 3:08 pm

Re: Bad delay values for audio demuxed from bluray with a range set

Post by admin » Fri Jun 15, 2018 6:32 pm

Forget about the range numbers in the DGI file. They are not intended to be useful for any aspect of a workflow. They exist only to allow the range configured in the GUI to be re-established when you load a DGI file into DGIndexNV. It simply stores the locations on the navigation bar where the [ and ] have been set. You cannot relate them to PTS values, etc. If you are interested in PTS values, then look into the Log Timestamps setting.

Let's go directly at this. I assume you are loading an MPLS, enabling demuxing of audio and subs, setting a range with [ and ], and then doing Save Project. Then you say that the audio delay of a demuxed audio file is off by 500ms. It's surprising that it would be off by that much, so we should look into it.

First, please explain in detail how are you establishing that it is off by 500ms.

Second, since we are talking about audio, best would be for you to just load the first M2TS (the playlist may contain several). Then set your range, etc. If you can create the issue that way, I will ask you to upload the M2TS to my FTP along with the DGI file (which I can use to recreate your [ and ]).

I am breaking this out to a new thread as it is not a feature request.

User avatar
admin
Site Admin
Posts: 4002
Joined: Thu Sep 09, 2010 3:08 pm

Re: Bad delay values for audio demuxed from bluray with a range set

Post by admin » Fri Jun 15, 2018 6:57 pm

I tested the process of setting a range, etc., with the bluray Ultraviolet. The following 64-bit script plays with acceptable audio sync with MPC-HC:

loadplugin("dgdecodenv.dll")
loadplugin("nicaudio.dll")
vid=dgsource("H:\ULTRAVIOLET\FullDisc\00000086_ULTRAVIOLET\BDMV\STREAM\00012.dgi")
aud=nicac3source("00012 PID 1100 3_2ch 48KHz 640Kbps DELAY -82ms.ac3",2).delayaudio(-0.082)
audiodub(vid,aud)

Note that the delay value may not be perfectly exact (due to the granularity of audio blocks) and in some cases it may require tweaking by (for example) up to 16ms (half an AC3 audio block), depending on how sensitive you are to small desyncs. But it shouldn't be off by 500ms! Using MPC-HC, you can set an audio delay and you can use that feature to determine the amount by which to tweak if necessary. Then you adjust the DelayAudio() call appropriately and off you go with your encoding. Or you can just blindly try small adjustments until you are happy.

Finally, assessing audio sync by observation can be tricky. If the desync is small it's hard to even be sure whether the audio is late or early. There is an Avisynth plugin that overlays the audio waveform on the video that you can use to tweak things exactly by observing a frame with a sudden loud sound.

gonca
Distinguished Member
Distinguished Member
Posts: 607
Joined: Sun Apr 08, 2012 6:12 pm

Re: Bad delay values for audio demuxed from bluray with a range set

Post by gonca » Fri Jun 15, 2018 8:02 pm

Thanks for splitting it off
You have my procedure right
After the Save Project I encode the audio and video and remux into MKV
I believe that the audio delay is off by about 500ms because when I watch the final remux the sync is off by about half a second
Note that if I don't use the range [] feature there is no problem
Let me try a straight demux / remux to see if it still happens

User avatar
admin
Site Admin
Posts: 4002
Joined: Thu Sep 09, 2010 3:08 pm

Re: Bad delay values for audio demuxed from bluray with a range set

Post by admin » Fri Jun 15, 2018 8:11 pm

What is your script and how did you encode, etc? What was the reported delay and how did you correct for it?
Let me try a straight demux / remux to see if it still happens
I don't see how that can help. If you just give me the stream so I can reproduce it, it will be a lot faster than you running experiments with limited knowledge of the internals.

gonca
Distinguished Member
Distinguished Member
Posts: 607
Joined: Sun Apr 08, 2012 6:12 pm

Re: Bad delay values for audio demuxed from bluray with a range set

Post by gonca » Fri Jun 15, 2018 8:20 pm

Ok, I'll start copying the m2ts to the HDD
Do you want the full M2TS?

User avatar
admin
Site Admin
Posts: 4002
Joined: Thu Sep 09, 2010 3:08 pm

Re: Bad delay values for audio demuxed from bluray with a range set

Post by admin » Fri Jun 15, 2018 8:35 pm

Yes, please. And the DGI file you made.

Do you still have my FTP details?

I also ask again "What is your script and how did you encode, etc? What was the reported delay and how did you correct for it?"

gonca
Distinguished Member
Distinguished Member
Posts: 607
Joined: Sun Apr 08, 2012 6:12 pm

Re: Bad delay values for audio demuxed from bluray with a range set

Post by gonca » Fri Jun 15, 2018 8:57 pm

I looked up the FTP details from the PM
The reported delay is -573ms
Encoded using NVEncC
Cmd line is

Code: Select all

"C:\Program Files (Portable)\StaxRip\Apps\NVEnc\NVEncC64.exe" --vbrhq 17500 --codec h265 --preset quality --level 4.1 --gop-len 24 --lookahead 32 --qp-init 1 --vbr-quality 25 --aq --cuda-schedule auto --colormatrix bt709 --colorprim bt709 --transfer bt709 --mv-precision q-pel --cabac -i  -o T:\TEMP\%source_name%_temp\_out.h265
Script is

Code: Select all

import vapoursynth as vs
core = vs.get_core()
core.std.LoadPlugin("C:/Program Files (Portable)/dgdecnv/x64 Binaries/DGDecodeNV.dll")
clip = core.dgdecodenv.DGSource(r'T:\TEMP\00042.dgi', fieldop=0)
clip.set_output()
Audio need not be encoded, just remuxed with the video, encoded or not, into a MKV
00042.dgi
(3.24 MiB) Downloaded 10 times
I'll upload the file first thing in the morning

User avatar
admin
Site Admin
Posts: 4002
Joined: Thu Sep 09, 2010 3:08 pm

Re: Bad delay values for audio demuxed from bluray with a range set

Post by admin » Fri Jun 15, 2018 9:08 pm

You did not correct for the reported delay!

Normally you do it in your script as I showed using DelayAudio(). If you are not re-encoding the audio then you have to correct it with a tool such as DelayCut. I believe that you may be able to set a delay in MKVMerge when muxing the MKV also, but wouldn't swear to it.

The reported delay is telling you that the two streams will be off by that much if you simply remux them. That's the whole purpose of it. Now you will ask why don't I cut the audio when demuxing it. It's too late this evening to get into that. Suffice to say you MUST correct for the reported delay.

gonca
Distinguished Member
Distinguished Member
Posts: 607
Joined: Sun Apr 08, 2012 6:12 pm

Re: Bad delay values for audio demuxed from bluray with a range set

Post by gonca » Fri Jun 15, 2018 9:17 pm

Actually, I was going to say that when I use MKVToolNix to remux the streams it sees the delay in the name and corrects for it
I check for that in "Delay (ms)" box with the audio selected

Post Reply