View Full Version : MKV Delay
egrimisu
29th June 2011, 21:50
Hi,
How can i find in a mkv container what was the delay applied to the audio?
Thanks
sneaker_ger
29th June 2011, 22:22
MediaInfo
egrimisu
29th June 2011, 22:52
MediaInfo
I'm not sure if mediainfo returns the corect value since the delay added to mkvmerge was -216ms:
eneral
Unique ID : 197952092211473063608777363942701819616 (0x94EC2FAA6FF7B51CB15138B329D066E0)
Complete name : D:\Touch_ED3(MPEG2.AC3)[egrimisu].mkv
Format : Matroska
File size : 86.9 MiB
Duration : 1mn 43s
Overall bit rate : 7 071 Kbps
Movie name : Tocuh - ED3
Encoded date : UTC 2011-06-29 21:16:32
Writing application : mkvmerge v4.8.0 ('I Got The...') built on May 24 2011 03:12:58
Writing library : libebml v1.2.0 + libmatroska v1.1.0
Attachment : Yes / Yes / Yes / Yes / Yes / Yes / Yes / Yes / Yes
Video
ID : 1
Format : MPEG Video
Format version : Version 2
Format profile : Main@Main
Format settings, BVOP : No
Format settings, Matrix : Custom
Codec ID : V_MPEG2
Codec ID/Info : MPEG 1 or 2 Video
Duration : 1mn 43s
Bit rate mode : Variable
Bit rate : 6 546 Kbps
Nominal bit rate : 9 800 Kbps
Width : 720 pixels
Height : 480 pixels
Display aspect ratio : 4:3
Frame rate : 59.940 fps
Original frame rate : 29.970 fps
Standard : NTSC
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan order : Top Field First
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.316
Stream size : 80.5 MiB (93%)
Language : Japanese
Audio
ID : 2
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Muxing mode : Header stripping
Codec ID : A_AC3
Duration : 1mn 43s
Bit rate mode : Constant
Bit rate : 384 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Delay relative to video : 8ms
Stream size : 4.72 MiB (5%)
Language : Japanese
Text
ID : 3
Format : ASS
Codec ID : S_TEXT/ASS
Codec ID/Info : Advanced Sub Station Alpha
Compression mode : Lossless
Language : English
sneaker_ger
29th June 2011, 23:59
Negative delays cannot be reconstructed, as mkvmerge will drop frames which would have negative timecodes. Nothing to worry about.
egrimisu
30th June 2011, 07:46
i have just demuxed the audio stream and drop the original one and the demuxed one in audacity, and it's true , negative values are cut.
Is this tha same for other audio codecs? like mp4 for example that usualy use vbr?
sneaker_ger
30th June 2011, 14:08
It should be the same for all codecs.
egrimisu
30th June 2011, 20:42
thanks for the help.
Selur
2nd July 2011, 06:07
Did I get rthis right? If you muxes anything with a negative delay and wants to mux it int another container later (use mkv as intermediate container), one is lost since one can't get the negtive delay from the mkv file ?
Cu Selur
sneaker_ger
2nd July 2011, 14:55
You are not lost. If you want to do it with egrimisu's sample you just demux and choose +8ms delay for the new container.
Selur
4th July 2011, 11:54
Okay, so the audio stream extracted has some sort of changed delay (from -216 to 8ms)?
nurbs
4th July 2011, 14:42
Yes. You can't have a negative delay in MKV and you usually can't cut an arbitrary number of ms from the audio, so if the audio can't be cut exactly to the delay you specified you'll end up with some positive delay.
For example if you need a delay of -216ms and you can only cut multiples of 16ms from the audio you'll end up with +8ms.
sneaker_ger
4th July 2011, 16:06
Yes, only that an ac3 frame is 32ms long.
mkvmkerge deletes all the frames that would have a negative timecode, i.e.:
216ms / 32ms = 6.75
Since it can only delete complete frames it will do so for the first 7 frames * 32 ms = 224 ms
To account for that extra negative delay, mkvmerge will skew all timecodes by:
224ms - 216ms = +8ms
nurbs
4th July 2011, 19:05
I didn't know the length of ac3 frames so I just used some arbitrary numbers that fit :)
sneaker_ger
4th July 2011, 19:42
I figured as much - just wanted to stay loyal to the sample.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.