Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > New and alternative a/v containers

Reply
 
Thread Tools Search this Thread Display Modes
Old 26th April 2019, 08:59   #361  |  Link
kuchikirukia
Registered User
 
Join Date: Oct 2014
Posts: 476
I've uploaded a PAL DVD .VOB to your FTP that exhibits some weird behavior. The weirdness I'm seeing when trying to frame serve this is probably due to bugs in LSMASH and FFMS2, but I've just never seen LSMASH behave this way.

Muxing this VOB to mkv with mkvtoolnix ends up with a weird mediainfo that claims variable frame rate and 47.867 FPS. From the mkv, LWLibavVideoSource will frame serve 54099 frames with a seemingly random duplicate frame pattern, while it shows 28255 frames with no dupes when used on the VOB.
FFMS2 locks up on both the mkv and VOB, and shows 54099 frames from the mkv and 28254 from the VOB.
DGDecode shows 28255 frames on the VOB or demuxed mpeg from the mkv.

There's no problem playing either the mkv or VOB in MPC-HC.
kuchikirukia is offline   Reply With Quote
Old 26th April 2019, 11:41   #362  |  Link
hubblec4
Matroska find' ich toll
 
Join Date: Apr 2008
Posts: 1,370
SegmentInfo

Hi Mosu

It seems the SegmentInfo.dtd is not correct, but mkvmerge handles the structure correctly.

SegmentFamily ist marked with a "?" (no or one times) but it can added multiple times, the asterisk sign (SegmentFamily*) should be used.
And the ChapterTranslateEditionUID has no extra sign but it should also have the asterisk sign (ChapterTranslateEditionUID*).

Some question about the Info elements:
Mkvmerge can use all Info elements which are available in the info.XML.
Mkvpropedit can edit all this elements too? And additionally I can edit some more elements like the Info Title.?

And then there are some elements which can't be edited, this values are written while mkvmerge mux the mkv file.
- Duration
- DateUTC
- MuxingApp
- WritingApp

The TimestampScale element can be set before I mux an mkv. Is this only possible with a command line switch?

Best regards
hubble
hubblec4 is offline   Reply With Quote
Old 26th April 2019, 14:34   #363  |  Link
Liisachan
李姗倩 Lǐ Shān Qiàn
 
Liisachan's Avatar
 
Join Date: Nov 2002
Posts: 1,340
A question about the value of a track-specific BPS tag

Hi, Mosu.

I have an Ogg Vorbis file, 15188168 bytes, 1448.447 sec (69525456 samples in 48000 Hz), that is 83887 bps (~84 kbps).

When I mux it into MKV using mkvmerge v33.1.0, a SimpleTag with TagName BPS is automatically written for the corresponding audio track, and its value is 82787 (~83 kbps), which I can't change even if I use a tags.xml file with:
Code:
<Simple><Name>BPS</Name><String>83887</String></Simple>
Am I correct to assume that this behavior is by design, and the BPS auto-written by mkvmerge is correctly based on some kind of "packet size" in MKV and so slightly smaller than the BPS of the "raw" Ogg Vorbis file?

