4

I want to share the webcam (Logitech Quickcam Pro 9000) picture with more than one application at the same time.

I've looked around the net. Here's what I found: - webcamstudio: The newest java tar-gz version does not even show the webcam picture - v4l2loopback: The AFAIK most interesting approach. However, I seem to need mjpegtools_yuv_to_v4l. As I'm unable to compile it on LUbuntu 12.10, I installed Intrepid in a VM and compiled it there.

ffmpeg -f video4linux2 -i /dev/video0 -s 1280x1024 -r 5 -pix_fmt yuv420p -sws_flags lanczos -s 160x120 -r 5 -f yuv4mpegpipe -an - | ./mjpegtools_yuv_to_v4l /dev/video1

leads to

   Input #0, video4linux2, from '/dev/video0':
   Duration: N/A, start: 303506.618990, bitrate: 147456 kb/s
   Stream #0.0: Video: rawvideo, yuyv422, 640x480, 147456 kb/s, 30 tbr, 1000k tbn, 30 tbc
   [buffer @ 0x1659200] w:640 h:480 pixfmt:yuyv422
   [scale @ 0x1658860] w:640 h:480 fmt:yuyv422 -> w:160 h:120 fmt:yuv420p flags:0x200
   Output #0, yuv4mpegpipe, to 'pipe:':
   Metadata:
   encoder         : Lavf53.21.1
   Stream #0.0: Video: rawvideo, yuv420p, 160x120, q=2-31, 200 kb/s, 90k tbn, 5 tbc
   Stream mapping:
   Stream #0.0 -> #0.0
   Press ctrl-c to stop encoding

mjpegtools_yuv_to_v4l: ioctl (VIDIOCGCAP): Inappropriate ioctl for device mjpegtools_yuv_to_v4l: Starting video stream. mjpegtools_yuv_to_v4l: Error writing to pipe, aborting.

Sometimes, these error messages do not appear, but the prompt is returning immediately, althrough I can confirm that ffmpeg is sending some data through the pipe.

In short: I can't get it to work. Am I using the loopback driver wrong? I couldn't find anything helpful on how to use the driver, esp. how to feed it with input.

Thank you very much :)

Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83

1 Answers1

0

Blue cast problem

Well, I got it partly to work. However, I've got a blue cast. This may be because of wrong pixel formats - am I right? If someone has a suggestion on how to fix this, I would be thankful :).

Here is what I've done:

compiled from https://github.com/umlaeute/v4l2loopback/tree/master/examples

sudo modprobe v4l2loopback

mkfifo pipe

./yuv4mpeg_to_v4l2-v1 /dev/video1 < pipe
mplayer tv:// -tv driver=v4l2:input=1:width=640:height=480:device=/dev/video0 -vo yuv4mpeg:file=pipe

Test via

mplayer tv:// -tv device=/dev/video1

Skype does work via

LD_PRELOAD=/usr/lib/i386-linux-gnu/libv4l/v4l1compat.so /usr/bin/skype