[Ffmpeg-devel] [PATCH] grabbing with V4L

Flavio Pimentel Duarte flaviop
Mon Feb 13 18:35:17 CET 2006


Hi Luca! Hi Michael!

Sorry for the delay, but I've been really busy in the last few weeks.

Just to remember, I am using webcams:
  - Creative Webcam Notebook (driver spca5xx-20060202);
  - Logitech QuickCam PRO 4000 (driver pwc).

I've downloaded the cvs version, and ran with the following arguments:
./ffmpeg -an -vd /dev/video0 -s 320x240 output.mpg
FFmpeg version CVS, Copyright (c) 2000-2004 Fabrice Bellard
   configuration:
   libavutil version: 49.0.0
   libavcodec version: 51.4.0
   libavformat version: 50.2.1
   built on Feb 12 2006 14:14:53, gcc: 3.4.3 (Mandrakelinux 10.2 3.4.3-7mdk)
ioctl(VIDIOC_QUERYCAP): Invalid argument
Could not find video grab device

The mplayer gave the same error message (mplayer tv:// -tv driver=v4l2):
v4l2: ioctl query capabilities failed: Invalid argument
Segmentation fault
But mplayer works with v4l driver.

The main problem is the camera module was implemented using V4L API and 
not V4L2 and that's why I think V4L support can not be just stopped. I 
think this problem is not limited to this module. The pwc module 
probably was implemented with V4L API. I suggest that both V4L and V4L2 
support coexist in ffmpeg, like it does in mplayer.

I am running Linux Mandrakelinux release 10.2 (Limited Edition 2005) for 
i586 kernel 2.6.11-6mdk.

The patch I've sent didn't create a single new line, it only moves some 
image settings initialization to outside the if statement. It was also 
not my idea, I borrowed from mplayer ;)


Fl?vio

PS: I also had to hack configure script to compile ffmpeg with v4l2 
support. The configure test is:
#include <linux/videodev.h>
int dummy = V4L2_PIX_FMT_YUV420;

error msg:
/usr/include/linux/videodev2.h:381: error: field `timestamp' has 
incomplete type

I had to change to:
#include <sys/time.h>
#include <linux/videodev.h>
int dummy = V4L2_PIX_FMT_YUV420;

Luca Abeni wrote:
> Hi Michael,
> 
> On Thu, 2006-02-02 at 15:00 +0100, Michael Niedermayer wrote:
> 
>>Hi
>>
>>On Mon, Jan 09, 2006 at 04:45:22PM -0200, Flavio Pimentel Duarte wrote:
>>
>>>I have reported that capturing movies with ffmpeg and Creative Notebook 
>>>Webcam produces a very dark movie. Later I saw the same problem with 
>>>Creative NX PRO. I took a look at V4L documentation and at the mplayer 
>>>source code and realized that the problem was some initialization was 
>>>missing or misplaced. I reorganized the code in grab.c to solve the 
>>>problem. The patch is attached.
>>
>>any volunteers for v4l in ffmpeg maintainaence or should we drop it
>>in favor of v4l2?
> 
> Being the one who wrote v4l2.c, I think I have to speak up :)
> I'd like to propose a tradeoff solution: let's leave grab.c coexist with
> v4l2.c for some time as a backup solution (or as the solution for those
> who have not v4l2), removing it only after some time (6 months?).
> 
> About v4l maintainance: I think that if grab.c fails but v4l2.c works,
> people should switch to v4l2 (so, in this case I see fixing grab.c as a
> waste of time).
> 
> So, Flavio, can you test the current CVS, to see if the v4l2 input works
> for you?
> If it works, I think we can leave grab.c as it is.
> If it does not, I'll look at fixing it, and I'll also have a look at
> your grab.c patch and test it.
> 
> 				Luca





More information about the ffmpeg-devel mailing list