LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-09-2008, 08:30 PM   #1
hbar
Member
 
Registered: Dec 2007
Location: Canada
Distribution: Debian
Posts: 50

Rep: Reputation: 15
v4l device -- fast capture


I'm trying to acquire images from my webcam in the fastest way possible. I would like to make a program to simply take one frame from the webcam and dump it to a file. There are similar projects around (vgrabbj is one I've been working with), but they are all very slow, taking up to 0.4 seconds to output an image (even when writing to /tmp).

I can use this webcam to stream video at ~20 frames per second, so surely there must be a faster way to get frames from the camera than this?

I don't know very much about video device programming (and I've found it difficult to find relevant documentation online). I've tried looking at the source code from a few different projects but it's so under-commented that I can't understand it at all.

Any help with this problem, useful documentation (I *think* I am looking for v4l) or pointers would be a HUGE help.
 
Old 01-10-2008, 04:36 PM   #2
Four
Member
 
Registered: Aug 2005
Posts: 298

Rep: Reputation: 30
see v4l doc

I think the slow down is writing speed to harddrive. One thing you could do is create a ram disk and see if there is any speed improvements.
 
Old 01-10-2008, 10:15 PM   #3
hbar
Member
 
Registered: Dec 2007
Location: Canada
Distribution: Debian
Posts: 50

Original Poster
Rep: Reputation: 15
Still just as slow writing to ramdisk.

Code:
$ time vgrabbj -i sif -d /dev/video0 > /home/njl/ramdisk/0.jpg
Reading image from /dev/video0
vgrabbj -i sif -d /dev/video0 > /home/njl/ramdisk/0.jpg  0.01s user 0.00s system 2% cpu 0.313 total
The "user" and "system" times are very low for this, but the "total" (actual) time is much higher. Can this be a hint? What is the bottleneck here?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ffmpeg2theora not encoding from v4l device slothpuck Linux - Software 0 12-30-2006 05:02 PM
v4l and device driver mithya Linux - Newbie 1 02-14-2006 04:05 PM
How to read a v4l loopback device? rylan76 Linux - Hardware 0 01-16-2006 01:04 PM
Video Capture with v4l _cjx_ Linux - General 3 08-04-2005 04:25 PM
bttv tuner - Novideo on v4L device bruce1271 Linux - Hardware 3 02-09-2004 09:14 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:21 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration