[FFmpeg-devel] sendcmd filter now can send metadata

Stefano Sabatini stefasab at gmail.com
Sun May 14 12:31:30 EEST 2023


On date Tuesday 2023-05-02 23:30:41 +0300, Сергей Солтанов wrote:
> Hi!

> I googled tonnes of information about how to forward data from one filter
> to another, but nothing possible. The only way is to send some current
> frame data as a command with sendcmd filter, but most of it accessible by
> filters themselves.
> Most of interesting data prepared by some analysing filters like
> cropdetect,  signalstats etc. and saved in frame metadata.
> It could be a good idea to send it somehow to next filters in filtergraph.
> 
> So I added a small code to sendcmd filter, so it can evaluate function
> meta(key) in its commands when [expr] flag is used, e.g.:
> -------------------
> ffmpeg ... -vf cropdetect=reset=1,\
> sendcmd=c='0 [expr] crop x 10+meta(lavfi.cropdetect.x),\
> [expr] crop y meta(lavfi.cropdetect.y)+meta(lavfi.cropdetect.h)/2,\
> [expr] crop w meta(lavfi.cropdetect.w)-10\
> [expr] crop h 0.5*meta(lavfi.cropdetect.h)'\
> ,crop
> -------------------
> 

> I don't know how to use git here, so just cloned last version (v5.1) and
> edited f_sendcmd.c.
> If my contribution is interesting, I'll try to upload it into repository,
> but I need some help, or maybe someone will do it?
> 
> Please, find updated file in attachment.

It's easier to review this if you send a patch:
https://ffmpeg.org/git-howto.html#Basics-Usage

This is the process:
git clone https://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
# edit edit edit test edit
git diff
git commit -a
git format-patch HEAD~1

Then you send the generated patch as an attachment to your reply. We
also need documentation changes (in doc/filters.texi) to provide
context and examples for the feature.

Thanks.


More information about the ffmpeg-devel mailing list