You can use the
select filter to select frames that match an expression. If the expression evaluates to a nonzero number or
true, it'll select those frames. For example, if your filter is
-vf select="between(n\, 0\, 7)", it'd select the first eight frames. The frame number is
n, and it starts at zero.
Combining this with the
mod (modulo) operator, you can select the first eight frames of every group of, say, 24 frames, so every second for a video of 24 fps:
ffmpeg -i input.mp4 -vf "select=between(mod(n\, 24)\, 0\, 7), setpts=N/24/TB" output.mp4
setpts filter is needed to adjust the timestamps of the frames so that you don't have gaps in your video.
To get the first eight frames every five seconds, multiply the 24 by 5:
ffmpeg -i input.mp4 -vf "select=between(mod(n\, 120)\, 0\, 7), setpts=N/24/TB" output.mp4
To output everything into PNGs, change the output from
output-%04d.png — you'll get sequentially numbered PNGs.