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 6th March 2022, 18:15   #1481  |  Link
Liisachan
李姗倩 Lǐ Shān Qin
 
Liisachan's Avatar
 
Join Date: Nov 2002
Posts: 1,340
A Matroska file does not work that way, not directly supporting any fixed frame rate at all. Instead, each frame has its timestamp (by default, the unit is 0.001 second = 1 millisecond aka 1 ms). A typical example is:

Frame 0 = time 0
Frame 1 = time 42 (fps between Frame 0 and 1 is 1000/42 = 23.809...)
Frame 2 = time 83 (fps between Frame 1 and 2 is 1000/41 = 24.390...)
Frame 3 = time 125 (fps between Frame 2 and 2 is 1000/42 = 23.809...) and so on.

There is also a per-track metadata called DefaultDuration, which might be 41708333 ns (41.708333 ms; ~23.976024168 fps), when an info tool can guess the source video is NTSC (24000/1001 fps) and may show an approximate value of it (e.g. 24 fps, 23.9760 fps, etc.); but it is only the default value. Since each frame has its own timestamp explicitly, this default value is basically irrelevant and unnecessary and generally not used, except maybe when calculating the end time of the very last frame.

This system may look confusing and (in specific cases) indeed it can be inconvenient, yet it is much more flexible this way, since one can use a variable frame rate (VFR) easily. That is how Matroska works. It is a feature - a design decision.

See also: https://matroska.org/technical/notes...scale-rounding

@hubblec4
There are some tools that do write ebml CRCs (and there is a tool that can verify it), but like Mosu said, mkvmerge doesn't do that. To make sure the file is not corrupted after years, one can record the hash value of the file. An "insecure" hash like MD5 is enough for this purpose. If you're worried that an accidental writing error might occur when muxing, then you can simply mux twice with --deterministic and check the 2 files are bit-identical
Liisachan is offline   Reply With Quote
Old 7th March 2022, 07:13   #1482  |  Link
oniiz86
Registered User
 
Join Date: Oct 2019
Posts: 58
Quote:
Originally Posted by Liisachan View Post
A Matroska file does not work that way, not directly supporting any fixed frame rate at all. Instead, each frame has its timestamp (by default, the unit is 0.001 second = 1 millisecond aka 1 ms). A typical example is:

Frame 0 = time 0
Frame 1 = time 42 (fps between Frame 0 and 1 is 1000/42 = 23.809...)
Frame 2 = time 83 (fps between Frame 1 and 2 is 1000/41 = 24.390...)
Frame 3 = time 125 (fps between Frame 2 and 2 is 1000/42 = 23.809...) and so on.

There is also a per-track metadata called DefaultDuration, which might be 41708333 ns (41.708333 ms; ~23.976024168 fps), when an info tool can guess the source video is NTSC (24000/1001 fps) and may show an approximate value of it (e.g. 24 fps, 23.9760 fps, etc.); but it is only the default value. Since each frame has its own timestamp explicitly, this default value is basically irrelevant and unnecessary and generally not used, except maybe when calculating the end time of the very last frame.

This system may look confusing and (in specific cases) indeed it can be inconvenient, yet it is much more flexible this way, since one can use a variable frame rate (VFR) easily. That is how Matroska works. It is a feature - a design decision.

See also: https://matroska.org/technical/notes...scale-rounding
@Liisachan Thanks for that, I noticed the DefaultDuration in the Header Editor section & it states 41708333 for 24000/1001 & I heard 41708375 is 23976/1000 but even files with 23976/1000 still have the DefaultDuration listed as 41708333 so not sure why the Header Editor does not reflect the small 42 ns difference, perhaps you may know why MKVToolNix's libebml + libmatroska is causing intermittent motion jerkiness where @ProWo's clever ffmpeg-gui program does not on my OPPO BDP-105D player, only TrueHD & E-AC3 JOC streams seem to be affected?
oniiz86 is offline   Reply With Quote
Old 8th March 2022, 17:59   #1483  |  Link
shae
Registered User
 
Join Date: Jun 2006
Posts: 397
Any idea what might make the GUI reject some or most Bluray MPLS files, even though they dump fine with bluray_dump and are also accepted by the Chapter Editor?

The rejected MPLS don't show up when opening the Bluray root (the window that shows the available playlists), nor are they accepted when dropped into the Multiplexer tab, where the GUI says (* = filename dropped):
Code:
The file '*.mpls' was not recognized as a supported format (exit code: 0).

