Capturing individual frames from a USB webcam at full quality

Share

Here’s the method I’m using to create a set of images from a webcam (at 1920×1080) as reliably as possible.

I’m using a simple 2 step process:

First, I’m capturing from the webcam at a constant bitrate with a rather lossless quality
Duration is set to 15 seconds, writing to capture.mp4, overwriting existing files.

ffmpeg -f video4linux2 -input_format yuyv422 -an -i /dev/video0 -r 30 -c:v libx264 -qp 18 -t 15 capture.mp4 -y

Secondly, I’m simply converting the video clip to png:
ffmpeg -i capture.mp4 image_%04d.png

This gets problematic at this quality though:
My 15 seconds video clip is ~13 MB
The 450 png files total over 1.1 GB

Be careful!

P.S.
The purpose for this is to eventually make animated gifs from a purpose built crank camera similar to Otto

Share