Selur's Little Message Board
[BUG] changing colour space with VUI (wrong syntax passed to FFMPEG) - Printable Version

+- Selur's Little Message Board (https://forum.selur.net)
+-- Forum: Hybrid - Support (https://forum.selur.net/forum-1.html)
+--- Forum: Problems & Questions (https://forum.selur.net/forum-3.html)
+--- Thread: [BUG] changing colour space with VUI (wrong syntax passed to FFMPEG) (/thread-3458.html)



[BUG] changing colour space with VUI (wrong syntax passed to FFMPEG) - MacNB - 04.11.2023

Here's details:

What Hybrid version did you use?
rev 2022.03.20.1 running on macOS Mojave 10.14.6

What did happen?
-> 2023-11-04@17_38_45_2210_03_video crashed: ERROR: /Users/MacNB/Movies/Hybrid/tmp/V8-Original-Sample-01-DeInt_2023-11-04@17_38_45_2210_03.mov was not created!Aborting '2023-11-04@17_38_45_2210_03_video' due to: ERROR: /Users/MacNB/Movies/Hybrid/tmp/V8-Original-Sample-01-DeInt_2023-11-04@17_38_45_2210_03.mov was not created!

What did you do to get to the bug?
In the ProRes Tab, I click VUI check box and set Primes to bt470bg, Transfer to bt709 and Matrix to bt470bg.
(I have a screenshot but can't seems to post it directly here).

In the same tab, at the bottom, there's the FFMPEG command line that shows the issue:
ffmpeg -y -i - -vcodec prores_ks -profile:v 2 -vtag apcn -bsf:v prores_metadata=color_primaries=bt470bg:color_trc=bt709:colorspace=bt470bg -f mov "/Users/MacNB/Movies/Hybrid/tmp/V8-Original-Sample-01-DeInt.mov"

The bug is the syntax for prores_metadata parameter. I believe there should be no "=" after prores_metadata otherwise it's an invalid parameter

Debug output would be helpful
Debug file attached [attachment=2098]

The ERROR line from the Debug log shows:

2023.11.04 - 17:38:47_macOS Mojave (10.14) (64bit)_2022.03.20.1 - level 9: FFmpeg output: [prores_metadata_bsf @ 0x7fa40df02440] [Eval @ 0x7ffee9cebf70] Undefined constant or missing '(' in 'bt470bg'[prores_metadata_bsf @ 0x7fa40df02440] Unable to parse option value "bt470bg"Error parsing bitstream filter sequence 'prores_metadata=color_primaries=bt470bg:color_trc=bt709:colorspace=bt470bg': Invalid argument

a small sample, which allows the reprocudtion of the problem would be nice
A trimmed down clip of the input file attached.
Please, read the 'Infos needed to fix&reproduce bugs,..'-sticky before you post about a problem.


RE: [BUG] changing colour space with VUI (wrong syntax passed to FFMPEG) - Selur - 04.11.2023

Looking at:
https://ffmpeg.org/ffmpeg-bitstream-filters.html#prores_005fmetadata
They say to use:
ffmpeg -i INPUT -c copy -bsf:v prores_metadata=color_primaries=bt709:color_trc=bt709:colorspace=bt709 output.mov
Okay, the problem is: bt470bg is only allowed for the primes.
color_primaries

    Set the color primaries. Available values are:

    ‘auto’

        Keep the same color primaries property (default).
    ‘unknown’
    ‘bt709’
    ‘bt470bg’

        BT601 625
    ‘smpte170m’

        BT601 525
    ‘bt2020’
    ‘smpte431’

        DCI P3
    ‘smpte432’

        P3 D65

transfer_characteristics

    Set the color transfer. Available values are:

    ‘auto’

        Keep the same transfer characteristics property (default).
    ‘unknown’
    ‘bt709’

        BT 601, BT 709, BT 2020
    ‘smpte2084’

        SMPTE ST 2084
    ‘arib-std-b67’

        ARIB STD-B67

matrix_coefficients

    Set the matrix coefficient. Available values are:

    ‘auto’

        Keep the same colorspace property (default).
    ‘unknown’
    ‘bt709’
    ‘smpte170m’

        BT 601
    ‘bt2020nc’
=> I'll restrict Hybrid to the values listed in the FFmpeg documentation.

Thanks for the report.
Instead of:
Quote:Primes to bt470bg, Transfer to bt709 and Matrix to bt470bg.
use:
Primes to bt470bg, Transfer to bt709 and Matrix to smpte170m.
prores_metadata=color_primaries=bt470bg:color_trc=bt709:colorspace=smpte170m
works fine here.


Cu Selur


RE: [BUG] changing colour space with VUI (wrong syntax passed to FFMPEG) - MacNB - 04.11.2023

(04.11.2023, 20:58)Selur Wrote: use:
Primes to bt470bg, Transfer to bt709 and Matrix to smpte170m.
prores_metadata=color_primaries=bt470bg:color_trc=bt709:colorspace=smpte170m
works fine here.


Cu Selur

Thanks for a quick reply.

The reason I was trying to change the colour space was because the video file I captured (using Matrox MXO2's Vetura App) has the colour primaries as BT.601 NTSC even though the source is PAL. I think either that's a bug in the capture s/w that is incorrectly setting the metadata to NTSC, or it really is capturing a PAL tape and converting it to NTSC.
There's no setting in the capture s/w to select PAL & NTSC capture.

That's why I was trying to 'turn' it back to PAL. 
Setting colorspace=smpte170m (which I believe is NTSC) would return it to NTSC ?


RE: [BUG] changing colour space with VUI (wrong syntax passed to FFMPEG) - Selur - 04.11.2023

Can't say anything about your capture.
VUI changes will only change the tags to let the decoder know how to properly decode the content.
It will not change the actual data, to change the color matrix you would need to convert the color matrix.

Cu Selur


RE: [BUG] changing colour space with VUI (wrong syntax passed to FFMPEG) - MacNB - 04.11.2023

OK thx. Got it.
That's what I was hoping (that it's changing the tags and not the actual colour).

BTW, Is there a way to check is the captured file is really PAL or NTSC ?


RE: [BUG] changing colour space with VUI (wrong syntax passed to FFMPEG) - Selur - 04.11.2023

Quote:Is there a way to check is the captured file is really PAL or NTSC ?
Aside from checking resolution, frame rate and whether the colors look correct: No.


RE: [BUG] changing colour space with VUI (wrong syntax passed to FFMPEG) - MacNB - 04.11.2023

Thx.
Resolution is correct,
Frame rate is correct.
Colours seem OK but I have never seen an NTSC playback so cannot tell if it's PAL or NTSC.