LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-11-2009, 03:37 PM   #1
iochinome
Member
 
Registered: Mar 2009
Posts: 32

Rep: Reputation: 15
v4l2 webcam program: cannot identify /dev/video


ey guys, so i am trying to develop an application that uses webcameras (in jaunty), so i found this code here, which gives examples:

http://v4l2spec.bytesex.org/spec/capture-example.html

i compiled it on my computer (which has a built in webcam on top that i know works, tested it and it worked in luvcview) and then tried to run it. i get an error message that says:
Cannot identify '/dev/video': 2, No such file or directory

Cannot identify '/dev/video': 2, No such file or directory

i have located the part in the program where this comes from:

static void
open_device (void)
{
struct stat st;

if (-1 == stat (dev_name, &st)) {
/*dev_name is "/dev/video" btw, defined in main*/
fprintf (stderr, "Cannot identify '%s': %d, %s\n",
dev_name, errno, strerror (errno));
exit (EXIT_FAILURE);
}

so what is going on here? i do not have a ton of experience with linux, if you cant tell. thanks, much appreciated!
 
Old 05-11-2009, 08:40 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 77
The problem is that the test program hardcodes the file name into the code. Most likely you have no device node named /dev/video. It might be named /dev/video0 or /dev/bttv.

In the function main() on the first line, this string is hardcoded. You could just as well hardcode the correct name, create functionality to read the name as a command-line argument, or create a symlink /dev/video which points to the real device node.

Edit: it seems the second is already implemented. Just use the command-line switch “-d” followed by the real device name.
 
Old 05-13-2009, 11:06 AM   #3
iochinome
Member
 
Registered: Mar 2009
Posts: 32

Original Poster
Rep: Reputation: 15
oh, okay, i see- that worked! thanks!
so now my next step is taking whatever the camera 'reads' and displaying that on the screen. first off, how do i get a jpeg/other image type out of this program? i have never really done any work with images...

thanks, much appreciated!
 
Old 05-15-2009, 05:00 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 77
Quote:
Originally Posted by iochinome View Post
first off, how do i get a jpeg/other image type out of this program? i have never really done any work with images...
The program you posted requests the device to go into this format state:
Code:
        fmt.type                = V4L2_BUF_TYPE_VIDEO_CAPTURE;
        fmt.fmt.pix.width       = 640; 
        fmt.fmt.pix.height      = 480;
        fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_YUYV;
        fmt.fmt.pix.field       = V4L2_FIELD_INTERLACED;
If you device supports, you might be able to use V4L2_PIX_FMT_JPEG instead. More likely, you will have to use other libraries (e.g., libav and/or libjpeg) to decode the output into whatever format you want.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to capture picture from V4L2 webcam? weiweif Programming 10 08-06-2013 03:17 AM
Any V4L2 webcam software or utilities can be use on embedded??? halloworld Linux - Embedded & Single-board computer 2 04-15-2009 07:33 PM
What is the program/command for switching video devices drivers between v4l and v4l2? tauro_kpo Linux - Software 2 04-06-2009 01:19 PM
webcam not found under /dev/video or /dev/video0/.. superevilspacemonkey Linux - Hardware 1 11-14-2008 03:56 PM
How can I assign a webcam to a specific /dev/video#? windisch Linux - Hardware 5 09-25-2008 07:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:30 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