AVLD - Another Video Loopback Device

From ElphelWiki
Revision as of 16:28, 14 September 2008 by Luxigo (talk | contribs)
Jump to: navigation, search

AVLD is a video loopback device for GNU-Linux, written by Pierre Parent and licensed under GPL.


With AVLD you can use Elphel cameras for image acquisition in v4l (version 1) compatible applications, video conferencing, etc


Video is playing smoothly on a 2.4Ghz dual core notebook at 25fps in 1440x896,

and CPU usage is 'only' 20-25% per core


I could not test beyond the screen and the specific camera/sensor capabilities :)


Accessing Elphel camera streams through a v4l device (eg: /dev/video0)

After loading the AVLD module:

modprobe avld width=1440 height=896 fps=0


You just have to feed the video device:

mencoder rtsp://192.168.0.9 -nosound -ovc raw -vf format=bgr24 -of rawvideo -o /dev/video0

(or /dev/video1 if you had already another video device driver loaded before)


And you can play the stream for testing:

mplayer tv:// -tv driver=v4l:device=/dev/video0:outfmt=rgb24 -cache 8192 -vo xv


You can change the device parameters when module is already loaded with:

echo "width=800 height=600 fps=0" > /dev/video0


Using AVLD with Motion

Example:

# note: you must also set the image size in motion.conf

echo "width=768 heigth=576 fps=0 palette=1" > /dev/video1
mencoder rtsp://cam -nosound -ovc raw -vf format=yuy2 -vf scale=::::::spal -of rawvideo -o /dev/video1

## preset sizes: (you can specify "scale=width:height" instead)
# qntsc:   352x240 (NTSC quarter screen)
# qpal:    352x288 (PAL quarter screen)
# ntsc:    720x480 (standard NTSC)
# pal:     720x576 (standard PAL)
# sntsc:   640x480 (square pixel NTSC)
# spal:    768x576 (square pixel PAL)


avld-0.13 VIDIOCGWIN null framesize patch

Opencv v4l capture initialization method was receiving a framesize of 0x0 when it was run before watching once the stream with mplayer which is using an alternative initialization method.

--- video_device.c.orig 2008-09-14 21:28:41.000000000 +0200
+++ video_device.c      2008-09-14 22:00:35.000000000 +0200
@@ -212,7 +212,10 @@
                        #ifdef DEBUG
                                printk (KERNEL_PREFIX "VIDIOCGWIN\n");
                        #endif
-
+
+                       capture_win.width=width;
+                       capture_win.height=height;
+
                        if(copy_to_user((void*)arg, &capture_win, sizeof(capture_win)))
                                return -EFAULT;
                        return 0;


AVLD homepage: http://allonlinux.free.fr/Projets/AVLD/