Last edited by shae; 8th March 2022 at 18:07.
shae is offline   Reply With Quote
Old 9th March 2022, 02:56   #1484  |  Link
Liisachan
李姗倩 Lǐ Shān Qin
 
Liisachan's Avatar
 
Join Date: Nov 2002
Posts: 1,340
Quote:
Originally Posted by oniiz86 View Post
@Liisachan Thanks for that, I noticed the DefaultDuration in the Header Editor section & it states 41708333 for 24000/1001 & I heard 41708375 is 23976/1000 but even files with 23976/1000 still have the DefaultDuration listed as 41708333 so not sure why the Header Editor does not reflect the small 42 ns difference
Do you know the exact command line you're using via your GUI? If it has
--default-duration 0:24000/1001p
then, mkvmerge may set 41708333. While I have no idea why you're having problems with mkvmerge, by comparing the 2 command lines (one that works for you, and the other one that doesn't work well), perhaps you can guess what causes the difference for your specific player. This may be a player-side issue - MKV file written by mkvmerge is most probably well-formed.

(Mkvmerge is not as good at rounding as other muxers, but usually this does not cause any practical problems at all, since the frame timing written by mkvmerge is only off by less than 1 ms, and the frame timing is still off by up to 0.5 ms anyway even if rounding is done normally. If one insists 1 or 0.5 ms errors are too big, one can just use a smaller TimestampScale - mkvmerge can do that too.)

A few things you can try:
1) If you believe that DefaultDuration is problematic for your player, you can set that value as you like, this way:
mkvpropedit "your.mkv" --edit track:v1 --set default-duration=41708375

2) It is possible that ffmpeg automatically "corrects" the audio delay by shifting (delaying) video frame timestamps. To see this, try:
mkvextract "your.mkv" timestamps_v2 0:timestamps.txt

In timestamps.txt, you can see actual time stamps for each frame. If the first frame is not 0, some kind of issues might occur.

Like I said, DefaultDuration should be irrelevant (because each frame has its own timestamp), but some players might depend on this irrelevant number... I don't know. If you create an MKV file with --timestamps, where the first & second frames are 0 and 42 respectively, then
DefaultDuration 42000000 ns (42 ms; ~23.809523810 fps)
may be written, even if the video is essentially 24000/1001 fps, and this is not a problem - such an MKV file plays fine for me. Thus:

3) You can try other players, to see if the problem is in your MKV file itself, or it's your specific player...
Liisachan is offline   Reply With Quote
Old 10th March 2022, 15:11   #1485  |  Link
shae
Registered User
 
Join Date: Jun 2006
Posts: 397
Is there a way to add custom commandline options in the GUI?

Looking to enable "deterministic".
shae is offline   Reply With Quote
Old 10th March 2022, 19:55   #1486  |  Link
derf
Registered User
 
derf's Avatar
 
Join Date: Apr 2005
Location: Montral, Qubec, Canada
Posts: 11
Quote:
Originally Posted by Liisachan View Post
Perhaps the following is unrelated to your issue, but apparently similar problems are also happening due to LAV Filter-side issues. So, if someone has a problem where MPC-HC doesn't show all the audio tracks, various possibilities should be considered. The issue reported at https://forum.doom9.org/showthread.p...74#post1963574 on 2022-02-09 is:

and clsid's comment is:


So, according to clsid, sometimes this kind of issue is not (directly) related to MKVToolNix nor to MPC-HC itself. I figured maybe I should share this info.
It is the most likely scenario as, like I mentioned, the audio tracks are detected correctly with VLC and Plex.

Also, thanks for the link, I was stuck at MPC-HC 1.7.13 because there were no updates and the website said that development had ceased. Now I can update to 1.9.19!
derf is offline   Reply With Quote
Old 11th March 2022, 09:31   #1487  |  Link
Liisachan
李姗倩 Lǐ Shān Qin
 
Liisachan's Avatar
 
Join Date: Nov 2002
Posts: 1,340
@shae
You can go to the "Output" tab, and click the small button by the "Additional options" editbox.

@derf
MPC-BE is also being actively developed.
https://forum.doom9.org/showthread.php?t=165890
Liisachan is offline   Reply With Quote
Old 12th March 2022, 19:30   #1488  |  Link
shae
Registered User
 
