[Libav-user] Setting nclc tags

Thomas Wilshaw thomaswilshaw at gmail.com
Mon Aug 1 03:29:40 EEST 2022


Hi,

I'm working on a video editor that uses ffmpeg to encode output renders and
I'm having some trouble properly tagging .mov files. Specifically I want to
set the nclc color tags so that QuickTime and other players will properly
display the files.

If I generate a file with the following ffmpeg command:

ffmpeg -f lavfi -i color=#E51818:320x240:d=3 -color_primaries 1 -color_trc
13 -colorspace 0 srgb.mov

I get a file that is correctly interpreted by QuickTime. However when I try
to do the same via the C API  things don't go as well. I set the following
options:

codec_ctx->color_primaries = AVCOL_PRI_BT709;
codec_ctx->color_trc = AVCOL_TRC_IEC61966_2_1;
codec_ctx->colorspace = AVCOL_SPC_RGB;

And most metadata inspectors (MediaInfo, ffprobe) report the tags as being
there. In fact, ffprobe gives the same output for both the clips generated
via the ffmpeg command and the clips generated by my code. However, players
do not seem to respect the tags in the clips I generate with my code.
Interestingly exiftool only reports the "Color Representation: nclc 1 13 0"
when looking at clips generated by the ffmpeg command implying there is
something happening there that is not in my code.

I appreciate this is a bit open ended but I wondered if anyone could shine
any light on the situation or explain the correct method of setting nclc
tags via the C API.

I have had some success in setting the movflags write_colr flag in that
exiftool now shows a "Color Representation" tag.

av_dict_set(&options, "movflags", "write_colr", (1 << 15));

However it seems to be ignoring the actual primaries etc. that I then set
and just using the defaults. Is this the right path or should I be doing
something differently?

Cheers,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20220801/c61e1182/attachment.htm>


More information about the Libav-user mailing list