This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

[BUG] MKV Advanced Video Signaling Options Have No Effect
#21
Afaik UT Video is restricted to a specific color matrix&co.
[Image: ut-video.png]
see: http://umezawa.dyndns.info/archive/utvid...me.en.html

-> tried to reprodue this, but couldn't:
General Count : 342 Count of stream of this kind : 1 Kind of stream : General Kind of stream : General Stream identifier : 0 Unique ID : 11308791212817286323005182813680364818 Unique ID : 11308791212817286323005182813680364818 (0x881FE745E9C7FE961BBC2CB7346ED12) Count of video streams : 1 Video_Format_List : YUV Video_Format_WithHint_List : YUV (Ut Video) Codecs Video : YUV Complete name : e:\Output\test.mkv Folder name : e:\Output File name extension : test.mkv File name : test File extension : mkv Format : Matroska Format : Matroska Format/Url : https://matroska.org/downloads/windows.html Format/Extensions usually used : mkv mk3d mka mks Commercial name : Matroska Format version : Version 4 File size : 36838649 File size : 35.1 MiB File size : 35 MiB File size : 35 MiB File size : 35.1 MiB File size : 35.13 MiB Duration : 17160 Duration : 17 s 160 ms Duration : 17 s 160 ms Duration : 17 s 160 ms Duration : 00:00:17.160 Duration : 00:00:17:04 Duration : 00:00:17.160 (00:00:17:04) Overall bit rate : 17174195 Overall bit rate : 17.2 Mb/s Frame rate : 25.000 Frame rate : 25.000 FPS Frame count : 429 Stream size : 22905 Stream size : 22.4 KiB (0%) Stream size : 22 KiB Stream size : 22 KiB Stream size : 22.4 KiB Stream size : 22.37 KiB Stream size : 22.4 KiB (0%) Proportion of this stream : 0.00062 IsStreamable : Yes Title : Encoding TestClip Movie name : Encoding TestClip Encoded date : UTC 2022-07-26 03:12:15 File creation date : UTC 2022-07-26 03:10:14.419 File creation date (local) : 2022-07-26 05:10:14.419 File last modification date : UTC 2022-07-26 03:12:15.525 File last modification date (local) : 2022-07-26 05:12:15.525 Writing application : mkvmerge v69.0.0 ('Day And Age') 64-bit Writing application : mkvmerge v69.0.0 ('Day And Age') 64-bit Writing library : libebml v1.4.2 + libmatroska v1.6.4 / Lavf59.28.100 Writing library : libebml v1.4.2 + libmatroska v1.6.4 / Lavf59.28.100 Copyright : CopyrightTest Comment : Kleiner Testclip den ich zum Testen verwende ARTIST : AutorTest DATE : Heute Encoding Gui : Hybrid 2022.07.24.1 GENRE : Documentary IKEY : Hitler IRTD : Unrated ISGN : Drama Language : Undefined PRODUCT : Movie SOFTWARE : VirtualDub build 29393/releaseNandub v1.0rc2 SUBJECT : downfall of Hitler Video Count : 381 Count of stream of this kind : 1 Kind of stream : Video Kind of stream : Video Stream identifier : 0 StreamOrder : 0 ID : 1 ID : 1 Unique ID : 11110809036619597518 Format : YUV Format : YUV Commercial name : YUV Codec ID : V_MS/VFW/FOURCC / ULY0 Codec ID/Info : Ut Video Lossless Codec Codec ID/Hint : Ut Video Codec ID/Url : http://umezawa.dyndns.info/archive/utvideo Duration : 17160.000000 Duration : 17 s 160 ms Duration : 17 s 160 ms Duration : 17 s 160 ms Duration : 00:00:17.160 Duration : 00:00:17:04 Duration : 00:00:17.160 (00:00:17:04) Bit rate : 17163517 Bit rate : 17.2 Mb/s Width : 640 Width : 640 pixels Height : 352 Height : 352 pixels Pixel aspect ratio : 1.000 Display aspect ratio : 1.818 Display aspect ratio : 16:9 Frame rate mode : CFR Frame rate mode : Constant Frame rate : 25.000 Frame rate : 25.000 FPS Frame count : 429 Color space : YUV / YUV Chroma subsampling : 4:2:0 Chroma subsampling : 4:2:0 Compression mode : Lossless Compression mode : Lossless Bits/(Pixel*Frame) : 3.047 Delay : 0 Delay : 00:00:00.000 Delay : 00:00:00:00 Delay : 00:00:00.000 (00:00:00:00) Delay, origin : Container Delay, origin : Container Stream size : 36815744 Stream size : 35.1 MiB (100%) Stream size : 35 MiB Stream size : 35 MiB Stream size : 35.1 MiB Stream size : 35.11 MiB Stream size : 35.1 MiB (100%) Proportion of this stream : 0.99938 Writing library : Lavc59.38.100 utvideo Writing library : Lavc59.38.100 utvideo Default : Yes Default : Yes Forced : Yes Forced : Yes colour_description_present : Yes colour_description_present_Source : Container Color range : Limited colour_range_Source : Container Color primaries : Generic film colour_primaries_Source : Container Transfer characteristics : BT.709 transfer_characteristics_Source : Container Matrix coefficients : BT.709 matrix_coefficients_Source : Container
Overwriting ULYOs color matrix&transfer from bt470bg to bt709 worked fine here.

