[FFmpeg-devel] sendcmd filter now can send metadata

Сергей Солтанов solt at solt.ru
Tue May 2 23:30:41 EEST 2023


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.

-- 
regarts,
Sergey Soltanov.
I'm Winston Wolf, I solve problems.

M2CONNECT.RU
-------------- next part --------------
A non-text attachment was scrubbed...
Name: f_sendcmd.c
Type: application/octet-stream
Size: 21905 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230502/5dc89041/attachment.obj>


More information about the ffmpeg-devel mailing list