[FFmpeg-devel] prores_ks: use CodecContext for color information if specified

Marc-Antoine ARNAUD arnaud.marcantoine at gmail.com
Mon Oct 15 12:16:16 EEST 2018


Hi Martin,

For my point of view, the AVFrame contains the colorspace for each frame,
which can be different (maybe not volunteer..).
The colorspace in AVCodecContext is the "pre-computed" colorspace, used to
generate the output file, as header/footer of wrappers can require
colorspace informations (like in MXF, MOV, etc.).

So for me, the AVCodecContext is required and needed to be pre-processed to
wrote the header, and no AVFrame are processed at this stage.
The AVFrame colorspace is required to maybe change graph properties in
real-time (like a colorspace conversion can be set to convert the output
from different colorspace inputs).

So both are differents, but on my point of view, regarding comments, I
purpose:
- AVCodecContext will overwrite the output colorspace (if present)
- AVFrame can be use in video encoder to setup frame headers packets (like
in Mpeg2, H.264, H.265, ProRes etc.) if no AVCodecContext is configured.
- a warning needs to be logged if:
    - AVCodecContext colorspace don't match to the AVFrame colorspace

Remark: colorspace mean here variables for colorspace, color primaries and
color transfer.

So maybe for that, as Paul mentionned, it may require to patch that at an
upper level than encoder to be sure all works similary. But I don't know
where to be honest.

Marc-Antoine

Le sam. 13 oct. 2018 à 14:03, Martin Vignali <martin.vignali at gmail.com> a
écrit :

> Le mer. 10 oct. 2018 à 17:13, Marc-Antoine ARNAUD <
> arnaud.marcantoine at gmail.com> a écrit :
>
> > I have updated the patch with our discussion.
> > It took information only from the codec context.
> >
> > Marc-Antoine
> >
> > Hello,
>
> If i correctly understand (which is not sure :-) :
>
> the colorspace for AVCodecContext, is when all frame use the same
> colorspace
>
> The colorspace in AVFrame, manage the case where colorspace can not be the
> same inside each frame.
> and this info is use inside filtering graph.
>
> If this is correct, then prores encoder need to use AVFrame colorspace for
> each frame
> and if the colorspace information is wrong, or if user need to set another
> one, a filter need to be use to edit the frame (set colorspace information
> or convert from one colorspace to another frame by frame)
> (Or if just the colorspace metadata inside the compress prores frame need
> to be fix,  a bsf can be write to edit frame colorspace properties for
> prores frame)
>
> Another way can be to add an option to the prores encoder, to take
> colorspace information from CodecContext or from Frame.
>
>
> But if other people think your way is better,
> i will change my patch for prores_aw, in order to use the same way to set
> colorspace for each prores frame.
>
> P.S. : Seems like png at least also use AVFrame information instead of
> AVCodecContext
>
> Martin
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list