[FFmpeg-trac] #9772(avfilter:new): colorspace filter fails on trc=linear

FFmpeg trac at avcodec.org
Sun May 8 11:32:28 EEST 2022


#9772: colorspace filter fails on trc=linear
-------------------------------------+-------------------------------------
             Reporter:  Llyw         |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:  avfilter     |                  Version:
             Keywords:  colorspace   |  unspecified
  conversion linear gamma            |               Blocked By:
  resampling                         |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 I am currently trying to get a filter graph running that converts to
 linear gamma prior to resampling the video and then re-apply a transfer
 curve. So my `-filter:v` option essentially looks like
 `'[...],colorspace=primaries=smpte170m:trc=linear,scale=[...],colorspace=all=smpte170m'`

 Unfortunately, attempting to process videos this way results in an error
 as the trc option of the first `colorspace` filter is parsed but
 apparently ignored:
 {{{
 [Parsed_colorspace_1 @ ...] Setting 'primaries' to value 'smpte170m'
 [Parsed_colorspace_1 @ ...] Setting 'trc' to value 'linear'
 [...]
 [Parsed_colorspace_1 @ ...] Please specify output transfer characteristics
 Error while filtering: Invalid argument
 Failed to inject frame into filter network: Invalid argument
 Error while processing the decoded data for stream #0:0
 }}}

 I have noted that the `linear` option for `trc` is currently not
 documented but it is certainly part of the code. I wish to resample in a
 space with linear gamma, so it would be kind of important to me if this is
 fixed. (I don't get an error if I am using
 `colorspace=all=smpte170m:trc=linear` but I am assuming that this then
 ignores the `trc=linear` part and still works with the SMPTE 170M transfer
 curve applied, which is absolutely not what I want.)

 I would also like to know why I explicitly have to specify the primary
 colors of the output color space? Can't this just default to the input's
 properties? I hope I am not missing something here and still doing the
 resampling in the wrong color space?

 I understand that `zscale` can also be used (and it doesn't force me to
 specify the output primaries if I only care about the transfer curve), but
 I have found that color space conversion in combination with resampling
 using `zscale` is 4x slower than using native filters on my system,
 contradicting their claims on !GitHub. In addition, I am still not sure
 whether zscale automatically converts to linear gamma before resampling or
 whether I have to do that manually, i.e. use three filters instead of one.
 Add that to that the fact that there seems to be less debug output with
 `zscale` and you'll probably understand why I prefer using the native
 filters.
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9772>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list