[FFmpeg-devel] video filter with R8G8B8 input and R10G10B10 output

Paul B Mahol onemda at gmail.com
Tue Jul 24 18:19:10 EEST 2018


On 7/24/18, Guo, Yejun <yejun.guo at intel.com> wrote:
> Hi,
>
> I'm trying a deep learning model with converts SDR (with format R8G8B8) to
> HDR (with format R10G10B10) with ffmpeg. I wrote a video filter with only
> supported format AV_PIX_FMT_RGB24 (see code below), it turns out that the
> format of the input frame of the filter is R8G8B8, and so the output frame,
> the input and output formats are always the same.
>
> my question is how to write a filter with AV_PIX_FMT_RGB24 as input format,
> and with AV_PIX_FMT_GBRP10BE/AV_PIX_FMT_GBRP10LE as output format.
>
> // here is how I currently set the format for the filter.
> static int query_formats(AVFilterContext* context)
> {
>     printf("%s:%d query_formats called\n", __FILE__, __LINE__);
>     const enum AVPixelFormat pixel_formats[] = {AV_PIX_FMT_RGB24,
>                                                 AV_PIX_FMT_NONE};
>     AVFilterFormats* formats_list;
>     formats_list = ff_make_format_list(pixel_formats);
>     if (!formats_list){
>         av_log(context, AV_LOG_ERROR, "could not create formats list\n");
>         return AVERROR(ENOMEM);
>     }
>     return ff_set_common_formats(context, formats_list);
> }
>
> thanks
> Yejun

Take a look at other filters in libavfilter.


More information about the ffmpeg-devel mailing list