Sorry if this has been already asked and answered. I did some search and read your changelog entry dated on 2014-05-20, which states:
Quote:
mkvmerge: new feature: mkvmerge will write track-specific tags with statistics (»BPS« for the average number of bits per second
By which I'm guessing that an auto-written BPS is for a track in MKV, and not for the actual audio data, but I'd like to confirm this. TYIA.
Liisachan is offline   Reply With Quote
Old 26th April 2019, 16:15   #364  |  Link
mkver
Registered User
 
Join Date: May 2016
Posts: 197
@Liisachan: The statistics are for the actual data contained in the track in MKV. They do not consider MKV container overhead; and they also do not consider the overhead of the Ogg container (which is usually higher than Matroska overhead). Your other number (for the ogg vorbis file) probably has the ogg container overhead included in its calculation.

@kuchikirukia: First: mkvmerge's code for MPEG-2 is old, buggy and unsupported. So even if there were a bug in mkvmerge, it wouldn't get fixed. That being said, I don't have a reason to think that there is buggy behaviour by mkvmerge here.
Here is some background: A coded picture in MPEG-2 can either be a coded field or a coded frame (and frames needn't be progressive).* Matroska contains blocks and mkvmerge puts each picture in one block. What MediaInfo reports as FPS is in reality the block count per second.
So here are the numbers for your sample: Your sample contains 28255 frame-equivalents (i.e. two coded fields are counted as one frame here). 2*28255-54099 = 2411 of these are coded frames, while 28255-2411 = 25844 are encoded as coded fields (so there are 51688 coded fields). So the block-rate is 54099 / (2411 + 25844) * 25 = 47.8667.
It seems that your tools output two frames for each pair of two coded fields when the container is Matroska. I remember such bugs from H.264. You can report these bugs, of course (but they are not new), but in the meantime you should simply use another container if you work with the said tools.

*: Furthermore, these pictures can contain flags that say that they should be output more than once; the most common application is for coded frames to be output as three fields (i.e. one field output twice). That way one can encode progressive material as 24/1.001p on a DVD and output it as 60/1.001i for compability with legacy CRT (and modern equipment designed for progressive material can get the actual progressive video). This is used on NTSC DVDs, but not for PAL DVDs and therefore you can ignore it.
mkver is offline   Reply With Quote
Old 26th April 2019, 18:11   #365  |  Link
Liisachan
李姗倩 Lǐ Shān Qiàn
 
Liisachan's Avatar
 
Join Date: Nov 2002
Posts: 1,340
@mkver
Thanks! That makes sense. In the past I could manually write a BPS tag via an xml file, and back then I simply wrote file_size_in_bits / duration_in_sec as BPS value -- which is also the bitrate reported by oggenc (the ogg container overhead being included, like you said). As such, the definition of BPS value is now incompatible with that of my old MKV files, and I was a bit confused when I noticed that I can no longer explicitly write a BPS tag via xml. Still, if this is by design, I'm fine with that. A 1 kbp/s difference is not a big deal, and most players/tools probably don't read BPS tags anyway

Edit 2019-09-30
In the specs https://matroska.org/technical/specs...ex.html#BitsPS it is clearly stated that BPS is only the data in the Blocks, and excludes headers and any container overhead.

EDIT2 2019-11-25
If needed, however, you can write a BPS tag freely as you like, by using --disable-track-statistics-tags
For example, you might want to make its value 85000 or 85272.4 or whatever, instead of 85272.

Last edited by Liisachan; 25th November 2019 at 02:29. Reason: added some info
Liisachan is offline   Reply With Quote
Old 8th May 2019, 02:05   #366  |  Link
Perenista
Registered User
 
Join Date: Oct 2013
Posts: 205
Why can't I add .sub (MicroDVD) subtitles to a Matroska? I added an AVI and was going to add the subtitle, now I have to convert to SRT first
Perenista is offline   Reply With Quote
Old 8th May 2019, 04:19   #367  |  Link
videoh
Useful n00b
 
Join Date: Jul 2014
Posts: 1,667
Matroska supports S_VOBSUB subtitles. These are typically named as ".sub" files when demuxed. See here for details and limitations.

https://matroska.org/technical/specs...es/images.html

I don't know anything about MicroDVD.
videoh is offline   Reply With Quote
Old 10th May 2019, 09:47   #368  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 178
I've been working on transcoding some streams in some of my mkv files, and in doing so, I've discovered that several audio streams have a delay compared to the video. This by itself isn't surprising, but what is shocking is that I can't see anywhere this delay is indicated in mkvinfo. Even adding the original file into mkvmerge's GUI shows no delay on these tracks, when there definitely is one; sync is lost without it, and MediaInfo shows a "Delay relative to video" with a positive value for certain audio tracks.

I messed around with -v and -t to mkvinfo, but if either is used, I am inundated with output, and I'm not sure if any of it even shows the delay. How does MediaInfo get this value, and is there some CLI program that will show it to me? I've got literally hundreds of these files, and using a GUI application to look at each one is impractical.
__________________
My filters: DupStep | PointSize
`Orum is offline   Reply With Quote
Old 10th May 2019, 11:01   #369  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Read: MKVToolNix FAQ: Delay not shown in the GUI

Code:
mkvmerge -J "file.mkv"
Shows "minimum_timestamp" (in nanoseconds) for each track. "minimum_timestamp" of audio minus "minimum_timestamp" of video = "delay relative to video" of the audio track as MediaInfo shows it.

You can also see it in the Info tool:

(Here it's 123ms-20ms=103ms audio "delay relative to video".

Of course there's the question of whether or not your workflow is good. If you always work under the assumption that video starts at 0ms and that video and audio tracks are constant framerate it may fail if those aren't true (Matroska supports variable framerates). I also see people needlessly demux e.g. audio tracks instead of just reading them from the mkv file directly when remuxing. When transcoding tracks I would get rid of delays anyways (fill with silence/blackness or remove).
Attached Images
 

Last edited by sneaker_ger; 10th May 2019 at 11:25.
sneaker_ger is offline   Reply With Quote
Old 10th May 2019, 18:13   #370  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 178
So, if I understand correctly, in the mkvinfo -v output, the lines I'm looking for are the first instance of:
Code:
Simple block: key, track number X
for each track. Then if I subtract the value for the each track's initial keys from one another, I can compute the relative delay between the tracks, right? It's a bit tedious but nothing perl can't handle.

I don't see much point in adding silence though, other than to simplify future transcoding. Since that won't happen, I'm not going to worry about it.

Edit: Hrm, I'm not sure what VFR has to do with this though. All the timestamps are in seconds, so why would the audio delay in any way relate to the frame rate?

Edit2: Seems subtitle tracks either lack the "Simple block: key..." line in the output, or it's optional. Anyway, I have the script working to parse the offsets correctly and can now adjust the delay in muxing accordingly. Thanks!
__________________
My filters: DupStep | PointSize

Last edited by `Orum; 10th May 2019 at 20:01.
`Orum is offline   Reply With Quote
Old 10th May 2019, 22:06   #371  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Quote:
Originally Posted by `Orum View Post
Edit: Hrm, I'm not sure what VFR has to do with this though. All the timestamps are in seconds, so why would the audio delay in any way relate to the frame rate?
I'm saying you might be working under wrong assumptions. E.g. that your Matroska files are CFR (except for the delay and some jitter) while that isn't necessarily true. And that the structure is only SimpleBlocks. So now you spent work on implementing delay detection which will probably fail in certain cases. While software like mkvmerge, ffmpeg or eac3to can read from mkv directly without having to implement this.
Maybe in your case it's sufficient or even makes sense. I don't know enough about your workflow or sources. Just my 2 cents ..
sneaker_ger is offline   Reply With Quote
Old 11th May 2019, 08:55   #372  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 178
I'm only transcoding audio, but if I were to do video, I'd check if it's VFR and if so, export & reimport the timecode. All tracks that are not transcoded are taken directly from the original mkv in mkvmerge, which I believe maintains everything in the original (such as timecode) without being explicitly told to do so, though I'd have to check with some VFR footage to verify this.

As for delay, it sounds like it can be done without SimpleBlocks? If so, what do I have to look for?

Quote:
Originally Posted by sneaker_ger View Post
While software like mkvmerge, ffmpeg or eac3to can read from mkv directly without having to implement this.
Is directly reading the binary data the only way to calculate delay with perfect accuracy? If so that seems more like a deficiency in mkvinfo (where it's already awkward to view delay) than anything.

Edit: I did notice that one can simply export the timecode for each stream via mkvextract, and look at the first value in the timecode to determine offset as well. Is this more reliable to determine the delay?
__________________
My filters: DupStep | PointSize

Last edited by `Orum; 11th May 2019 at 09:01.
`Orum is offline   Reply With Quote
Old 11th May 2019, 09:03   #373  |  Link
sneaker_ger
Registered User
 
Join Date: Dec 2002
Posts: 5,565
Quote:
Originally Posted by `Orum View Post
I'm only transcoding audio, but if I were to do video, I'd check if it's VFR
Audio can be variable, too. (gaps) In that case the raw stream + the info about initial delay is not enough to reconstruct the timings. Information is lost.

For audio I would usually use ffmpeg or eac3to (+maybe some external encoder like qaac) which can read directly from mkv and "fix" the delay and any gaps while at it. So I don't see any need to parse mkvinfo at all. (Again: I don't know your reasons/workflow. Maybe you need different software or have other reasons.)

Quote:
Originally Posted by `Orum View Post
As for delay, it sounds like it can be done without SimpleBlocks? If so, what do I have to look for?
I'm saying not all mkv are SimpleBlock.

Quote:
Originally Posted by `Orum View Post
Is directly reading the binary data the only way to calculate delay with perfect accuracy? If so that seems more like a deficiency in mkvinfo (where it's already awkward to view delay) than anything.
No, mkvinfo has the same info as other software.
sneaker_ger is offline   Reply With Quote
Old 11th May 2019, 19:17   #374  |  Link
Perenista
Registered User
 
Join Date: Oct 2013
Posts: 205
Is there a way to do this inside MKVToolnix? If the answer is yes, how?

- Let's say I have an audio track (and we will say this is track #2) that in certain scenes needs the subtitles to be enabled in the Matroska. You know, scenes spoken in another language, that sort of thing.

I already created a subtitle for these parts, and added to the Matroska. Obviously the subtitle file has only text for THESE SCENES. The rest of the movie is not covered by it.

What I want to find out is if:

a) I select the audio track #2;

Then

b) My player will automatically switch to the subtitle I created, even if it's already using another one.

That way when a) is selected b) will follow, meaning the player will automatically refer a) to b) while I am using Media Player Classic.

Meaning even if I select a different subtitle the fact I selected a) will switch the current subtitle selected to... b)
Perenista is offline   Reply With Quote
Old 11th May 2019, 19:32   #375  |  Link
`Orum
Registered User
 
Join Date: Sep 2005
Posts: 178
Quote:
Originally Posted by sneaker_ger View Post
Audio can be variable, too. (gaps) In that case the raw stream + the info about initial delay is not enough to reconstruct the timings. Information is lost.
While I've never actually seen this, I assume the timecode can be extracted, and reapplied--unless one transcodes the audio, which I assume can change whatever "frame" size was used in the original and then things might fail to align.

In any case, as I've never seen this (and only seen silence added at the beginning/end), I'm not going to worry about it. In those edge cases, transcoding should probably be done with eac3to as you mention, at least initially.

Quote:
Originally Posted by sneaker_ger View Post
I'm saying not all mkv are SimpleBlock.
I'll have to do more research into mkv to understand what other methods can be used, but at so far all of mine appear to be able to get the relative delay between video and audio by parsing it.

Quote:
Originally Posted by Perenista View Post
My player will automatically switch to the subtitle I created, even if it's already using another one.
So you want to automatically switch subtitle tracks when the audio track is switched? As far as I'm aware, that's not possible, at least within the mkv file itself. It might be possible with some playback software, but you might need some weird way to try and determine which sub track to use for which audio stream.
__________________
My filters: DupStep | PointSize

Last edited by `Orum; 11th May 2019 at 19:40.
`Orum is offline   Reply With Quote
Old 11th May 2019, 19:47   #376  |  Link
hubblec4
Matroska find' ich toll
 
Join Date: Apr 2008
Posts: 1,370
Quote:
Originally Posted by Perenista View Post
Is there a way to do this inside MKVToolnix? If the answer is yes, how?

- Let's say I have an audio track (and we will say this is track #2) that in certain scenes needs the subtitles to be enabled in the Matroska. You know, scenes spoken in another language, that sort of thing.

I already created a subtitle for these parts, and added to the Matroska. Obviously the subtitle file has only text for THESE SCENES. The rest of the movie is not covered by it.

What I want to find out is if:

a) I select the audio track #2;

Then

b) My player will automatically switch to the subtitle I created, even if it's already using another one.

That way when a) is selected b) will follow, meaning the player will automatically refer a) to b) while I am using Media Player Classic.

