Audio "Delay Relative to Video" in MKV with Handbrake - What Causes it? Is it an issue? How to Fix It?

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
spiritofjerry
Posts: 7
Joined: Tue Aug 17, 2021 5:42 am

Audio "Delay Relative to Video" in MKV with Handbrake - What Causes it? Is it an issue? How to Fix It?

Post by spiritofjerry »

I have noticed that whenever I encode audio to AAC or AC3 from the DTS-HD master track and choose an MKV container for my resulting video/audio encode, I get differing values for the audio delay offset relative to video. My question/issue is EXACTLY the same as the one posted on the MakeMKV forum here: https://forum.makemkv.com/forum/viewtopic.php?t=24267. I will be copying the question from that post below in hopes someone can enlighten me as to why this happens:
Whenever I rip Blu-ray movies I own to MKV videos using MakeMKV, things are fine.

And when I use Handbrake to compress the ripped MKV files to mp4, things are fine.

However, whenever I compress the original MKV files into other MKV files, the "Properties" and "Media Info" in Players such as MPC-BE and MPC-HC show a new category under the Audio. This new category under the Audio is, "Delay Relative to Video."

Whenever I change a DTS sound format into the AC-3 format in order to compress the sound into either 448kbs or 640kbs, it shows a "Delay Relative to Video" of -5ms.

In VLC, in the Codec and Media Information, I do not see that type of "Delay" category listed.

Whenever I change that same DTS sound format into another audio format such as AAC, it is even longer. With AAC it will show a "Delay Relative to Video" of -18ms.

I've studied this online. There are videos that say, "The problem that is likely causing this is Variable Frame Rates." So they say, "The solution is to select Constant Frame Rate in Handbrake." I have done that all along. I've tried it both ways. I even tried one called "Peak Frame Rate." None of those seem to matter.

When I use Handbrake to make only the video, and then use MKVMerge to add the original audio back into the compressed file, things are fine. But, that still leaves those very large audio files that are not good for everything. AC-3 Dolby Digital is the one that has the most compatibility. So, that is the file I'd like to use for audio.

In Handbrake, even if I select "Auto Passthrough" or "DTS Passthrough" for the original audio, it still produces a form of "Delay Relative to Video." But, rather than being "negative," it is "positive." When I use the "Passthrough" in Handbrake, the compressed MKV file will have a "Delay Relative to Video" of 2ms.

One other thing I tried was very interesting. I used Handbrake to compress the original MKV file into an mp4 file. As expected, there was no form of "Delay Relative to Video" shown in the compressed mp4 file. So, I opened MKVMerge and placed the mp4 file in it. I then saved that mp4 file as an MKV file. The MKV file played fine; however, it now had a "Delay Relative to Video" of -2ms.

The "Delay Relative to Video" of -5ms, -4ms, -3ms, -2ms, and 2ms are things I really cannot even notice. I can't even notice the "Delay Relative to Video" of -18ms and -21ms with the AAC format. But, I'm just wondering "Why" does this occur? And "How" can it be fixed?
Woodstock
Veteran User
Posts: 4619
Joined: Tue Aug 27, 2013 6:39 am

Re: Audio "Delay Relative to Video" in MKV with Handbrake - What Causes it? Is it an issue? How to Fix It?

Post by Woodstock »

And if you check the handbrake forum and github, there are questions about audio sync there.

The latest batch seem to be related to the quality selected with the NVENC encoder, and the video time codes getting screwed up. They're still trying to lock that down.
User avatar
Ritsuka
HandBrake Team
Posts: 1655
Joined: Fri Jan 12, 2007 11:29 am

Re: Audio "Delay Relative to Video" in MKV with Handbrake - What Causes it? Is it an issue? How to Fix It?

Post by Ritsuka »

That’s not an issue. Each audio format has a priming delay, HandBrake set it instead of letting the player guess what the delay is.
spiritofjerry
Posts: 7
Joined: Tue Aug 17, 2021 5:42 am

Re: Audio "Delay Relative to Video" in MKV with Handbrake - What Causes it? Is it an issue? How to Fix It?

Post by spiritofjerry »

Thanks, Ritsuka. That makes sense, and I've heard something about such delays before, but I've never really understood the nuts and bolts about what happens under the hood. Perhaps I don't need to understand, but your comment assuages any concerns.
Post Reply