[FFmpeg-devel] [PATCH 5/5] fftools/ffmpeg: support applying container level cropping

Anton Khirnov anton at khirnov.net
Thu Jul 20 22:31:58 EEST 2023


Quoting James Almer (2023-07-20 21:25:02)
> On 7/20/2023 4:08 PM, Anton Khirnov wrote:
> > Quoting James Almer (2023-07-20 00:20:43)
> >> diff --git a/fftools/ffmpeg_enc.c b/fftools/ffmpeg_enc.c
> >> index 8b750de4e5..3cf29c8b2c 100644
> >> --- a/fftools/ffmpeg_enc.c
> >> +++ b/fftools/ffmpeg_enc.c
> >> @@ -441,14 +441,16 @@ int enc_open(OutputStream *ost, AVFrame *frame)
> >>           int i;
> >>           for (i = 0; i < ist->st->nb_side_data; i++) {
> >>               AVPacketSideData *sd = &ist->st->side_data[i];
> >> -            if (sd->type != AV_PKT_DATA_CPB_PROPERTIES) {
> >> +            if (sd->type == AV_PKT_DATA_CPB_PROPERTIES)
> >> +                continue;
> >> +            if (ist->apply_cropping && sd->type == AV_PKT_DATA_FRAME_CROPPING)
> >> +                continue;
> > 
> > I'm very much not a fan of the encoder doing anything based on decoder
> > options.
> 
> Right now, all input stream side data (save for CPB) is copied to the 
> output stream.

I think it's wrong for transcoding. Side data should be propagated
through the decoder and the filtergraph and then be processed by the
encoder. Just blindly copying whatever is in the input is bound to
produce inaccurate information.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list