Extracting "one of every 10 frames" in a video using VLC or FFmpeg
Solution 1:
Select 1 frame out of every 10 frames
You can use the select
video filter in ffmpeg
to do this:
ffmpeg -i input.mov -vf "select=not(mod(n\,10))" -vsync vfr -q:v 2 img_%03d.jpg
For JPG output you can vary quality with
-q:v
. Effective range is 2 (best quality) to 31 (worst quality). You don't need this option if you want to output to PNG instead.This will output
img_001.jpg
,img_002.jpg
,img_003.jpg
, etc.
Solution 2:
The most important aspect in your question is the fact that the video uses 29.97 frames per second, not 30. Pesky NTSC.
Anyway, I think it would be easiest to just extract every frame, and then remove the ones you don't need:
ffmpeg -i 1.mov -y -f image2 -c:v mjpeg %03d.jpg
Then, remove the ones you don't need. Since every tenth frame will end with a 1.jpg
, we can just take all the others …
find . -maxdepth 1 -not -iname "*1.jpg"
… and once you're sure these are the ones you want to remove:
find . -maxdepth 1 -not -iname "*1.jpg" -exec rm '{}' \;
If you can use mencoder
, you could try the framestep
option, as explained in the documentation, like framestep=10
in your case. I personally couldn't install/try it though.