Meaning even if I select a different subtitle the fact I selected a) will switch the current subtitle selected to... b)
This is a task of Matroska Chapters with the ChapterTrack element which is not supported by all the players I know.
Or you can use TRACKSETEX, but you need Haali Splitter. It works perfect with MPC-HC.

I work currently on a Github project Matroska-Playback (early state) and here some info about TRACKSETEX and ChapterTrack element.

Last edited by hubblec4; 12th May 2019 at 11:30.
hubblec4 is offline   Reply With Quote
Old 12th May 2019, 05:11   #377  |  Link
filler56789
SuperVirus
 
filler56789's Avatar
 
Join Date: Jun 2012
Location: Antarctic Japan
Posts: 1,351
Quote:
Originally Posted by `Orum View Post
Quote:
Originally Posted by sneaker_ger View Post
Audio can be variable, too. (gaps) In that case the raw stream + the info about initial delay is not enough to reconstruct the timings. Information is lost.
While I've never actually seen this, I assume the timecode can be extracted, and reapplied--unless one transcodes the audio, which I assume can change whatever "frame" size was used in the original and then things might fail to align.
I have not seen (or rather, heard) "VFR audio" in Matroska files either, but it surely happens in ASF files
(possibly /probably generated by lousy screencast software...):

https://forum.doom9.org/showthread.p...79#post1513679

Last edited by filler56789; 12th May 2019 at 05:33. Reason: grammar :-/
filler56789 is offline   Reply With Quote
Old 12th May 2019, 08:59   #378  |  Link
nevcairiel
Registered Developer
 
Join Date: Mar 2010
Location: Hamburg/Germany
Posts: 10,341
Audio with gaps is generally just considered "broken", since it'll easily result in an audible glitch, or result in running out of sync with the video if the player assumes that audio should not have gaps.
__________________
LAV Filters - open source ffmpeg based media splitter and decoders
nevcairiel is online now   Reply With Quote
Old 16th May 2019, 15:07   #379  |  Link
Mosu
MKVToolNix author
 
Mosu's Avatar
 
Join Date: Sep 2002
Location: Braunschweig, Germany
Posts: 4,278
Quote:
Originally Posted by chros View Post
@Mosu, is there any plan for this? I'm just interested, thanks!
At the moment I don't have concrete plans for working on Dolby Vision. I acknowledge that HDR technologies are important, and I will most likely spend time on those topics in the future, just not soon.
__________________
Latest MKVToolNix is v83.0

If I ever ask you to upload something, please use my file server.
Mosu is offline   Reply With Quote
Old 16th May 2019, 15:09   #380  |  Link
Mosu
MKVToolNix author
 
Mosu's Avatar
 
Join Date: Sep 2002
Location: Braunschweig, Germany
Posts: 4,278
Quote:
Originally Posted by kuchikirukia View Post
I've uploaded a PAL DVD .VOB to your FTP that exhibits some weird behavior.
I don't support MPEG-2 video & VOBs anymore. I would accept patches fixing problems, but I won't spend time on them myself.
__________________
Latest MKVToolNix is v83.0

If I ever ask you to upload something, please use my file server.
Mosu is offline   Reply With Quote
Reply

Tags
matroska

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:48.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.