Selur's Little Message Board

Full Version: Setting PAR and color matrix on container-level
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello again.

I have a workflow where I take SD videos, for example PAL 16:15, bt470bg/bt470bg/bt709, and I deinterlace + bob using Hybrid. However, the output file, no matter what container or encoder, will not contain the PAR or color matrix/curve hints. This causes players to stretch the video and/or display it using wrong colors. I found a work around - h264 and h265 encoders in Hybrid allow you to override these hints, and that gets picked up by players at the end. But for every other encoder type, e.g. UT-VIDEO, there is no such option. Currently I need a post-processing step like this:
Code:
ffmpeg -i hybrid.mkv -colorspace bt470bg -color_primaries bt470bg  -color_trc bt709 -aspect 4:3 -c copy -o fixed.mkv
This will merely adjust the hints without touching the video or audio streams, but obviously takes a long time as it needs to copy the whole file.

I was wondering is there any way to do this using Hybrid?

Thanks!

I actually found a solution for MKV files. In Config > Containers, add the following "Mkvmerge command line addition":
Code:
--aspect-ratio 0:4/3 --colour-matrix-coefficients 0:5 --colour-transfer-characteristics 0:1 --colour-primaries 0:5

However, I don't see a "command line addition" option for MP4Box or FFmpeg in general. Any chance to add them? Having that would allow one to customize the output beyond the options present in Hybrid.

Thanks!
Code:
I have a workflow where I take SD videos, for example PAL 16:15, bt470bg/bt470bg/bt709, and I deinterlace + bob using Hybrid. However, the output file, no matter what container or encoder, will not contain the PAR or color matrix/curve hints
PAR and VUI signaling should be on stream not container level.
MKV allows additional HDR related signaling through the container.

I could probably add support through ffmpeg, mp4box, mkc for additionally signaling vui stuff through the container.
(ffmpeg is well documented over at https://www.ffmpeg.org/ffmpeg-all.html, mkv is well documented through https://mkvtoolnix.download/doc/mkvmerge.html)
Main problem is I would need some documentation, for mp4box, since

Quote:colr (string)

set color profile for imported video content (see ISO/IEC 23001-8). Value is formatted as:
* nclc,p,t,m: with p colour primary, t transfer characteristics and m matrix coef
* nclx,p,t,m,r: same as nclx with r full range flag
* prof,path: with path indicating the file containing the ICC color profile
* rICC,path: with path indicating the file containing the restricted ICC color profile
see: https://www.mankier.com/1/mp4box#Hinting_Options
-> without any clue how ISO/IEC 23001-8 I would need some additional details on how to use nclx and nclc

Cu Selur

Ps.: busy this weekend (helping a friend move to a new apartment, but I could look into it next week)
Quote:PAR and VUI signaling should be on stream not container level.

MKV allows additional HDR related signaling through the container.

I'll be honest, I'm clueless where the signaling is or should be stored. With my mkvmerge options above, it gets picked up in both players and ffmpeg. Does that go in container or stream? I actually tried the "MKV tagging" tab in Hybrid, which I think definitely goes in the container, and setting the color properties there got utterly ignored by virtually every player and tool I tried, including ffmpeg.

Quote:without any clue how ISO/IEC 23001-8 I would need some additional details on how to use nclx and nclc

I wish I could help with this one, but looking at the docs it means even less to me...

For my use case the mkvmerge options are more than enough though, so no pressure if this is a complicated ask!

Good luck with moving!

Thank you