[FFmpeg-devel] [PATCH] HDR Transcode VUI Info Copy

wm4 nfxjfg at googlemail.com
Tue Apr 4 07:04:37 EEST 2017


On Mon, 3 Apr 2017 19:50:07 +0000
Ben Chang <benc at nvidia.com> wrote:

> From c8092bc538ba7ae32357ca166e67809eb3705f60 Mon Sep 17 00:00:00 2001
> From: Ben Chang <benc at nvidia.com>
> Date: Mon, 27 Mar 2017 17:00:19 -0700
> Subject: [PATCH] Allow transfer of HDR-required VUI info from dec ctx to enc
>  ctx
> 
> ---
>  ffmpeg.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/ffmpeg.c b/ffmpeg.c
> index 532db80..1ef2906 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -3239,6 +3239,9 @@ static int init_output_stream_encode(OutputStream *ost)
>          dec_ctx = ist->dec_ctx;
>  
>          enc_ctx->chroma_sample_location = dec_ctx->chroma_sample_location;
> +        enc_ctx->color_primaries = dec_ctx->color_primaries;
> +        enc_ctx->color_trc = dec_ctx->color_trc;
> +        enc_ctx->colorspace = dec_ctx->colorspace;
>      } else {
>          for (j = 0; j < oc->nb_streams; j++) {
>              AVStream *st = oc->streams[j];

The line you base those on isn't really correct. This should go
through libavfilter, i.e. using the first AVFrame's parameters.
The reason is that libavfilter might change the colorspace parameters.
So you need to somehow grab the queued AVFrame, and use its fields
instead of the dec_ctx.

(Although maybe I'm asking too much - the required change isn't that
simple, and more work than just logically extending something that
already exists.)


More information about the ffmpeg-devel mailing list