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

Jan Ekström jeebjp at gmail.com
Sun May 15 13:59:38 EEST 2022


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 -

In theory av_frame_side_data_name could be utilized for side data
naming, but in that case it would be "3x3 displaymatrix=angle=34.34",
which is why I - unfortunately - decided not to utilize it at first.

Jan


More information about the ffmpeg-devel mailing list