[FFmpeg-devel] [PATCH 1/2] ffmpeg: add display_{rotation, hflip, vflip} options

Thilo Borgmann thilo.borgmann at mail.de
Tue Aug 2 19:49:54 EEST 2022


Am 02.08.22 um 18:48 schrieb Thilo Borgmann:
> Hi,
> 
>>>>>> On 2022-05-18 11:34 pm, Jan Ekström wrote:
>>>>>>> This enables overriding the rotation as well as horizontal/vertical
>>>>>>> flip state of a specific video stream on either the input or output
>>>>>>> side.
>>>>>>
>>>>>> Since rotation, flip and scale are stored in a single data structure,
>>>>>> how about a single option i.e. -display "rotate=90,flip=hv,scale=2"
>>>>>
>>>>>
>>>>> I did think about that, and I even implemented AVDict based options for ffmpeg.c in a branch. But then pretty much got tired of lack of AVOption automation (f.ex. for the flip flagging etc), and decided that since these are relatively basic and simple, the non-generic option for this could be just three options in the initial submission.
>>>>
>>>> In the end I did implement this with a single dict-based thing in a
>>>> branch but never got to posting it to this thread:
>>>> https://github.com/jeeb/ffmpeg/commits/ffmpeg_c_display_matrix_with_dicts
>>>>
>>>> So for the positive: Now it's all in a single option so it's clear
>>>> that it's defining a single structure.
>>>> And the negative: Needs a struct definition, struct, AVOption list,
>>>> AVClass and actually if you already made a dict out of the options
>>>> before, as the functions will free the original after usage and
>>>> generate a new one, it destroys the life time expectations of the dict
>>>> and thus it is just simpler to copy the dict when entering the
>>>> function (I think there is an arguments string based API which might
>>>> or might not actually be simpler for this case).
>>>>
>>>> So yea, not sure if I prefer this version.
>>>
>>> Ping.
>>>
>>> Did this stall for a reason? How can we iterate on it?
>>
>> Since the rotation/flip/scale hints are stored in a single data structure, I prefer a single user option to set those values.
> 
> attached patch allows for printing the arguments of the new -display_rotation (or any) option.
> 
> I wrote this in jeeb's github branch [1] where it applies on-top. Didn't test with FFmpeg/HEAD as this still needs cleanup anyways.
> Never touched this whole options thing before, I guess there's lot to complain about...

Produced output looks like:

-display_matrix arguments  define a display matrix with rotation and/or horizontal/vertical flip for stream(s)
    rotation          <double>      set rotation (from -DBL_MAX to DBL_MAX) (default DBL_MAX)
    hflip             <boolean>     set hflip (default auto)
    vflip             <boolean>     set vflip (default auto)


> -Thilo
> 
> [1] https://github.com/jeeb/ffmpeg/commits/ffmpeg_c_display_matrix_with_dicts
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list