View Single Post
Old 2nd April 2016, 12:04   #210  |  Link
gpower2
gMKVExtractGUI author
 
gpower2's Avatar
 
Join Date: Aug 2003
Location: Greece / Thessaloniki
Posts: 251
Well, I guess when I was asked to include CodecPrivate, mkvmerge didn't output it, or I was lazy enough not to check for it!

As for the relative delay, it was indeed quite tricky to quickly determine it. I only try to find the relative delay for video and audio tracks, and not subtitle tracks, since this information isn't really useful to anyone.
In order to find it, I execute mkvinfo with --check-mode option, parsing its output line by line, trying to match this regex:
Code:
"track number {0}, \d frame\(s\), timecode (\d+\.\d+)s"
I then check if the delay (first timecode) is for a video track or for an audio track, assuming that there is only one video track for the file.
After I find the delays for all the tracks, I kill mkvinfo process, in
order to not waste time, and calculate the relative delay for the audio tracks.
Most of the times, video tracks have 0 delay, so the audio tracks' relative delay is the same as their first timecode. If video track has a delay greater than 0, then audio tracks' relative delay is calculated as track's delay minus the video track's delay.

I know it's way hacky, but it was the fastest and only way to get this information. If you have a better way of determining this, I'm all ears!

PS.
This procedure is executed immediately after getting mkvmerge's identify output, so I already have a list of the tracks and their types, in order to get the info I want from mkvinfo's output and then kill it immediately.
gpower2 is offline   Reply With Quote