-> share a debug output of it and I can look at it after work.

Cu Selur

Ps.: Also no need to send me a pm to look at a thread/post, I get notifications for everything, but I do need some sleep from time to time.
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#22
This is strange... I can confirm that ULYO and "advanced signaling" matrix+primaries+transfer bt.709 works fine.

MediaInfo:
Color primaries                          : BT.709
Transfer characteristics                : BT.709
Matrix coefficients                      : BT.709
ffprobe:
yuv420p(tv, bt470bg/bt709/bt709)

However, ULYO and "advanced signaling" matrix+primaries SMPTE 170M and transfer bt.709 does not work:

MediaInfo:
Color primaries                          : BT.601 NTSC
Transfer characteristics                : BT.709
Matrix coefficients                      : BT.601                   // <-- this should be "NTSC", otherwise it is BT.470BG
ffprobe:
yuv420p(tv, bt470bg/smpte170m/bt709)                 // <-- as noted above, matrix becomes PAL, but we want it to be NTSC like the primaries

Please try this scenario and let me know if you can repro. If not, I promise I will send debug logs immediately.

Thanks!
Reply
#23
did some testing:
ULYO + Matrix: BT470G Range: Bradcast Range Trasfer Matrix: SMTPE 170M Primaries: ITU-R BT-470G -> Color range : Limited Color primaries : BT.601 PAL Transfer characteristics : BT.601 Matrix coefficients : BT.470 System B/G ULYO + Matrix: BT470G Range: Bradcast Range Trasfer Matrix: SMTPE 170M Primaries: SMTPE 170M -> Color range : Limited Color primaries : BT.601 NTSC Transfer characteristics : BT.601 Matrix coefficients : BT.470 System B/G ULYO + Matrix: BT470G Range: Bradcast Range Trasfer Matrix: SMTPE 170M Primaries: SMTPE 240M -> Color range : Limited Color primaries : SMPTE 240M Transfer characteristics : BT.601 Matrix coefficients : BT.470 System B/G ULYO + Matrix: SMTPE 170M Range: Bradcast Range Trasfer Matrix: SMTPE 240M Primaries: SMTPE 240M -> Color range : Limited Color range : Limited Color primaries : SMPTE 240M Transfer characteristics : SMPTE 240M Matrix coefficients : BT.601 ULYO + Matrix: SMPTE 240M Range: Bradcast Range Trasfer Matrix: ITU-R BT.709 Primaries: SMTPE 240M -> Color range : Limited Color primaries : BT.601 NTSC Transfer characteristics : BT.709 Matrix coefficients : BT.470 System B/G ULYO + Matrix: BT709 Range: Bradcast Range Trasfer Matrix: ITU-R BT.709 Primaries: SMTPE 240M -> Color range : Limited Color primaries : BT.601 NTSC Transfer characteristics : BT.709 Matrix coefficients : BT.709 ULYO + Matrix: BT709 Range: Bradcast Range Trasfer Matrix: ITU-R BT.709 Primaries: ITU-R BT.709 -> Color range : Limited Color primaries : BT.709 Transfer characteristics : BT.709 Matrix coefficients : BT.709
it may be that I didn't get enough sleep, but I don't see what isn't working,...

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#24
ULYO +
Matrix: SMPTE 240M
Range: Bradcast Range
Trasfer Matrix: ITU-R BT.709
Primaries: SMTPE 240M
->
Color range                              : Limited
Color primaries                          : BT.601 NTSC
Transfer characteristics                : BT.709
Matrix coefficients                      : BT.470 System B/G

