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

James Almer jamrial at gmail.com
Tue Jul 2 21:43:59 EEST 2024


On 7/2/2024 2:55 PM, Anton Khirnov wrote:
> Quoting James Almer (2024-07-02 18:49:36)
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>   doc/ffmpeg.texi         | 16 ++++++++++++++++
>>   fftools/ffmpeg.h        | 15 +++++++++++++++
>>   fftools/ffmpeg_demux.c  | 26 ++++++++++++++++++++++++++
>>   fftools/ffmpeg_filter.c | 10 ++++++++++
>>   fftools/ffmpeg_opt.c    | 25 +++++++++++++++++++++++++
>>   5 files changed, 92 insertions(+)
>>
>> diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
>> index f25f6192eb..f75ed681cf 100644
>> --- a/doc/ffmpeg.texi
>> +++ b/doc/ffmpeg.texi
>> @@ -1262,6 +1262,22 @@ disabled, all output frames of filter graph might not be in the same resolution
>>   and may be inadequate for some encoder/muxer. Therefore, it is not recommended
>>   to disable it unless you really know what you are doing.
>>   Disable autoscale at your own risk.
>> +
>> + at item -apply_cropping
> 
> + at item -apply_cropping[:@var{stream_specifier}] @var{source} (@emph{input,per-stream})

Ok.

> 
> 
>> +Automatically crop the video according to file metadata. Default is @emph{all}.
>                                 ^
>                          after decoding

Ok.

>> +
>> + at table @option
>> + at item none (0)
>> +Don't apply any cropping metadata.
>> + at item all (1)
>> +Apply both codec and container level croppping. This is the default mode.
>> + at item codec (2)
>> +Apply codec level croppping.
>> + at item container (3)
>> +Apply container level croppping.
>> +
>> + at end table
>> +
> 
> Also, this should probably be in the advanced section, since it's marked
> as OPT_EXPERT.

So are autoscale and autorotate, which are also outside the advanced 
section. But i can move it if you prefer.

> 
>> @@ -715,6 +729,7 @@ AVDictionary *strip_specifiers(const AVDictionary *dict);
>>   int find_codec(void *logctx, const char *name,
>>                  enum AVMediaType type, int encoder, const AVCodec **codec);
>>   int parse_and_set_vsync(const char *arg, int *vsync_var, int file_idx, int st_idx, int is_global);
>> +int parse_and_set_cropping(const char *arg, int *out);
> 
> What's the point of this being in a separate file when it's only used
> from ffmpeg_demux?

Copy-paste implementation from parse_and_set_vsync(). Will move.


More information about the ffmpeg-devel mailing list