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

Michael Niedermayer michael at niedermayer.cc
Tue Apr 4 13:06:46 EEST 2017


On Tue, Apr 04, 2017 at 06:04:37AM +0200, wm4 wrote:
> 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.

It would be better to add the parameters alognside sample_aspect_ratio
in AVFilterLink. That way user apps can get such parameters through
at init time much simpler.
Iternally avfilter could use a AVFrame maybe to obtain these

The first AVFrame might not represent the parameters which are most
correct for the whole movie or it may occur long after other streams
start



>
> (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.)

yes

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have often repented speaking, but never of holding my tongue.
-- Xenocrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170404/10020919/attachment.sig>


More information about the ffmpeg-devel mailing list