Primaries: SMTPE 240M != BT.601 NTSC (SMTPE 170M)
Transfer: BT.709 == BT.709
Matrix: SMTPE 240M != BT.470 System B/G

SMTPE 240M primaries are functionally equivalent to BT.601 NTSC (SMTPE 170M) primaries, but they are still different indexes in the H.273 coding (6 vs. 7).
Check https://www.itu.int/rec/T-REC-H.273/en page 5. MKV supports both (https://mkvtoolnix.download/doc/mkvmerge.html) so I don't see a reason it would get changed.

SMTPE 240M matrix and BT.470 System B/G matrix are completely different however, and this is the big problem.

SMTPE 240M matrix:
KR = 0.212; KB = 0.087

BT.470 System B/G matrix:
KR = 0.299; KB = 0.114

The same thing happens if you use SMTPE 170M as matrix (the BT.601 NTSC standard). It gets converted to BT.470 System B/G (the BT.601 PAL standard).

Source: https://www.itu.int/rec/T-REC-H.273/en

Also, may I recommend using ffprobe for this instead of MediaInfo since the former gives the actual codename of the color profile, versus the generic name of the latter (bt.601, bt.601 ntsc, bt.601 pal, etc.)
Reply
#25
My point is, that from what I see Hybrid does the flagging correctly or do you see a mistake in the mkvmerge command line and/or the resulting output?

Looking at https://mkvtoolnix.download/doc/mkvmerge.html:

Matrix:
--color-matrix-coefficients TID:n Sets the matrix coefficients of the video used to derive luma and chroma values from red, green and blue color primaries. The parameter n is an integer rangeing from 0 and 10. Valid values and their meaning are: 0: GBR, 1: BT709, 2: unspecified, 3: reserved, 4: FCC, 5: BT470BG, 6: SMPTE 170M, 7: SMPTE 240M, 8: YCOCG, 9: BT2020 non-constant luminance, 10: BT2020 constant luminance
values.clear(); values << QString("GBR"); values << QString("BT709"); values << QString("Unspecified"); values << QString("Reserved"); values << QString("FCC"); values << QString("BT470BG"); values << QString("SMPTE 170M"); values << QString("SMPTE 240M"); values << QString("YCGCO"); values << QString("BT2020 Non-constant Luminance"); values << QString("BT2020 Constant Luminance"); this->addListField(QString("mkvColorMatrix"), values.at(0), values, false);
(from Hybrid source code)