Join Date: Jun 2006
Posts: 397
Quote:
Originally Posted by Liisachan View Post
"Output" tab, and click the small button by the "Additional options" editbox.
Thanks.
shae is offline   Reply With Quote
Old 13th March 2022, 15:48   #1489  |  Link
Mosu
MKVToolNix author
 
Mosu's Avatar
 
Join Date: Sep 2002
Location: Braunschweig, Germany
Posts: 4,292
MKVToolNix v66.0.0 released

Heyo!

just keeping up with my usual release cadence & releasing MKVToolNix v66, a rather small release.

Here are the usual links: the MKVToolNix home page, the Windows installer/portable version & macOS DMG & Linux AppImage and the source code.

The Windows and macOS binaries as well as the Linux AppImage are available already. The other Linux binaries are still being built and will be available over the course of the next couple of hours.

Here are the NEWS since the previous release:

Version 66.0.0 "Josie" 2022-03-13
New features and enhancements
  • mkvpropedit: added a new option "--chapter-charset" allowing the user to specify the character set to use when reading the following chapter file. Implements #3276.
  • MKVToolNix GUI: each language shortcut can now be associated with an optional track name that is set along with the language when the shortcut is used. This is an alternative to the feature requested in #3283.

Bug fixes
  • mkvmerge: Ogg/OGM reader: mkvmerge will no longer abort with an exception when it encounters Vorbis comments that contain data that isn't valid UTF-8. Fixes #3290.
  • MKVToolNix GUI: multiplexer: fixed several issues with the tab order of elements in the "properties" pane and the "output" tab. Also fixed the language display widgets (e.g. "track language" in the "properties" pane) never receiving tab focus. Fixes #3274.
  • MKVToolNix GUI: multiplexer: the chapter name template will now be passed to "mkvmerge" if a chapter file is selected on the "output" tab. Fixes #3295.

Have fun 😁
__________________
Latest MKVToolNix is v86.0

If I ever ask you to upload something, please use my file server.
Mosu is offline   Reply With Quote
Old 14th March 2022, 00:04   #1490  |  Link
VBB
Registered User
 
VBB's Avatar
 
Join Date: May 2016
Location: Long Beach, CA, USA
Posts: 620
Thanks!
__________________
Henry | LG OLED65C7P | Denon AVR-X3500H | ELAC Uni-Fi x7 | ELAC Debut 2.0 SUB3030 x2 | NVIDIA SHIELD TV Pro 2019 | Plex
VBB is offline   Reply With Quote
Old 14th March 2022, 19:06   #1491  |  Link
Liisachan
李姗倩 Lǐ Shān Qin
 
Liisachan's Avatar
 
Join Date: Nov 2002
Posts: 1,340
Thanks, Mosu!

As for that rounding weirdness... the original problem my friends and I were trying to fix was, most probably, related to how ffmpeg works (perhaps "by design"), and your tools are NOT responsible for that one. While investigating, I happened to notice the rounding error in mkvmerge too, but that is not the main problem at all. Technically there may be indeed a problem in mkvmerge like you suggested yourself, rounding down 0.5416... being clearly weird, but this part is practically harmless when muxing video; so, please, don't worry about it too much

We've already found a way to avoid the main problem (perhaps related to ffmpeg), and the (harmless) rounding error in mkvmerge could be easily avoided if one would like to. I guess a subtle rounding error might be bad for audiophiles in HA who want 1/44100 sample accurateness, but it's not a real problem for doom9 users at all.

Sorry if I annoyed you & thanks again!
Liisachan is offline   Reply With Quote
Old 14th March 2022, 20:12   #1492  |  Link
Mosu
MKVToolNix author
 
Mosu's Avatar
 
Join Date: Sep 2002
Location: Braunschweig, Germany
Posts: 4,292
You never annoy me, Liisachan, and didn't with the recent venture into rounding issues either. Don't worry about it.
__________________
Latest MKVToolNix is v86.0

If I ever ask you to upload something, please use my file server.
Mosu is offline   Reply With Quote
Old 15th March 2022, 21:05   #1493  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,365
I don't know if this is a limitation, but I tried to set a custom aspect ratio to a H.261 stream but the player (MPC-HC + LAV 0.76 + madVR) didn't recognize it.
I read that H.261 streams don't accept DAR flags but I thought this was done at container level? I'm using v66.0
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 17th March 2022, 14:28   #1494  |  Link
shae
Registered User
 
Join Date: Jun 2006
Posts: 397
Is there a way to remap PTSes so that frame 0 is at 0:00.00?
shae is offline   Reply With Quote
Old 18th March 2022, 16:08   #1495  |  Link
Liisachan
李姗倩 Lǐ Shān Qin
 
