[FFmpeg-devel] [PATCH 4/4] ffmpeg: pass decoded or filtered AVFrame to output stream initialization

Jan Ekström jeebjp at gmail.com
Tue Sep 15 13:06:35 EEST 2020


On Tue, Sep 15, 2020 at 10:54 AM Michael Niedermayer
<michael at niedermayer.cc> wrote:
>
> On Sun, Sep 13, 2020 at 01:26:22PM +0300, Jan Ekström wrote:
> > Additionally, reap the first rewards by being able to set the
> > color related encoding values based on the passed AVFrame.
> >
> > The only tests that seem to have changed their results with this
> > change seem to be the MXF tests. There, the muxer writes the
> > limited/full range flag to the output container if the encoder
> > is not set to "unspecified".
> > ---
> >  fftools/ffmpeg.c            | 42 +++++++++++++++++++++++++++----------
> >  tests/ref/lavf/mxf_d10      |  2 +-
> >  tests/ref/lavf/mxf_dv25     |  2 +-
> >  tests/ref/lavf/mxf_dvcpro50 |  2 +-
> >  tests/ref/lavf/mxf_opatom   |  2 +-
> >  5 files changed, 35 insertions(+), 15 deletions(-)
>
> This breaks:
>
> ./ffmpeg -i fate-suite//png1/lena-rgba.png -pix_fmt rgba -vcodec ljpeg -bitexact ljpeg.jpeg

By applying some logging (patch follows), it seems like the AVFrame
incorrectly identifies itself as limited range:
AVFrame: 128x128, pix_fmt: bgra, range: tv

Will have to see which filter does this, or if this is a general issue
when initializing AVFrames.

Jan

------>8--------
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 8874da9268..27185441ff 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1124,6 +1124,13 @@ static void do_video_out(OutputFile *of,
     InputStream *ist = NULL;
     AVFilterContext *filter = ost->filter->filter;

+    if (next_picture) {
+        const AVPixFmtDescriptor *desc =
av_pix_fmt_desc_get(next_picture->format);
+        av_log(NULL, AV_LOG_VERBOSE, "AVFrame: %dx%d, pix_fmt: %s,
range: %s\n",
+               next_picture->width, next_picture->height,
+               desc->name, av_color_range_name(next_picture->color_range));
+    }
+
     init_output_stream_wrapper(ost, next_picture, 1);
     sync_ipts = adjust_frame_pts_to_encoder_tb(of, ost, next_picture);


More information about the ffmpeg-devel mailing list