[FFmpeg-user] Newbie question: Can FFMPEG grab frames from webcam?

James Lu luj125 at gmail.com
Tue Aug 16 17:37:12 CEST 2011


On Tue, Aug 16, 2011 at 9:10 AM, Eric Hollis <eric.hollis at gmail.com> wrote:

> Hello.  Looking for some guidance. Thanks in advance for your time...
>
> I currently use ffmpeg to assemble still images into movies.  I have
> developed a 16mm film scanner, based on a projector, that gathers frames,
> similar to this project, which was the inspiration to my machine.  (
> http://hackaday.com/2011/01/15/converting-8mm-film-to-digital/) I am using
> a
> webcam (Microsoft LifeCam) in front of the projector lens. As each frame
> advances, the projector "clicks" an embedded mouse, taking a high res jpg
> image, utilizing the (gag) Microsoft lifecam software that the camera came
> with.  I then use irfanview to crop/flip/renumber the images, and ffmpeg to
> assemble them into the movie. The trouble is...the Microsoft Lifecam
> Software has a memory leak, and after about 5000 frames (about 2 hours),
> the
> software chokes.  So, I'm rethinking the workflow.  Can FFMPEG be used to
> grab frames from a webcam with a mouse click?
>
> Thanks for any hints you can provide.
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>

Hey Eric,

Assuming video for windows drivers, some research turns up a few bits of
commands that may work. I have no experience in this, but here's something I
would try running:

ffmpeg -f vfwcap -i 0 -vcodec mjpeg -vf 1 -an output.jpg

0 is the default device, captured from vfw driver. I think this should give
you a jpg of the image currently seen by the webcam. -vf 1 will make sure
ffmpeg will only process for 1 frame.

As for "running on a click" you can set up a batch script that increments
the file name in a loop, and have a pause after each image capture that is
released into the loop again when you 'press any key to continue'

Hope this helps.

~James


More information about the ffmpeg-user mailing list