Extract Video Frames In Python
ffmpeg is complaining about there being a missing %d
in the filename because you've asked it to convert multiple frames.
This post suggests this would be a better way of using ffmpeg to extract single frames
ffmpeg -i n.wmv -ss 00:00:20 -t 00:00:1 -s 320×240 -r 1 -f singlejpeg myframe.jpg
[edit]
After a bit more research, here is a command line which works outputing single png frames
ffmpeg -i test.avi -vcodec png -ss 10 -vframes 1 -an -f rawvideo test.png
Tested on my ubuntu 12.04 laptop
There are ffmpeg python modules are available
ffmpeg: https://code.google.com/p/pyffmpeg/
pyAV: https://github.com/mikeboers/PyAV
import avcontainer = av.open('/path/to/video.mp4')for packet in container.demux(): for frame in packet.decode(): if frame.type == 'video': frame.to_image().save('/path/to/frame-%04d.jpg' % frame.index)