Search code examples
ffmpegimage-extraction

FFMPEG extract every nth frame, and every n+1 frame from a video


I want to extract every nth frame from a video, and the consecutive frame following the nth frame extracted.

Right now I have this to extract every nth frame, but I would like to modify it to extract the consecutive frame too.

"select=not(mod(n\,13)"

I have tried running FFMPEG a second time with a different starting frame index to achieve the same results, however this approach was inefficient and did not work as expected. FFMPEG still counted every frame in the video, instead of from the starting frame.


Solution

  • Use

    "select=not(mod(n\,13)*mod(n-1\,13))"