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

James Almer jamrial at gmail.com
Thu Jul 20 22:39:36 EEST 2023


On 7/20/2023 4:31 PM, Anton Khirnov wrote:
> 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

My other set will introduce this, so at least the first step towards 
this will be done. I'll send it in a few.

> and the filtergraph and then be processed by the
> encoder.

It however doesn't touch lavfi.

> Just blindly copying whatever is in the input is bound to
> produce inaccurate information.

Agree, but that's outside the scope of this set. I don't think lavfi can 
even take global side data right now. Only on a frame basis.


More information about the ffmpeg-devel mailing list