I'm using FFmpeg to extract images from video, 1 frame every 6 seconds:
Normal command on Dos ( Windows 8 OS) > ffmpeg -i in.mkv -r 1/6 %4d.png
Takes too much time as speed is very low, around 15-20.
So I used skip_frame nokey
ffmpeg -skip_frame nokey -i "in.mkv" -vsync 0 -frame_pts true -r 1/6 %4d.png
This extracts at higher speed, around 200 (ten times faster).
But the problem is it skips many images, and throws error:
application provided invalid, non monotonically increasing dts to muxer in stream
So I used this command:
ffmpeg -i in.mkv -vf "select='if(not(floor(mod(t,6)))*lt(ld(1),1),st(1,1)+st(2,n)+st(3,t));if(eq(ld(1),1)*lt(n,ld(2)+1),1,if(trunc(t-ld(3)),st(1,0)))'" -vsync 0 %4d.png
(Provided here - How to capture first X frames every X seconds into a PNG with FFmpeg?)
This gives me speed of 25-30.
Is there anyway I can achieve higher speed with -skip_frame
?
-skip_frame
, but you don't want it to "skip many images"? That's what you're telling it to do: skip all frames that are not key frames. On top of that you're applying-r 1/6
which modifies the frame rate.