Transfer:
--color-transfer-characteristics TID:n The transfer characteristics of the video. Valid values and their meaning are: 0: reserved, 1: ITU-R BT.709, 2: unspecified, 3: reserved, 4: gamma 2.2 curve, 5: gamma 2.8 curve, 6: SMPTE 170M, 7: SMPTE 240M, 8: linear, 9: log, 10: log sqrt, 11: IEC 61966-2-4, 12: ITU-R BT.1361 extended color gamut, 13: IEC 61966-2-1, 14: ITU-R BT.2020 10 bit, 15: ITU-R BT.2020 12 bit, 16: SMPTE ST 2084, 17: SMPTE ST 428-1; 18: ARIB STD-B67 (HLG)
values.clear(); values << QString("Reserved"); values << QString("ITU-R BT.709"); values << QString("Unspecified"); values << QString("Reserved"); values << QString("Gamma 2.2 curve"); values << QString("Gamma 2.8 curve"); values << QString("SMPTE 170M"); values << QString("SMPTE 240M"); values << QString("Linear"); values << QString("Log"); values << QString("Log Sqrt"); values << QString("IEC 61966-2-4"); values << QString("ITU-R BT.1361 Extended Colour Gamut"); values << QString("IEC 61966-2-1"); values << QString("ITU-R BT.2020 10 bit"); values << QString("ITU-R BT.2020 12 bit"); values << QString("SMPTE ST 2084"); values << QString("SMPTE ST 428-1"); values << QString("ARIB STD-B67 (HLG)"); this->addListField(QString("mkvColorTransferCharacteristics"), values.at(0), values, false);
(from Hybrid source code)
Primaries:
--color-primaries TID:n Sets the color primaries of the video. Valid values and their meaning are: 0: reserved, 1: ITU-R BT.709, 2: unspecified, 3: reserved, 4: ITU-R BT.470M, 5: ITU-R BT.470BG, 6: SMPTE 170M, 7: SMPTE 240M, 8: FILM, 9: ITU-R BT.2020, 10: SMPTE ST 428-1, 22: JEDEC P22 phosphors
values.clear(); values << QString("Reserved"); values << QString("ITU-R BT.709"); values << QString("Unspecified"); values << QString("Reserved"); values << QString("ITU-R BT.470M"); values << QString("ITU-R BT.470BG"); values << QString("SMPTE 170M"); values << QString("SMPTE 240M"); values << QString("FILM"); values << QString("ITU-R BT.2020"); values << QString("SMPTE ST 428-1"); values << QString("JEDEC P22 phosphors"); this->addListField(QString("mkvColourPrimaries"), values.at(0), values, false);

The flagging seems to match what Hybrid offers.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#26
I think there's a misunderstanding here. I am not claiming that Hybrid incorrectly maps the color profiles to the appropriate mkvmerge index. The issue is that if you set "--colour-matrix-coefficients 0:6" (6=SMPTE 170M, BT.601 NTSC), either via "MKV advanced signaling" or via "customMkvmergeAddition", the output MKV file will have the matrix set to BT.470BG, which is "--colour-matrix-coefficients 0:5" (BT.601 PAL). Therefore, it is currently impossible to produce a final MKV file using UTVideo that will have the matrix set to BT.601 NTSC (SMPTE 170M).

If I run mkvmerge myself from Hybrid's directory like: "mkvmerge.exe -o fixed.mkv --colour-matrix-coefficients 0:6 bad.mkv", this time it actually works - the output MKV file has matrix set to BT.601 NTSC (SMPTE 170M). So the problem is not in mkvmerge or ffprobe/MediaInfo.

