1

I need to extract highest quality frames from a video. I'll be using ffmpeg this way:

ffmpeg -i source_vid.mp4 -ss 15:10.123 -to 15:11.249 frames/frame_%03d.png

My questions:

  1. Will ffmpeg automatically find a 'proper' frame w.r.t. the -ss time, or will it 'interpolate' between two frames if the -ss time doesn't fall accurately on the timing of a frame?
  2. If the answer to the above question is 'interpolate', how do I ensure that I get the exact 'proper' frame instead of an 'interpolated' frame?

(I apologize if the terms I used are not accurate or correct; feel free to correct my terminologies)

Thank you!

3

Since you have specified ss and to as output options, FFmpeg will generate all frames from beginning of file but discard them till start position is attained. Move those options to before the input.

ffmpeg -ss 15:10.123 -to 15:11.249 -i source_vid.mp4 frames/frame_%03d.png

FFmpeg won't interpolate unless a filter is specified.

For precise frame extraction by index, use

ffmpeg -i source_vid.mp4 -vf trim=start_frame=n:end_frame=m frames/frame_%03d.png
| improve this answer | |
  • I thought only ss as input switch made it decode all frames... – jiggunjer Jan 10 '16 at 23:33
  • When using ss as output switch, it can only check the timestamp after the output frame has been generated, so the input frame has been decoded and encoded to output format before ffmpeg can evaluate whether to keep it or discard. – Gyan Jan 11 '16 at 6:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.