Support for metadata in libavutil/eval.c
Hi, I was thinking about introducing support for meta() function in the expression evaluation language. As the ffmpeg filters gradually add support for metadata, it would be convenient to do something like this:
ffmpeg -i input.webm -vf cropdetect,crop=x=meta('lavfi.cropdetect.x'):y=meta('lavfi.cropdetect.y'):w=meta('lavfi.cropdetect.w'):h=meta('lavfi.cropdetect.x') output.webm
This fully automated crop is possible mainly thanks to cropdetect filter that sets lavfi.cropdetect.* metadata. Now, as far as I know the expression evaluation is now optimized to only work with double values, therefore the re-implementation of the expression evaluation to accept string arguments would not be trivial and so I ask you, would such functionality be helpful and welcome?
Le quintidi 25 messidor, an CCXXII, Stepan Bujnak a écrit :
Now, as far as I know the expression evaluation is now optimized to only work with double values, therefore the re-implementation of the expression evaluation to accept string arguments would not be trivial and so I ask you, would such functionality be helpful and welcome?
As far as I know, the eval code is not optimized much: it just parses the expression into an abstract tree in memory with a lot of pointers. I believe the eval code would greatly benefit from a complete modernizing, both for usability and speed: - constant sub-expressions simplification; - rewrite the parser to have the full range of C operators: "a<b" instead of "lt(a,b)", "c?x:y" would be nice too; - compile the parsed tree for the expression into some kind of bytecode would probably greatly enhance speed. Adding support for string values can be done at the "rewrite the parser" step. This is quite huge work, but really useful IMHO. Regards, -- Nicolas George
participants (2)
-
Nicolas George -
Stepan Bujnak