Video4Linux Loopback Device

Original author: JeroenVreeken

Uploaded to TWiki first time by KennethLavrsen

Introduction

The video4linux device is a driver that implements a video pipe using two video4linux devices

Jeroen Vreeken wrote this driver for debugging motion realtime, which worked very nice and he decided to make something usefull of it. You can use this driver for looking at motion in realtime or for feeding a webcam while still securing your room.

Note also that vloopback output can be used by several applications at the same time (see below)

Detailed Description

The video4linux device is no longer actively being maintained. But since there is still some demand for it and still some people that make small patches for it the new Motion maintainers decided to gather these patches in a new release. If you need support do not ask the current motion maintainers. Instead join the motion mailing list where there is a reasonable chance to find help.

The following applications supports piping a video feed to vloopback:

These applications that can read the output of vloopback:

  • setv4l (Jeroen's program for changing the settings of a video device)
  • vidcat (part of the w3cam package)
  • camstream (a nice video viewer).
  • Xawtv also works, but you might have to tell it the size e.g. 'xawtv -c /dev/videoN -geometry 176x144'.
  • EffecTV An amazing real-time video effector.
  • Motion (feeding a second motion process the output of the first gives neat effects)

How to use multiple webcam applications with vloopback

1) A simple example (all applications use the same resolution) Do "modproble vloopback" then "resize /dev/video0 /dev/video1 320x240 320x240". Now, you can run as many webcam applications as you want with input as /dev/video2 (however you might have to tell your application the picture size, see below).

Of course, you may think resizing the scale from 320x240 to the same size is silly. Yes, it is, you can edit the source of invert.c (it suffices to remove one sign) to write a program that simply sends the stream from /dev/video0 to /dev/video1 if you prefer.

2) A more complicated example (applications using different resolutions) Do "modprobe vloopback pipes=2". Then "resize /dev/video0 /dev/video1 640x480 640x480 & resize /dev/video2 /dev/video3 640x480 320x240". (Assuming that you have only one real video device at /dev/video0. You can check with dmesg).

Now, you can watch your webcam with camstream at 640x480 (choose the device called vloopback0 output in camstream's menu, which is /dev/video2), at the sime time you can record a video of your webcam stream at 320x240 by doing "ffmpeg -vd /dev/video4 -s 320x240 picture.mpeg", you can at the same time run a webcam http server by running "camsource" (after editting camsource.conf to choose /dev/video2 or /dev/video4 as v4l_input source).

N.B. You can't use camorama with vloopback, as far as I know, camorama looks for inputs from /dev/video0. You should also not open two "view"s in the same instance of camstream. However, opening multiple instances of camsource doesn't cause a problem.

Attached Files

Attached are the recent versions of the vloopback.

Kernel 2.6

  • svn trunk for kernel version >= 2.6.32
  • vloopback-1.3.tar.gz : New stable version tested with stable version 2.6.31
  • vloopback-1.2.tar.gz : New stable version tested with stable version 2.6.28
  • vloopback-1.1.tar.gz : New stable version tested with stable version 2.6.24
  • vloopback-1.0.tar.gz : old stable version with some more fixes and allow build a kernel module in debian way and fixes problems to compile in Suse. If you want to make it work with motion , use motion-3.2.6 or above. stable for kernel <= 2.6.17
Kernel 2.4
  • vloopback-0.92-snap1.tar.gz: Snaphot release for testing (this is the last version ever to be released for kernel 2.4 and is the 0.91 version with a redhat kernel 2.4.20 fix)
  • vloopback-0.91.tar.gz: Last official release for kernel 2.4. Does not build on 2.6 kernels

Subversion

vloopback now has its own Subversion repository.

http://www.lavrsen.dk/svn/vloopback/trunk/

svn co http://www.lavrsen.dk/svn/vloopback/trunk/ vloopback

Installation

Note that version 1.0 is tested for kernel 2.6.8 and above . There are reports that it does not work well with older 2.6 kernels. Make sure you upgrade your kernel to 2.6.8+.

Just type make and then insmod vloopback.ko.

If you want more pipes use insmod vloopback pipes=N with N between 1 and 16.

If you want to create spare pipes use spares=N.

Type dmesg to see which video devices have been created as input and output.

For example: if you have a camera on /dev/video0 the input pipe will most likely be /dev/video1 and the output on /dev/video2.

e.g. if you want to watch an inverted image of the camera you would start invert with /dev/video0 as its input and /dev/video1 as its output.

Then start a viewing app (such as camstream or xawtv) with as input /dev/video2 and you can see yourself inverted.

Now you can load the module from anywhere with or modprobe.

Users Guide

See the video4linux loopback device API document for detailed information about the use.

FAQ

How to use effecttv with vloopback ?

You have to load your webcam / capture card kernel module , i.ex :

 modprobe pwc mbufs=3 size=vga fps=15

See dmesg output to know the video device used by your device :

pwc: Registered as /dev/video0

Load vloopback device ,

modprobe vloopack

see dmseg output ( same as above )

Loopback 0 registered, input: video1,output: video2

And run effect on this way : effectv -vloopback [input vloopback device] -device [real video device]:

effectv  -vloopback /dev/video1 -device /dev/video0

I got "video_init: double buffer capturing with mmap is not supported. Video initialization failed." when i try to use my webcam with quickcam module.

You need to load this kernel module with parameter compatible=2 :

modprobe quickcam compatible=2

How can i use vloopback to use my firewire cam as a V4L device ?

Load vloopback

  modprobe vloopback

You need to use Coriander and set on services tab V4L

And then you will have a V4L in /dev/video1.

Comments and Bug Reports


If you have comments , problems or bugs please don't post here use the link below :

VideoFourLinuxLoopbackDeviceSupport

Thanks !

-- AngelCarpintero - 11 Sep 2009
Topic attachments
I Attachment Action Size Date Who Comment
2.6.30.diffdiff 2.6.30.diff manage 0.9 K 05 Aug 2009 - 02:54 AngelCarpintero patch to apply in svn trunk to allow build with kernel 2.6.30-*
vloopback-0.91.tar.gzgz vloopback-0.91.tar.gz manage 21.4 K 05 Oct 2004 - 20:40 KennethLavrsen Older release. May still be the best for kernel 2.4.X
vloopback-0.92-snap1.tar.gzgz vloopback-0.92-snap1.tar.gz manage 29.5 K 05 Oct 2004 - 20:38 KennethLavrsen Snaphot release for testing (redhat kernel 2.4.20 fix)
vloopback-1.1.tar.gzgz vloopback-1.1.tar.gz manage 25.8 K 18 May 2008 - 19:26 AngelCarpintero Latest stable tested with kernel 2.6.24
vloopback-1.2.tar.gzgz vloopback-1.2.tar.gz manage 25.4 K 20 Jan 2009 - 12:29 AngelCarpintero new stable for new kernel versions
vloopback-1.3.diffdiff vloopback-1.3.diff manage 2.8 K 17 May 2009 - 15:47 PeterHolik vloopback for kernel >= 2.6.29
vloopback-1.3.tar.gzgz vloopback-1.3.tar.gz manage 25.8 K 26 Nov 2009 - 08:32 AngelCarpintero new stable for new kernel versions 2.6.29 and above
vloopback-1.4.diffdiff vloopback-1.4.diff manage 0.8 K 25 May 2009 - 07:36 PeterHolik  
Topic revision: r165 - 14 Nov 2010, SalsaMan
 
Motion - Video Four Linux Loopback Device
Copyright 1999-2014 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.