On Tue, Sep 15, 2020 at 1:06 PM Jan Ekström <jee...@gmail.com> wrote: > > On Tue, Sep 15, 2020 at 10:54 AM Michael Niedermayer > <mich...@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);
Further looking into this, it seems to come from filtering (?) (diff attached) decoded AVFrame: 128x128, pix_fmt: rgba, range: pc while... AVFrame to be encoded: 128x128, pix_fmt: bgra, range: tv Jan ------>8-------- diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 8874da9268..f4af6cc71f 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 to be encoded: %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); @@ -2266,6 +2273,13 @@ static int decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame, AVPacke if (ret >= 0) *got_frame = 1; + if (frame) { + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format); + av_log(NULL, AV_LOG_VERBOSE, "decoded AVFrame: %dx%d, pix_fmt: %s, range: %s\n", + frame->width, frame->height, + desc ? desc->name : "unknown", av_color_range_name(frame->color_range)); + } + return 0; } _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".