Random note: apparently mkvmerge uses "color" or "colour" based on your computer's regional settings, and since mine are set to UK... crazy Big Grin
Reply
#27
Okay, I can reproduce the issue:
I:\Hybrid\64bit>mkvmerge --ui-language en -o "E:\Output\using5.mkv" --global-tags "E:\Output\mkvtags_2022-07-27@16_31_24_2910__02.xml" -d 0 --default-track 0:yes --colour-matrix 0:5 --default-duration "0:25/1fps" --aspect-ratio-factor 0:1/1 --fourcc 0:MP4V --no-chapters --compression -1:none --forced-track 0:yes --field-order 0:0 --no-audio --no-subtitles "E:\Output\2022-07-27@16_31_24_2910_01.264" mkvmerge v69.0.0 ('Day And Age') 64-bit 'E:\Output\2022-07-27@16_31_24_2910_01.264': Using the demultiplexer for the format 'AVC/H.264'. 'E:\Output\2022-07-27@16_31_24_2910_01.264' track 0: Using the output module for the format 'AVC/H.264 (unframed)'. The file 'E:\Output\using5.mkv' has been opened for writing. Progress: 100% The cue entries (the index) are being written... Multiplexing took 0 seconds.
results in:
I:\Hybrid\64bit>ffprobe.exe -hide_banner "E:\Output\using5.mkv" Input #0, matroska,webm, from 'E:\Output\using5.mkv': Metadata: encoder : libebml v1.4.2 + libmatroska v1.6.4 creation_time : 2022-07-27T14:34:33.000000Z Encoding Gui : Hybrid 2022.07.24.1 Duration: 00:00:17.16, start: 0.000000, bitrate: 428 kb/s Stream #0:0: Video: h264 (High), yuv420p(tv, bt470bg/unknown/unknown, progressive), 640x352 [SAR 1:1 DAR 20:11], 25 fps, 25 tbr, 1k tbn (default) (forced) Metadata: BPS : 423867 DURATION : 00:00:17.160000000 NUMBER_OF_FRAMES: 429 NUMBER_OF_BYTES : 909196 _STATISTICS_WRITING_APP: mkvmerge v69.0.0 ('Day And Age') 64-bit _STATISTICS_WRITING_DATE_UTC: 2022-07-27 14:34:33 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

I:\Hybrid\64bit>mkvmerge --ui-language en -o "E:\Output\using6.mkv" --global-tags "E:\Output\mkvtags_2022-07-27@16_31_24_2910__02.xml" -d 0 --default-track 0:yes --colour-matrix 0:6 --default-duration "0:25/1fps" --aspect-ratio-factor 0:1/1 --fourcc 0:MP4V --no-chapters --compression -1:none --forced-track 0:yes --field-order 0:0 --no-audio --no-subtitles "E:\Output\2022-07-27@16_31_24_2910_01.264" mkvmerge v69.0.0 ('Day And Age') 64-bit 'E:\Output\2022-07-27@16_31_24_2910_01.264': Using the demultiplexer for the format 'AVC/H.264'. 'E:\Output\2022-07-27@16_31_24_2910_01.264' track 0: Using the output module for the format 'AVC/H.264 (unframed)'. The file 'E:\Output\using6.mkv' has been opened for writing. Progress: 100% The cue entries (the index) are being written... Multiplexing took 0 seconds.
results in:
I:\Hybrid\64bit>ffprobe.exe -hide_banner "E:\Output\using6.mkv" Input #0, matroska,webm, from 'E:\Output\using6.mkv': Metadata: encoder : libebml v1.4.2 + libmatroska v1.6.4 creation_time : 2022-07-27T14:34:48.000000Z Encoding Gui : Hybrid 2022.07.24.1 Duration: 00:00:17.16, start: 0.000000, bitrate: 428 kb/s Stream #0:0: Video: h264 (High), yuv420p(tv, bt470bg/unknown/unknown, progressive), 640x352 [SAR 1:1 DAR 20:11], 25 fps, 25 tbr, 1k tbn (default) (forced) Metadata: BPS : 423867 DURATION : 00:00:17.160000000 NUMBER_OF_FRAMES: 429 NUMBER_OF_BYTES : 909196 _STATISTICS_WRITING_APP: mkvmerge v69.0.0 ('Day And Age') 64-bit _STATISTICS_WRITING_DATE_UTC: 2022-07-27 14:34:48 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES

=> They both seem to be the same.