Liisachan's Avatar
 
Join Date: Nov 2002
Posts: 1,340
One can always set (redefine) the timestamp of each frame explicitly:
https://mkvtoolnix.download/doc/mkvm...imestamp_files
Matroska is really flexible here.
Liisachan is offline   Reply With Quote
Old 18th March 2022, 23:07   #1496  |  Link
shae
Registered User
 
Join Date: Jun 2006
Posts: 397
It's plain CFR, so I'm not looking to provide PTS files, but just set the times plainly, where frame 0 is at time 0.
The framerate could either be as set in the source container, or commandline.

Last edited by shae; 18th March 2022 at 23:11.
shae is offline   Reply With Quote
Old 19th March 2022, 03:08   #1497  |  Link
Liisachan
李姗倩 Lǐ Shān Qin
 
Liisachan's Avatar
 
Join Date: Nov 2002
Posts: 1,340
@shae
MKV is so flexible that it's sometimes counter-intuitive and confusing: you may find it strange that MKV doesn't support "plain old CFR" in general.

@Mosu
1/ My friend is confused, and is complaining about this behavior: Even if "Use legacy MIME types for font attachments" is checked in GUI, it transmuxes the font files attached in existing MKV (without updating MIME types) to a newly written MKV, even without any warning.

2/ When transmuxing MKV to MKV: let's say "foo.ttf" is attached to source MKV - then if one tries to manually add "foo.ttf" (redundantly, so to speak, hoping "overriding" the existing attachment), GUI silently fails to add "foo.ttf" without any error/warning messages. This further confuses an inexperienced GUI user, as to how they can update the font mime type.
Liisachan is offline   Reply With Quote
Old 19th March 2022, 08:54   #1498  |  Link
Mosu
MKVToolNix author
 
Mosu's Avatar
 
Join Date: Sep 2002
Location: Braunschweig, Germany
Posts: 4,292
Quote:
Originally Posted by Liisachan View Post
@Mosu
1/ My friend is confused, and is complaining about this behavior: Even if "Use legacy MIME types for font attachments" is checked in GUI, it transmuxes the font files attached in existing MKV (without updating MIME types) to a newly written MKV, even without any warning.
That setting is a GUI-only setting that solely affects how MIME type auto-detection is done (= what the MIME type drop down will be set to when you add a new attachment to your multiplexer job). It has no affect on existing attachments as their MIME type will be kept as-is. Additionally the mkvmerge CLI doesn't have a function for altering the MIME type of existing attachments yet either; so I cannot simply extend the function to existing ones without some serious work.

Quote:
Originally Posted by Liisachan View Post
2/ When transmuxing MKV to MKV: let's say "foo.ttf" is attached to source MKV - then if one tries to manually add "foo.ttf" (redundantly, so to speak, hoping "overriding" the existing attachment), GUI silently fails to add "foo.ttf" without any error/warning messages. This further confuses an inexperienced GUI user, as to how they can update the font mime type.
That might be a bug as a warning should be shown in that case if I remember correctly (but then again, it might not be as you can disable certain warnings in the preferences). I'll look into it.
__________________
Latest MKVToolNix is v86.0

If I ever ask you to upload something, please use my file server.
Mosu is offline   Reply With Quote
Old 19th March 2022, 09:55   #1499  |  Link
varekai
Registered User
 
varekai's Avatar
 
Join Date: Jul 2006
Posts: 534
@Mosu
This is very interesting! Not shure if doable but here goes:
How do I add a ClearSans.ttf to an existing mkv that will be used as subtitle when playing in a mediaplayer lik PotPlayer, MPC-HC or VLC?
I have tried but no subs show up in either player.

Really appreciate your dedicated work with MKVToolNix!

Thanks and best regards,
varekai
varekai is offline   Reply With Quote
Old 19th March 2022, 16:17   #1500  |  Link
Mosu
MKVToolNix author
 
Mosu's Avatar
 
Join Date: Sep 2002
Location: Braunschweig, Germany
Posts: 4,292
Matroska the container format doesn't have provisions for signalling a player to use a certain font (or any other type of attachment). If and how fonts are used is up to the subtitle format in question. The best (only?) supported format using fonts is probably SSA/ASS, which will have to refer to the attached font's name.
__________________
Latest MKVToolNix is v86.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 23:47.


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