[FFmpeg-devel] [PATCH] ffmpeg: set user-set rotation for encoded streams too

Gyan Doshi ffmpeg at gyani.pro
Sun May 15 14:58:33 EEST 2022



On 2022-05-15 04:29 pm, Jan Ekström wrote:
> On Thu, May 12, 2022 at 11:19 AM Anton Khirnov <anton at khirnov.net> wrote:
>> Quoting Gyan Doshi (2022-05-12 09:01:31)
>>> A substitute option for metadata rotate would accept a single rotation
>>> value.
>>> If adding an option for matrix, we should allow flips too.
>> I see no reason not to have both. You can have a simple option for just
>> the rotation and an advanced option for specifying full matrix.
>>
> FYI I had thought about arguments-to-side data earlier, and as I saw
> this thread I decided to make a proof-of-concept that has one layer
> which constructs an AVBufferRef of the side data itself based on an
> AVDictionary (constructor, basically), and then another which then
> goes over type-arguments sort of dictionary and attaches things (to an
> AVFrame in this case). AVPacket and AVFrame side data is slightly
> different, so I guess you'd have to split one layer which generates an
> AVBufferRef, and then that'd be utilized (discarded or not) by the
> utilizing function.
>
> I do wonder if AVOptions wouldn't be better for something like this,
> but at least it lets you play around with the idea. My initial API
> user ended up being the setparams filter.
>
> Link to PoC branch:
> https://github.com/jeeb/ffmpeg/commits/arguments_to_side_data
>
> Usage example:
> ffmpeg -v verbose -i INPUT -map 0:v:0 -vf
> setparams=side_data=displaymatrix=angle=34.34,showinfo -vframes 1 -f
> null -

The metadata hack uses avutil/display API to set the matrix and then 
attach it to the *stream* as side data  A filter will force encoding.
Since this is usability/display info for the consumer , it should remain 
available for streamcopy.

Regards,
Gyan


More information about the ffmpeg-devel mailing list