Search code examples
c#videoffmpegframes

Get the specific frame from a video using FFMPEG (C#)


I would like to get every specified frames from a video using ffmpeg. From now i have this code:

"-i example.mp4 -vf fps=30,select='between(t,2,3)' -vsync 0 image%d.bmp"

It generates the frames between the specifies secounds, but i would like to get frames by their number, for example: every 3, frame or every 10. frame.

Is there any way to do that?


Solution

  • Use

    "-i example.mp4 -vf select='not(mod(n,5))' -vsync 0 image%d.bmp"
    

    This will produce every 5th frame (0,5,10,15...)

    (Removed fps filter .. that duplicates or drops frames from source).