Quantcast

Newbie question: Can FFMPEG grab frames from webcam?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Newbie question: Can FFMPEG grab frames from webcam?

Eric Hollis
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
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Newbie question: Can FFMPEG grab frames from webcam?

James Lu
On Tue, Aug 16, 2011 at 9:10 AM, Eric Hollis <[hidden email]> 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
> [hidden email]
> 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
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Newbie question: Can FFMPEG grab frames from webcam?

rogerdpack2
In reply to this post by Eric Hollis
> taking a high res jpg
> image, utilizing the (gag) Microsoft lifecam software that the camera came
> with.

I believe ffmpeg can take input from directshow capture devices

$ ffmpeg -f dshow -i video="USB2.0_Camera":audio="Microphone (USB
Audio Device)" output.mkv

http://betterlogic.com/roger/2011/08/ffmpeg-directshow
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Newbie question: Can FFMPEG grab frames from webcam?

maujhsn
Hi Eric;

I really enjoyed reading your post! there are so many things that
ffmpeg can do that many of us who use it, take for granted.

I have used this command for turning single frames to movies:

ffmpeg -f image2 -i img%03d.jpeg /tmp/a.mpg

However the concept that you have written about & demonsrated is very
interesting!

Thanks,

MJ
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Newbie question: Can FFMPEG grab frames from webcam?

Eric Hollis
Thanks...I'm going to blog the whole project.  I've gotten lots of email
like yours.  surprising the level of intrest.

I'll post a link to the users group when I'm done.

Thanks for the tip, and the encouragment
Eric

On Fri, Aug 19, 2011 at 1:05 PM, maujhsn <[hidden email]> wrote:

> Hi Eric;
>
> I really enjoyed reading your post! there are so many things that
> ffmpeg can do that many of us who use it, take for granted.
>
> I have used this command for turning single frames to movies:
>
> ffmpeg -f image2 -i img%03d.jpeg /tmp/a.mpg
>
> However the concept that you have written about & demonsrated is very
> interesting!
>
> Thanks,
>
> MJ
>  _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
Loading...