Then I looked at the output of mkvinfo for '0:5':
mkvinfo.exe e:\Output\using5.mkv + EBML head |+ EBML version: 1 |+ EBML read version: 1 |+ Maximum EBML ID length: 4 |+ Maximum EBML size length: 8 |+ Document type: matroska |+ Document type version: 4 |+ Document type read version: 2 + Segment: size 918083 |+ Seek head (subentries will be skipped) |+ EBML void: size 4029 |+ Segment information | + Timestamp scale: 1000000 | + Multiplexing application: libebml v1.4.2 + libmatroska v1.6.4 | + Writing application: mkvmerge v69.0.0 ('Day And Age') 64-bit | + Duration: 00:00:17.160000000 | + Date: 2022-07-27 14:34:33 UTC | + Segment UID: 0x59 0xb4 0x7e 0x89 0x38 0xec 0x06 0x0d 0x5e 0xd5 0x3e 0x11 0x3f 0x07 0xd5 0xb5 |+ Tracks | + Track | + Track number: 1 (track ID for mkvmerge & mkvextract: 0) | + Track UID: 6042237195334530328 | + Track type: video | + "Forced display" flag: 1 | + "Lacing" flag: 0 | + Codec ID: V_MPEG4/ISO/AVC | + Default duration: 00:00:00.040000000 (25.000 frames/fields per second for a video track) | + Language: und | + Language (IETF BCP 47): und | + Video track | + Field order: 0 (progressive) | + Pixel width: 640 | + Pixel height: 352 | + Display width: 640 | + Display height: 352 | + Video color information | + Color matrix coefficients: 5 | + Codec's private data: size 45 (H.264 profile: High @L4.1) |+ EBML void: size 1008 |+ Cluster
for '0:6':
mkvinfo.exe e:\Output\using6.mkv + EBML head |+ EBML version: 1 |+ EBML read version: 1 |+ Maximum EBML ID length: 4 |+ Maximum EBML size length: 8 |+ Document type: matroska |+ Document type version: 4 |+ Document type read version: 2 + Segment: size 918083 |+ Seek head (subentries will be skipped) |+ EBML void: size 4029 |+ Segment information | + Timestamp scale: 1000000 | + Multiplexing application: libebml v1.4.2 + libmatroska v1.6.4 | + Writing application: mkvmerge v69.0.0 ('Day And Age') 64-bit | + Duration: 00:00:17.160000000 | + Date: 2022-07-27 14:34:48 UTC | + Segment UID: 0x4a 0x1b 0xe3 0x5d 0x07 0xc9 0x95 0x82 0x9f 0xd7 0x78 0xd2 0x03 0x46 0xf9 0xce |+ Tracks | + Track | + Track number: 1 (track ID for mkvmerge & mkvextract: 0) | + Track UID: 17105722522197096261 | + Track type: video | + "Forced display" flag: 1 | + "Lacing" flag: 0 | + Codec ID: V_MPEG4/ISO/AVC | + Default duration: 00:00:00.040000000 (25.000 frames/fields per second for a video track) | + Language: und | + Language (IETF BCP 47): und | + Video track | + Field order: 0 (progressive) | + Pixel width: 640 | + Pixel height: 352 | + Display width: 640 | + Display height: 352 | + Video color information | + Color matrix coefficients: 6 | + Codec's private data: size 45 (H.264 profile: High @L4.1) |+ EBML void: size 1008 |+ Cluster

-> seems to me like a bug in ffmpeg.

Cu Selur
----
Dev versions are in the 'experimental'-folder of my GoogleDrive, which is linked on the download page.
Reply
#28
You are right! I don't know what I was doing yesterday when I thought that I could get ffprobe to show smpte170m as matrix, I think I may have accidentally ran it on an mp4 instead of mkv. Seems like ffmpeg assumes the matrix to be bt470bg only for UTVideo and doesn't care to look at the mkv signaling. No clue why MediaInfo shows "BT.601" instead of "BT.601 NTSC", but if mkvmerge itself can print the correct index, then the data must be correctly written. Sorry for the noise and appreciate your help as always!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)