[FFmpeg-user] How can I set in a D10 MXF (IMX50) file the flags for output color_range, -space, -transfer and primaries?

Christoph Gerstbauer christophgerstbauer at gmail.com
Sat May 2 15:38:58 CEST 2015

Am 01.05.15 um 11:21 schrieb tim nicholson:
> On 30/04/15 22:03, Marton Balint wrote:
>> On Wed, 29 Apr 2015, Christoph Gerstbauer wrote:
>>> I found out that a IMX50 mxf file encoded with FFmbc and the IMX50 mxf
>>> file encoded with actual ffmpeg builds are different in these mxf
>>> metadata flags (by reading out via ffprobe - show_streams)
> Are you sure you mean specifically "mxf metadata flags"?
> See my comments below.
Hello Tim, I wrongly mixed different issues.
The metadata flags color_range=tv, color_space=smpte170m, 
color_transfer=bt709 and color_primaries=bt470bg

are NOT mxf metadata flags. For MXF there exist seperate color range and signal standard metadata flags. (whhich can be read out bei mxf2raw (BBC) for example.

>>> FFMBC IMX FILE stream 0:0:
>>> color_range=tv
>>> color_space=smpte170m
>>> color_transfer=bt709
>>> color_primaries=bt470bg
>>> FFMPEG IMX FILE stream 0:0:
>>> color_range=tv
>>> color_space=unknown
>>> color_transfer=unknown
>>> color_primaries=unknown
>>> I want to set these metadata flags to the same values, but with FFmpeg.
>>> How can I produce the same output like ffmbc with these 4 metadata flags?
>>> I didnt found a answer to that in the ffmpeg documentation :/
>> You can manually specify these settings to force them being set with
>> these parameters:
>> -color_primaries 5
>> -color_trc 1
>> -colorspace 6
>> What does not work as far as I know in ffmpeg is to actually get these
>> settings from the source video, even if ffprobe detects them.
> And what does not work as far as I know in ffmpeg is these values
> actually being written by the mxf muxer. At least I cannot find the
> relevant UL's listed in the "Generic Picture Essence Descriptor" section
> of mxfenc.c which is where I would expect to see them. Or any where else
> for that matter.
> Nor are they in ffmbc for that matter, so I suspect ffprobe is picking
> them up from the essence rather than the specific mxf UL's. (ffmbc sets
> the parameters Marton lists as part of the IMX target, which ffmpeg does
> not have)
> Given that "MXF encoders should encode Transfer Characteristic whenever
> possible" smpte S377-1, this is clearly an omission and I am surprised
> the IRT analyser doesn't spot it.
> Christoph do you actually require the mxf metadata setting (as it really
> ought to be, and what I thought you were after) or are you content with
> it in the essence, in which case, in the absence of a target preset, you
> will have to set the flags yourself.
As Marton Balint showed me the syntax, the setting of these 4 values 
worked, but they dont affect the metadata in the MXF container.
The metadata flags:
Color Siting and Signal Standard werent changed by using the syntax.
Before this test I though I could change these 2 params with the syntax 
descriped above.
But now I know that this is not working.
Furthermore I looked for a way to PASS the test with the IRT Analyzer.

Regarding to the ticket: "How to set 3 specific metadata flags 
(ITU601/displayoffset) in FFmpegs IMX50 MXF-OP1a encoding"
Yes I am still looking for a encoding option fot the mxf encoding of 
ffmpeg to set MANUALLY (of course) the flags for Signal Standard and 
Color Siting.
FFmpeg should never set it autmatically to any values, if the source 
would have empty flags.
So if I know from which source the content is comming, I want to be able 
to set the 2 mxf metadata flags, and also the 4 addional falg for the 
essence (color_range, color_space, color_transfer and color_primaries).

My motivation to this whole issue is:
I want to generate a IMX50 file from an ffv or ffvhuff file were the 
IMX50 target file has less transcoding loss as possible.
Most transcoders I use make an internal convertion from YUV422 to YUV422 
formats (e.g uncompress 4:2:2 to uncompressed 4:2:2) with an ADDIONAL 
loss. I guess it is an internal RGB convertion: YUV422 source to RGB 
(internal) to YUV422 target format. (anyway, these transcoders are black 
boxes and I cannot know if this is the cause)
So when I transcode with these transcoders I have 2 LOSSY steps:
1.) Avoidable LOSS of source is YUV422: addional chroma subsampling 
2.) MPEG2 encoding loss

FFmpeg does not do that: It keeps the yuv422 native format and just 
encode it to mpeg2. -> And that would lead to better quality IMX files.
Therefore I want to switch from "professional" transcoders to ffmpeg for 
generation IMX50. But I will still ned this metadata flag to do it 

Best Regards
Christoph Gerstbauer

>> Regards,
>> Marton
>> [..]

More information about the ffmpeg-user mailing list