[FFmpeg-devel] [PATCH 3/4] avformat/movenc: force colr atom for uncompressed yuv in mov

Dave Rice dave at dericed.com
Mon Nov 20 17:19:57 EET 2017

> On Nov 20, 2017, at 9:55 AM, Derek Buitenhuis <derek.buitenhuis at gmail.com> wrote:
> On 11/20/2017 2:50 PM, Dave Rice wrote:
>> I am hesitant to see write_colr option removed since the guesswork used here https://github.com/FFmpeg/FFmpeg/blob/8f4702a93f87f9f76563e80f1ae2141a40029d9d/libavformat/movenc.c#L1747-L1775 would then be applied to all movs of standard HD and SD size and cause many ffmpeg outputs to appear differently after the change.
> 100% agree with this. We *should not* write guessed color information based
> off of resolution by default.
> Further, if no color information is present, no colr atom should be written
> at all, unless it is forced by the user (aka the write_colr option right
> now).

TN2162 requires a colr atom for uncompressed yuv (including v210, v308, v408, etc) in mov, so I'd prefer to write it in this case. Note that the colr atom provides an option for unspecified for each of the color values, so there's a method to write a colr atom which basically says ¯\_(ツ)_/¯.

>> Could the guesswork here be removed? Or could write_colr be enabled with the option removed while the guesswork itself has its own option?
> If the quesswork is removed or put under an option, I still maintain no
> colr atom should be written if no color information is known. Doing
> so is just asking for trouble, in my opinion.

I disagree. I'd prefer to follow the specification and write a colr atom (in the case of uncompressed yuv in mov) that say the colr is unspecified rather than to write no colr atom at all and create an invalid file. See https://developer.apple.com/library/content/technotes/tn2162/_index.html#//apple_ref/doc/uid/DTS40013070-CH1-TNTAG9.

I do agree that guesswork should be avoided or provided under an option that users could opt into. I suppose my preference order from support to oppose for writing uncompressed yuv in mov would be:

1: write a colr atom in all cases (if unknown, use unspecified values in colr atom)
2: write a colr atom if color data the known (no colr atom if unknown)
3: write a colr atom in all cases (if unknown, just make stuff up, #yolo)

Dave Rice

More information about the ffmpeg-devel mailing list