View Full Version : MKVToolNix v99.0 released
videoh
15th September 2021, 21:18
Not necessarily. The application extracting from Matroska would be able to re-insert AUDs in such situations. mkvextract doesn't, at the moment. Well sure, but the current status is that if you use mkvextract then there can be a problem.
Also, if NVidia's decoder is able to insert AUDs as needed on the fly, any other program should be able to as well? It's not the decoder, it's my app that feeds the decoder that inserts extra AUDs. But you are correct, any other app could do that. I don't know if others are aware of this workaround.
Mosu
15th September 2021, 22:12
What I find interesting is that ffmpeg's libavcodec doesn't seem to do anything with AUDs during decoding, if I read libavcodec/hevcdec.c correctly (function "decode_nal_unit", no other relevant mentions of HEVC_NAL_AUD); same for AVC.
Anyway, I think I'll change mkv* to keep AUDs for all MPEG …VC types.
nevcairiel
15th September 2021, 22:21
What I find interesting is that ffmpeg's libavcodec doesn't seem to do anything with AUDs during decoding, if I read libavcodec/hevcdec.c correctly (function "decode_nal_unit", no other relevant mentions of HEVC_NAL_AUD); same for AVC.
AUDs contain no data, they are merely a marker to help raw formats or "simple" containers to indicate frame starts. A decoder doesn't need them if it properly reads every other NAL anyway.
videoh
16th September 2021, 03:07
A decoder doesn't need them if it properly reads every other NAL anyway. I showed a case where that is not true.
videoh
16th September 2021, 03:18
I think I'll change mkv* to keep AUDs IMHO that is a great decision. Containers should not destroy any elementary stream data.
nevcairiel
16th September 2021, 06:40
I showed a case where that is not true.
There was a classification in that sentence for a reason - "if it properly reads every other NAL", clearly this is not true for NVIDIAs parser. But the post was about libavcodec, and why it doesn't use them at all.
Mosu
16th September 2021, 08:21
AUDs contain no data, they are merely a marker to help raw formats or "simple" containers to indicate frame starts. A decoder doesn't need them if it properly reads every other NAL anyway.
That has been my understanding as well, thanks for confirming it. I was really taken aback by the tsMuxer Github issue von Suppé linked to where the tsMuxer dev said that it was MakeMKV's fault that tsMuxer couldn't convert the stream into MPEG TS properly because MakeMKV didn't insert AUDs. Well, if AUDs aren't required for decoding, Matroska has no requirements for them but MPEG TS does, then it's simply not the responsibility of _Matroska_ muxers to insert AUDs. If anything it's tsMuxer's.
nevcairiel
16th September 2021, 10:20
Indeed. Preserving them is fine and good, they are only like 2 bytes + length code or something per frame, but you might as well have a MP4 as a source (which tolerates them but doesn't mandate them), or another MKV that has no AUDs, so there will still be many streams from the past and in the future that don't have them. Any software that requires them should make sure they are there itself.
bruno321
20th September 2021, 15:40
Is there a way to set the Matrix coefficients in mkvtoolnix? E.g. I have an mp4 that has not specified what they are, I want to remux it and set them to BT.709. Can I do that with mkvtoolnix?
Mosu
20th September 2021, 16:24
Yes, you can. mkvmerge has a track-specific parameter called "--colour-matrix-coefficients" for that. In the GUI it isn't directly exposed as an input field, but you can use the "additional options" input instead. Select the video track, scroll the "Properties" pane all the way down & enter the following verbatim in "Additional options":
--colour-matrix-coefficients <TID>:1
The GUI will automatically replace the "<TID>" part with the track's actual ID.
The value 1 corresponds to ITU-R BT.709. See the Matroska specs (https://www.matroska.org/technical/elements.html) for all possible values.
An alternative is to use the header editor. You'll find the field here: Video track … → Colour information → Video: color matrix coefficients.
Liisachan
24th September 2021, 07:17
24000/1001 is an irrational number, and you simply cannot express it exactly without reverting to a rational such as 24000/1001.
nitpick (?): you are confusing readers, by calling a rational number "irrational". I think what you're trying to say is, 24000/1001 can't be expressed as a finite decimal (in base 10).
Mosu
24th September 2021, 08:15
Yes, that was what I was going for before confusing things in my head.
von Suppé
28th September 2021, 11:11
Hi Mosu,
When first importing subtitles, and after that importing video into mkvtoolnix, the default output is muxed as a *.mks file. Is this supposed to be?
Muxing as .mkv requires manual setting of the extension.
Liisachan
1st October 2021, 01:52
Thanks Mosu. Not sure if this is by design, but several language codes are not recognized as valid: e.g. hbo (Ancient Hebrew), tmr (Jewish Babylonian Aramaic).
@von Suppé
On Windows, at least for me...
1) if I select ASS first and manually select the Destination file without specifying an extension, then .mks is auto-selected and it will be stuck as you pointed out.
2) If I select ASS first and manually select the Destination file with extension .mkv, then .mkv wil be used after that.
However--
3) If I select ASS first and just select a video (MP4/264/MKV/AVI) without selecting the Destination file at all, then .mkv is auto-selected.
So it seems that the most intuitive way would be: First select every source file, then select the Destination file; and the extension will be fine.
von Suppé
2nd October 2021, 07:34
So it seems that the most intuitive way would be: First select every source file, then select the Destination file; and the extension will be fine.
Thanks, I understand.
SeeMoreDigital
3rd October 2021, 11:42
After 18 years of owning the Terminator 2 Extreme DVD, I've finally been able to extract and decrypt the second (DVD-ROM) discs 1440x816 WMV3 video stream (and 6 channel wma pro audio stream).
Currently both streams a muxed within the .wmv container, but when I tried to re-mux the .wmv file into the .mkv container, MKVToolNix reported ".... is an unsupported container format (Windows Media (ASF/WMV))".
I suspect some trickery is required to mux such video streams into the .mkv container but is it possible or am I wasting my time (and everybody else's)?
I've already re-encoded the 6 channel wma pro audio to 6 channel Dolby Digital...
Cheers
Mosu
3rd October 2021, 15:06
When first importing subtitles, and after that importing video into mkvtoolnix, the default output is muxed as a *.mks file. Is this supposed to be?
As soon as you manually modify/specify a destination file name, the GUI will no longer mess with it. All automatisms such as adjusting the extension or trying to make it unique are suspended at that point. Definitely intentional.
Mosu
3rd October 2021, 15:59
Thanks Mosu. Not sure if this is by design, but several language codes are not recognized as valid: e.g. hbo (Ancient Hebrew), tmr (Jewish Babylonian Aramaic).
At the moment: intentional; I only keep types "Constructed", "Living" & "Special" from 639-3 right now. The two you've mentioned are "Historical" & "Extinct".
Mosu
3rd October 2021, 16:00
So it seems that the most intuitive way would be: First select every source file, then select the Destination file; and the extension will be fine.
Either that, or start with the source file containing video (as having a video track present & selected will always force .mkv as the extension) before setting the destination file name.
lvqcl
3rd October 2021, 17:38
I suspect some trickery is required to mux such video streams into the .mkv container but is it possible or am I wasting my time (and everybody else's)?
Use ffmpeg.
Liisachan
4th October 2021, 23:13
In theory, if the user just inputs the output "file name stem" without an extension, it's still the muxer's job to decide the extension of the output file, before writing it.
However, it's rather unnatural that the user first specifies the subtitle (or audio) source file, then selects the output file name, then selects the video source file. They may happen to do that in some situations, but normally, people decide the output file name after they select all the input files, not in the middle of selecting input files...
At the moment: intentional; I only keep types "Constructed", "Living" & "Special" from 639-3 right now. The two you've mentioned are "Historical" & "Extinct". So it's based on the 639-3 tables, nothing personal... This too is practically not a big problem at all, but things seem quite random, and potentially touchy, upsetting Semitic peoples; e.g.
- Samaritan Hebrew is still used religiously, but "smp" is refused.
- "Used only religiously" is not good enough? That's why Biblical Hebrew (hbo) is also refused? But Classical Syriac (syc), the Christian language of Peshitta, is accepted. On the other hand Jewish counterparts (tmr & jpa) are refused.
- Imperial Aramaic is a long-dead language, but "arc" is accepted too, not to mention lat & arc.
While you're not responsible for these tables, they may be a bit biased. For the record, 639-3 is maintained by SIL, a Christian organization, which may not be ideal to handle the International standards neutrally. (Not like there's anything we could do about that, though.)
Sakura-chan
5th October 2021, 03:30
Using a Sample (https://drive.google.com/open?id=17GvV7mOGPaLMaOmJuyZv7AfhRsdrBM-D) which has 6.1 DTS-HD audio
mediainfo.exe c:\Users\Selur\Desktop\Sample_7Ch-001.mkv
General
Unique ID : 305643535159227373137804081320895496115 (0xE5F0CDBD216A8CAF2B4160690D24BFB3)
Complete name : c:\Users\Selur\Desktop\Sample_7Ch-001.mkv
Format : Matroska
Format version : Version 4
File size : 102 MiB
Duration : 1 min 2 s
Overall bit rate mode : Variable
Overall bit rate : 13.7 Mb/s
Encoded date : UTC 2019-12-28 21:56:35
Writing application : mkvmerge v41.0.0.27 ('Smarra') 64-bit
Writing library : libebml v1.3.10 + libmatroska v1.5.2
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings : CABAC / 2 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 2 frames
Format settings, GOP : M=1, N=10
Codec ID : V_MPEG4/ISO/AVC
Duration : 1 min 2 s
Bit rate mode : Variable
Bit rate : 9 771 kb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.197
Stream size : 72.5 MiB (71%)
Default : Yes
Forced : No
Audio
ID : 2
Format : DTS ES XXCH XLL
Format/Info : Digital Theater Systems
Commercial name : DTS-HD Master Audio
Codec ID : A_DTS
Duration : 1 min 2 s
Bit rate mode : Variable
Bit rate : 3 917 kb/s
Channel(s) : 7 channels
Channel layout : C L R Ls Rs LFE Cb
Sampling rate : 48.0 kHz
Frame rate : 93.750 FPS (512 SPF)
Bit depth : 24 bits
Compression mode : Lossless
Stream size : 29.1 MiB (29%)
Language : English
Default : Yes
Forced : No
I use:
ffmpeg -y -threads 8 -i "C:\Users\Selur\Desktop\Sample_7Ch-001.mkv" -map 0:1 -vn -sn -bsf:a dca_core -acodec copy -map_metadata -1 "E:\Temp\iId_1_aid_0_lang_en_09_28_20_8410_01.dts"
to extract the dts core and get:
mediainfo.exe "e:\Temp\iId_1_aid_0_lang_en_09_28_20_8410_01.dts"
General
Complete name : e:\Temp\iId_1_aid_0_lang_en_09_28_20_8410_01.dts
Format : DTS ES XXCH
Format/Info : Digital Theater Systems
Commercial name : DTS-ES Discrete
File size : 11.2 MiB
Duration : 1 min 2 s
Overall bit rate mode : Constant
Overall bit rate : 1 509 kb/s
Audio
Format : DTS ES XXCH
Format/Info : Digital Theater Systems
Commercial name : DTS-ES Discrete
Duration : 1 min 2 s
Bit rate mode : Constant
Bit rate : 1 509 kb/s
Channel(s) : 7 channels
Channel layout : C L R Ls Rs Cb LFE
Sampling rate : 48.0 kHz
Frame rate : 93.750 FPS (512 SPF)
Bit depth : 24 bits
Compression mode : Lossy
Stream size : 11.2 MiB
so far so good. Notice the core is DTS-ES with 6.1 audio.
Muxing the audio using mkvmerge using:
mkvmerge --ui-language en -o "E:\Output\Sample_7Ch-001.mkv" --global-tags "E:\Temp\Sample_7Ch-001_09_28_20_8410__02.xml" --language 0:en --default-track 0:yes --forced-track 0:no -a 0 --compression -1:none --no-video --no-subtitles --no-chapters "E:\Temp\iId_1_aid_0_lang_en_09_28_20_8410_01.dts"
I get:
mediainfo.exe "e:\Output\Sample_7Ch-001.mkv"
General
Unique ID : 297622948022399407897597109173123386592 (0xDFE81843105E42451110FB9E70E98CE0)
Complete name : e:\Output\Sample_7Ch-001.mkv
Format : Matroska
Format version : Version 4
File size : 11.2 MiB
Duration : 1 min 2 s
Overall bit rate mode : Constant
Overall bit rate : 1 511 kb/s
Encoded date : UTC 2019-12-29 08:28:49
Writing application : mkvmerge v41.0.0 ('Smarra') 64-bit
Writing library : libebml v1.3.9 + libmatroska v1.5.2
Encoding Gui : Hybrid 2019.12.28.1
Audio
ID : 1
Format : DTS ES XXCH
Format/Info : Digital Theater Systems
Commercial name : DTS-ES Discrete
Codec ID : A_DTS
Duration : 1 min 2 s
Bit rate mode : Constant
Bit rate : 1 509 kb/s
Channel(s) : 6 channels
Channel(s)_Original : 7 channels
ChannelLayout_Original : C L R Ls Rs Cs LFE
Sampling rate : 48.0 kHz
Frame rate : 93.750 FPS (512 SPF)
Bit depth : 24 bits
Compression mode : Lossy
Stream size : 11.2 MiB (100%)
Language : English
Default : Yes
Forced : No
-> Seems like mkvmerge flags the stream as 6 channel audio.
=> is this a bug or did I miss something?
---
Update:
using ffmpeg for muxing:
ffmpeg -y -r 0 -i "E:\Temp\iId_1_aid_0_lang_en_09_28_20_8410_01.dts" -acodec copy -metadata encoding_tool="Hybrid 2019.12.28.1" -r 0 "E:\Output\Sample_7Ch-001_new.mkv"
everything looks fine:
ediainfo.exe e:\Output\Sample_7Ch-001_new.mkv
General
Unique ID : 214078310457880531657066923291995838582 (0xA10DFB9C6A72D9428FC442879C209876)
Complete name : e:\Output\Sample_7Ch-001_new.mkv
Format : Matroska
Format version : Version 4
File size : 11.3 MiB
Duration : 1 min 2 s
Overall bit rate mode : Constant
Overall bit rate : 1 515 kb/s
Writing application : Hybrid 2019.12.28.1
Writing library : Lavf58.35.100
ErrorDetectionType : Per level 1
Audio
ID : 1
Format : DTS ES XXCH
Format/Info : Digital Theater Systems
Commercial name : DTS-ES Discrete
Codec ID : A_DTS
Duration : 1 min 2 s
Bit rate mode : Constant
Bit rate : 1 509 kb/s
Channel(s) : 7 channels
Channel layout : C L R Ls Rs Cb LFE
Sampling rate : 48.0 kHz
Frame rate : 93.750 FPS (512 SPF)
Bit depth : 24 bits
Compression mode : Lossy
Stream size : 11.2 MiB (100%)
Default : Yes
Forced : No
-> so this is probably a bug / missing feature in mkvmerge.
Cu Selur
Just noticed the same. This seem to happen only with DTS-ES streams, which is very rarely used on BDs so it's understandable why no one cares. Only two discs out of thousands I have I found that have DTS-ES, the Master Audio variant.
Audio
ID : 2
Format : DTS ES XLL
Format/Info : Digital Theater Systems
Commercial name : DTS-HD Master Audio
Codec ID : A_DTS
Duration : 1 h 48 min
Bit rate mode : Variable
Bit rate : 3 966 kb/s
Channel(s) : 6 channels
Channel(s)_Original : 7 channels
ChannelLayout_Original : C L R Ls Rs LFE Cs
Sampling rate : 48.0 kHz
Frame rate : 93.750 FPS (512 SPF)
Bit depth : 24 bits
Compression mode : Lossless
Stream size : 3.01 GiB (14%)
Language : English
Default : Yes
Forced : No
https://en.wikipedia.org/wiki/DTS_(sound_system)#DTS-ES
Idk why a centre back channel is so important to actually go and invent all that crap, just settle on 5.1 or go the extra mile to 7.1. Anyway, given that the extra channel is "matrixed" in the two rear channels I understand the actual audio, the "real" channels, are just 6, the 5.1 that mkvmerge labels. mkvmerge should label the audio as 7 channels like ffmpeg does. Or maybe not, given the 7th channel does not matter in terms of the container, as it's not a "real" channel. The 7th channel is "made up" by an ES-aware decoder.
Btw, makemkv produces the same result as mkvmerge.
With DTS-X something similar happens.
Audio
ID : 2
Format : DTS XLL X
Format/Info : Digital Theater Systems
Commercial name : DTS-HD Master Audio
Codec ID : A_DTS
Duration : 2 h 10 min
Bit rate mode : Variable
Bit rate : 6 228 kb/s
Channel(s) : 8 channels
Channel(s)_Original : Object Based
ChannelLayout_Original : Object Based
Sampling rate : 48.0 kHz
Frame rate : 93.750 FPS (512 SPF)
Bit depth : 24 bits
Stream size : 5.66 GiB (16%)
Language : English
Default : Yes
Forced : No
Channels is labelled as 8. I understand DTS-X has an MA 7.1 stream as base, so that's where channels come from. Even when the actual X stream is object based (so the "original" labels).
Btw, I can't search for anything in GitLab and all the issues are blank. Weird. We'll have to look into it.
Mosu
10th October 2021, 12:06
Hey y’all,
not a lot’s been happening over the last couple of weeks wrt. to coding for me, but I thought I’d publish the bug fixes I’ve amassed since the last release. So here you go, a fresh v62.
For package maintainers there was a small change. See the NEWS below.
Here are the usual links: the MKVToolNix home page (https://mkvtoolnix.download/), the Windows installer/portable version & macOS DMG & Linux AppImage (https://www.fosshub.com/MKVToolNix.html) and the source code (https://mkvtoolnix.download/source.html).
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 (https://mkvtoolnix.download/doc/NEWS.md) since the previous release:
Version 62.0.0 "Apollo" 2021-10-10
New features and enhancements
all: IETF BCP 47/TFC 5646 language tags: all ISO 639 languages are now available, even the ones that aren't of types "Constructed", "Living" or "Special".
mkvmerge, mkvpropedit: chapters: both programs will now write elements set to their default value, too (e.g. the legacy language element if it's set to "eng"). This is done to be more consistent with how MKVToolNix GUI writes chapters. Implements #3210 (https://gitlab.com/mbunkus/mkvtoolnix/issues/3210).
MKVToolNix GUI: multiplexer: when adding new files as attachments the GUI checks if there are other attachments with the same name. If so, the GUI would ask whether to skip the affected files or add them anyway. There's now an option in the preferences to always skip such files, and it's enabled by default. Implements #3213 (https://gitlab.com/mbunkus/mkvtoolnix/issues/3213).
MKVToolNix GUI: chapter editor: removed the support for explicitly setting the legacy country elements. Instead the legacy country elements are derived from the region parts of the IETF BCP 47 languages. Part of the implementation of #3193 (https://gitlab.com/mbunkus/mkvtoolnix/issues/3193).
Bug fixes
mkvmerge: fixed a crash when splitting by chapters is enabled but there are no chapters at all. Part of the fix of #3198 (https://gitlab.com/mbunkus/mkvtoolnix/issues/3198).
mkvmerge: the error message when trying to split by a chapter number that doesn't exist contained the wrong number of chapters that actually do exist. Part of the fix of #3198 (https://gitlab.com/mbunkus/mkvtoolnix/issues/3198).
mkvmerge: AVC ES parser: fixed mkvmerge aborting due to uncaught exception when encountering bad SPS data. Part of the fix of #3176 (https://gitlab.com/mbunkus/mkvtoolnix/issues/3176).
mkvmerge: AVC/H.264 parser: re-added the hack "--engage all_i_slices_are_key_frames" which was accidentally removed in release v61.
mkvmerge: AVI reader: fixed a crash trying to allocate too big of a memory chunk due to an integer overflows in check conditions. Part of the fix of #3176 (https://gitlab.com/mbunkus/mkvtoolnix/issues/3176).
mkvmerge: HEVC ES parser: fixed another issue with frame type recognition. Certain frames were marked as B frames/discardable on the container level even though they could be reference pictures. Now only SLNR pictures (sub-layer non-reference) are marked that way. Fixes #3192 (https://gitlab.com/mbunkus/mkvtoolnix/issues/3192).
mkvmerge: HEVC ES reader: improved file content detection for HEVC ES files with wrong file name extensions (e.g. ".mkv"), which fixes them being mis-detected as something else, e.g. DTS. Fixes #3201 (https://gitlab.com/mbunkus/mkvtoolnix/issues/3201).
mkvmerge: HEVC ES parser: "end of sequence" NALUs are kept now, and no superfluous flushing will be done when one is found. This prevents splitting NALUs into two different Matroska blocks when they should really be part of a single one, also causing problems with erroneous timestamps. Mostly affects DoVi NALUs. Fixes #3202 (https://gitlab.com/mbunkus/mkvtoolnix/issues/3202).
mkvmerge: Matroska reader, TrueHD: mkvmerge will now probe much more TrueHD frames trying to find the first sync frame. This fixes track detection in situations when a TrueHD doesn't start with a sync frame, e.g. when the source file's the result of splitting between sync frames.
mkvmerge, MKVToolNix GUI's chapter editor: IETF BCP 47/RFC 5646 language tags: when reading chapters from MPLS playlist files, the "ChapLanguageIETF" element will now be set to the configured default chapter language, not just the legacy "ChapterLanguage" element. Part of the fix of #3193 (https://gitlab.com/mbunkus/mkvtoolnix/issues/3193).
mkvmerge, mkvpropedit, MKVToolNix GUI's chapter editor: IETF BCP 47 elements will now always be created before writing chapters unless IETF BCP 47 elements are disabled. Part of the fix of #3193 (https://gitlab.com/mbunkus/mkvtoolnix/issues/3193).
mkvmerge, mkvpropedit, MKVToolNix GUI's chapter editor: when a chapter display element contains legacy language & country elements but no IETF BCP 47 elements and IETF BCP 47 elements aren't disabled, the IETF BCP 47 elements created will contain the region from the legacy element. Part of the fix of #3193 (https://gitlab.com/mbunkus/mkvtoolnix/issues/3193).
mkvmerge, mkvpropedit, MKVToolNix GUI's chapter editor: Legacy country elements are now created when IETF BCP 47 elements are present & contain a region code allowed in legacy country elements. Part of the fix of #3193 (https://gitlab.com/mbunkus/mkvtoolnix/issues/3193).
Build system changes
The "tools" sub-directory is now always built. The corresponding "configure" option "--with-tools" has been removed. The "install" target still doesn't install them, though.
Have fun 😁
rco133
11th October 2021, 05:57
Hi.
Am I missing something, or how do I add Greek (ell) language.
In version 62 it seems to be totally gone. In version 60 there was Greek (grc, Ancient Greek) or something like that.
Maybe I am just missing something.
rco133
11th October 2021, 06:18
Hi.
Am I missing something, or how do I add Greek (ell) language.
In version 62 it seems to be totally gone. In version 60 there was Greek (grc, Ancient Greek) or something like that.
Maybe I am just missing something.
Never mind.
I was clearly missing something. I was just typing "Greek" in the language area, and expected it to find something. It didn't.
Now I tried to ebter "gre" in the free form input field, and it shows "Modern Greek". Sorry for the inconvenience.
Nejiro
13th October 2021, 11:33
Hello everyone, excuse me a question, if I have to merge two files and I have subtitles in the second track is there any way to do it? because being alone in the second file it cannot merge them with anything since in the first file the subtitles are not there ..... there is a way to merge the two files and put the subtitles only in the second track so that when I review the whole file the subtitles start with the right time, ie in the second track?
Thanks
Mosu
13th October 2021, 14:10
Depends on the subtitle format in question. For SRT-style subtitles (CodecID S_TEXT/UTF-8) and SSA/ASS (CodecID S_TEXT/SSA or …/ASS) it is possible by creating a temporary Matroska file consisting of the first file (the one without a subtitle track) and an empty text subtitle file. For SRT this is trivia; just create a text file, leave it empty and save it under "empty.srt". For SSA/ASS it gets a bit more complicated as SSA/ASS contains formatting blocks etc; the procedure is extracting the subtitles from the file you want to append, edit that extracted SSA/ASS file with a text editor & remove all lines starting with "Dialogue:". That way you'll have an SSA/ASS file with the same global header but without content.
MKVToolNix can then recognize empty SRT/SSA/ASS subtitle files & will create a subtitle track in the output file.
Step 2 is taking that temporary file & appending the file you wanted to append originally.
hubblec4
13th October 2021, 14:56
Depends on the subtitle format in question. For SRT-style subtitles (CodecID S_TEXT/UTF-8) and SSA/ASS (CodecID S_TEXT/SSA or …/ASS) it is possible by creating a temporary Matroska file consisting of the first file (the one without a subtitle track) and an empty text subtitle file. For SRT this is trivia; just create a text file, leave it empty and save it under "empty.srt". For SSA/ASS it gets a bit more complicated as SSA/ASS contains formatting blocks etc; the procedure is extracting the subtitles from the file you want to append, edit that extracted SSA/ASS file with a text editor & remove all lines starting with "Dialogue:". That way you'll have an SSA/ASS file with the same global header but without content.
MKVToolNix can then recognize empty SRT/SSA/ASS subtitle files & will create a subtitle track in the output file.
Step 2 is taking that temporary file & appending the file you wanted to append originally.
Yeah, and that works for all subtitle formats.
chapterEditor uses empty Blu-ray sups and VOB-subs(idx/sub) to help MTX to get a correct work flow.
tormento
14th October 2021, 08:43
I have a collection of old mkv videos that I would like to remux to latest matroska version.
I usually launch (on Windows)
for %%a in (*.mkv) do "D:\eseguibili\media\MKV Toolnix\mkvmerge.exe" -o "%%~na.mkv" "%%a"
but it doesn't keep the original date and time.
Is there a flag or can you suggest me a better batch to preserve date and time too?
Mosu
14th October 2021, 12:05
mkvmerge cannot preserve that field. If you need to preserve it, you'll have to retrieve it first with e.g. "mkvmerge -J source.mkv" and set it afterwards mit mkvpropedit.
kuchikirukia
14th October 2021, 13:55
Why do certain remuxes of interlaced 29.97 fps content come out showing up as 59.94, yet still manage to play properly as 29.97?
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High@L4.1
Format settings : CABAC / 2 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 2 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 5 min 24 s
Bit rate mode : Variable
Bit rate : 32.9 Mb/s
Width : 1 920 pixels
Height : 1 080 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 59.940 (60000/1001) FPS
Original frame rate : 29.970 (30000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Interlaced
Scan type, store method : Separated fields
Scan order : Top Field First
Bits/(Pixel*Frame) : 0.265
Stream size : 1.24 GiB (96%)
Default : Yes
Forced : No
tormento
14th October 2021, 14:03
mkvmerge cannot preserve that field. If you need to preserve it, you'll have to retrieve it first with e.g. "mkvmerge -J source.mkv" and set it afterwards mit mkvpropedit.
I meant file date and time, not mkv properties. :)
Mosu
14th October 2021, 14:17
I meant file date and time, not mkv properties. :)
Nearly same answer; mkvmerge cannot preserve that; you'll have to query that before muxing & set it afterwards. On Linux this is pretty trivial as you can get a file modification time with the "stat" command, and changing it works via the "touch". Don't know how to do that on Windows, though you might get this to work with projects such as mingw (or maybe the Windows Subsystem for Linux).
videoh
14th October 2021, 16:28
Why do certain remuxes of interlaced 29.97 fps content come out showing up as 59.94, yet still manage to play properly as 29.97? Could be down to the difference between container and elementary stream metadata.
kuchikirukia
14th October 2021, 23:32
Could be down to the difference between container and elementary stream metadata.
The thing is that MPC-HC usually respects the container's flag on playback. If you mux a typical video at some arbitrary frame rate, MPC-HC will play it back at the container frame rate. But it doesn't play these remuxes at 59.94 fps even though it's apparently being passed as such: madVR is reporting it as 59.94.
Bluray m2ts: 29.970 (says source filter)
mkv: 59.940 (says source filter)
Plays both at 29.970
Specifically muxing it as 60000/1001p still plays back at 29.970, showing 59.940,
Forcing the mux to 30000/1001p plays back at half speed while saying 29.970 (says source filter).
Using i instead of p doesn't seem to make any difference.
qyot27
15th October 2021, 02:12
Nearly same answer; mkvmerge cannot preserve that; you'll have to query that before muxing & set it afterwards. On Linux this is pretty trivial as you can get a file modification time with the "stat" command, and changing it works via the "touch". Don't know how to do that on Windows, though you might get this to work with projects such as mingw (or maybe the Windows Subsystem for Linux).
WinTouch exists, which can set arbitrary creation, modified, and access dates. It's on CodeProject (the download sign up wall didn't exist when I downloaded it all those years ago), not sure if anyone has migrated the code to another host.
Snowknight26
15th October 2021, 05:14
Or just use PowerShell.
$file1 = Get-ChildItem file1.ext
$file2 = Get-ChildItem file2.ext
$file1.LastWriteTime = $file2.LastWriteTime
Mosu
15th October 2021, 09:02
Or just use PowerShell.
That looks very nice & useful! Thanks 😁
tormento
16th October 2021, 11:56
Or just use PowerShell.
Being a complete noob or PowerShell, can I kindly ask you a small script to just remux all the mkv that if finds, preserving timestamps?
NanoBot
16th October 2021, 17:45
Hi,
I meant file date and time, not mkv properties. :)
to set the file date and time back to the original values under Windows you may find this freeware program interesting:
https://www.funduc.com/fstouch.htm
Snowknight26
16th October 2021, 21:20
Being a complete noob or PowerShell, can I kindly ask you a small script to just remux all the mkv that if finds, preserving timestamps?
I guess this should work. Hope your filenames don't have an quotes because I didn't feel like handling those.
Get-ChildItem C:\Source\Path\ -Filter *.mkv | % {
$inputObject = $_
$outputPath = "C:\Output\Path\$($_.BaseName)$($_.Extension)"
& 'C:\Program Files\MKVToolNix\mkvmerge.exe' -o "$outputPath" "$($_.FullName)"
Get-ChildItem $outputPath | % { $_.LastWriteTime = $inputObject.LastWriteTime }
}
oniiz86
17th October 2021, 21:10
Is there anyway to have the legacy language element for English "eng" enabled by default for audio & subtitles like it is for foreign languages?
Liisachan
18th October 2021, 04:53
@Mosu thanks for the new version!
Is there anyway to have the legacy language element for English "eng" enabled by default for audio & subtitles like it is for foreign languages?
No "Language" element for the track means, by the specs, the default language, i.e. equivalent to "eng". Do you want to explicitly write "Language"="eng" anyway? If so, try something like this after muxing:
mkvpropedit.exe "your.mkv" --edit track:s1 --set language=eng
oniiz86
18th October 2021, 05:12
No "Language" element for the track means, by the specs, the default language, i.e. equivalent to "eng". Do you want to explicitly write "Language"="eng" anyway? If so, try something like this after muxing:
mkvpropedit.exe "your.mkv" --edit track:s1 --set language=eng
Yes I want to explicitly set to "eng" when I open the program, I noticed on my OPPO players the language is missing for English because I realised the old language element is not active like it is for foreign languages which have both "legacy" & BCP 47 elements always active, like Swedish for example has "swe" & "sv" whereas English only has the BCP 47 element active "en", I'm very sorry I'm quite the noob when it comes to utilising command lines, where do I place it so it runs everytime when muxing?
Mosu
18th October 2021, 09:12
Yes I want to explicitly set to "eng" when I open the program, I noticed on my OPPO players the language is missing for English
Most likely because your player doesn't support the Matroska specs correctly with respect to default values. The default value for the legacy language element is "eng", and therefore if the element isn't present in the file, that default value must be used.
Bug in your player. Nothing you can do about it on the MKVToolNix side.
oniiz86
18th October 2021, 10:22
Most likely because your player doesn't support the Matroska specs correctly with respect to default values. The default value for the legacy language element is "eng", and therefore if the element isn't present in the file, that default value must be used.
Bug in your player. Nothing you can do about it on the MKVToolNix side.
I don't believe so, it may be a change you had implemented over the years as mkvmerge v2.5.3 had the legacy language element enabled by default & my OPPO players recognise it correctly but chapter navigation had become corrupted so I remuxed with the latest build v62.0.0 & everything was fine except for the legacy language element "eng" not being active & had to manually enable the legacy language element "eng" for it to be recognised again.
Here is what mkvinfo reports for the really old mkvmerge build v2.5.3, the legacy language element for English is present "eng" as you can see, the latest build v62.0.0 does not have it present by default anymore but the foreign languages still have their legacy language elements active, obviously the old OPPO players do not recognise the newer IETF BCP 47 language elements & rely on the legacy language elements.
https://i.imgur.com/rPtOOid.png
https://i.imgur.com/ZksKHlE.png
Mosu
18th October 2021, 10:31
The thing is that the library used by MKVToolNix is a bit… finicky wrt. default values. I can turn on writing elements which are set to default values, but that also writes a lot of other elements that players aren't used to seeing at all. In the past there have been many players that have flat-out refused to play files containing such elements.
Implementing this one workaround (writing legacy language element if set to "eng") for one player would risk running into much more severe problems on other players. For something that _is_ a bug in the Oppo player. So… no.
And this has nothing (or very little) to do with BCP 47 language elements. It's a basic bug wrt. handling the legacy language element if it isn't present. In the Oppo player.
oniiz86
18th October 2021, 11:22
Ok, I understand, I didn't realise it would be so finicky if "eng" would remain active like all foreign languages in the most latest builds, I suppose OPPO never picked up on this bug across their player generations, it's not a massive issue but it's quite the laborious task to adjust for it in the header editor for every file, is there a batch file command to initiate across several files that could work like @Liisachan suggested, mkvpropedit.exe "your.mkv" --edit track:s1 --set language=eng
Ian1182
18th October 2021, 19:19
A Windows bat file similar to this
@echo off
for %%m in ("*.mkv") do (
"%ProgramFiles%\MKVToolNix\mkvpropedit" "%%~nm".mkv --edit track:s1 --set language=eng
"%ProgramFiles%\MKVToolNix\mkvpropedit" "%%~nm".mkv --edit track:a1 --set language=eng
)
exit /b
should work.
That sets the first audio and subtitle track to English of any MKV files in folder.
oniiz86
18th October 2021, 19:31
A Windows bat file similar to this
@echo off
for %%m in ("*.mkv") do (
"%ProgramFiles%\MKVToolNix\mkvpropedit" "%%~nm".mkv --edit track:s1 --set language=eng
"%ProgramFiles%\MKVToolNix\mkvpropedit" "%%~nm".mkv --edit track:a1 --set language=eng
)
exit /b
should work.
That sets the first audio and subtitle track to English of any MKV files in folder.
Thanks for that, I'm sorry I'm quite the noob when it comes to this, not so familiar with command lines, where do I place them exactly & will this sort of be a set and forget type of instructions?
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.