[FFmpeg-user] What is the fastest way to run cropdetect on specific frames in the video?

Matt Kim matthkim at gmail.com
Sun Jul 3 20:40:24 CEST 2011


Hello,

I am trying to run the cropdetect function from the libavfilter library in
the fastest way possible.

And so I am trying to only take a collection of video frames throughout the
video and run it through the cropdetect filter.

So far I have tried two methods:
1. Run FFmpeg 4 different times in parallel at 4 different seektimes using
the -ss option.
    - Unfortunately for me--the -ss option does not seem to work quickly,
and so attempts to run through every frame before reaching the correct
time.  This causes the -ss option to be the bottleneck.  This maybe be an
issue with file itself and not FFmpeg.

2. Apply the "select" filter before "cropdetect".
    - This method is even slower than the previous one.  I'm assuming that
applying the select filter on each frame takes much time.

*I have heard that moving the -ss option around may speed up the
process--but unfortunately on all of the encoded files I am dealing
with--this method does not seem to help.

Does anyone have any advice on how I may be able to run cropdetect faster?
Right now my analysis (using the parallel method) takes about 1 sec per 1
minute.  This can cause problems though--as a 3hour long video will take
about 3 minutes to analyze.

Here is an example of how I am running my cropdetect filter:
ffmpeg -i [input video] -vf
"select='isnan(prev_selected_t)+gte(t-prev_selected_t,1)',cropdetect=24:2:0"
-ss 600 -t 100 -an -y null.mp4

Any help would be greatly appreciated.
Thanks,
Matt Kim


More information about the ffmpeg-user mailing list