[FFmpeg-user] get_duration command within movie filter

Conan Jen conan.jen at gmail.com
Wed Mar 22 20:48:41 EET 2023


Hi,

I've been having some trouble determining from the documentation whether
this can achieve what I'm attempting to do or not.

>From my current understanding, get_duration is a command that is available
to the movie filter (see:
https://ffmpeg.org/ffmpeg-filters.html#Commands-161), but I'm unsure as to
the role commands play within the filtergraph. Does this mean that I'm able
to run a command within a filter and have the command's return value
available as an output?

So is something like "movie=test.mp4:get_duration[duration_in_secs]"
available? Or am I completely misunderstanding the role of commands in the
filtergraph / availability of general variables as outputs?

As a higher level overview, what I'm really trying to do is to obtain a
duration (or a framecount) within the filtergraph for use by a further
filter, where ideally something like

movie=test.mp4:get_duration[duration_in_secs];
select=not(mod(n,[duration_in_secs]*60/20));

would result in a self contained filtergraph that could dynamically fetch
20 evenly spaced frames from an input for processing.

Thanks for your help, and apologies if this is something that's obvious
from the documentation that I may have missed.

-conan


More information about the ffmpeg-user mailing list