[Dmitry Kaflik] “The problem is that if i try to extract frame from the end of file its take a lot of time and i need to get about 100-1000 frames from video file. If i run ffmpeg 100-1000 times its every time going to parse video from the begining to reach pointed time (for example -ss 00:00:45).”
It is all about where you put the -ss flag.
If you put it after the input, FFmpeg reads every frame up until the one you need. (as in your example) AFAIK, this is required if the frame you want to export is not an I frame.
If you put it before the input, such as:
ffmpeg -y -ss 00:00:45 -i akisora.mp4 -an -r 1 -f mjpeg -vcodec mjpeg -vframes 1 “test.jpg”
FFmpeg will only read the frame you specified and thus do the output almost instantly. Unfortunately, you will lose accuracy with this method because for me it only exports the closest I frame. (I have also read reports that for some other users, this method will produce a grey output frame if it is on a P or a B frame.)
[Dmitry Kaflik] “So my question: is there any way to point ffmpeg to the list of frames that i need to extract, so it cat do extraction in one-pass?”
One way which would be fast and accurate, if you are exporting 1000 stills, is simply export the whole movie to stills and keep the ones you need. A simple shell script should be able to achieve this. This way, FFmpeg will only read through the file once and you can delete the unnecessary ones.
Michael