Difference between revisions of "AVLD - Another Video Loopback Device"

From ElphelWiki
Jump to: navigation, search
(avld-0.13 patches)
 
(14 intermediate revisions by the same user not shown)
Line 2: Line 2:
  
  
With AVLD you can use Elphel cameras for image acquisition in v4l compatible applications, video conferencing, etc
+
With AVLD you can use Elphel cameras for image acquisition in v4l (version 1) compatible applications, video conferencing, etc
  
  
Line 8: Line 8:
  
 
and CPU usage is 'only' 20-25% per core
 
and CPU usage is 'only' 20-25% per core
 
 
I could not test beyond the screen and the specific camera/sensor capabilities :)
 
 
 
== 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;
 
  
  
Line 36: Line 13:
  
  
After loading the AVLD module:
+
After loading the AVLD module, indicating the maximum frame size you will use:
  
 
  modprobe avld width=1440 height=896 fps=0
 
  modprobe avld width=1440 height=896 fps=0
Line 58: Line 35:
  
  
 +
== Helper scripts ==
 +
 +
Note: To run those scripts you must patch avld/video_driver.c and rebuild the module before, using the patches found on the section below.
 +
 +
http://community.elphel.com/files/avld/avldfeed
 +
 +
http://community.elphel.com/files/avld/avldplay
 +
 +
For skype, use avldfeed options WIDTH=640 HEIGHT=480 FPS=25 FORMAT=uyvy DEPTH=24 SCALE=sntsc FILTER=none,
 +
but generally FORMAT (mencoder notation for palette) is bgr24
 +
 +
Usage: avldfeed [ -h ] [ <configuration_file> ] [ <OPTION=value> ... ]
 +
 +
OPTIONS:
 +
 +
      URL=<value>
 +
      DEVICE=<value>
 +
      WIDTH=<value>
 +
      HEIGHT=<value>
 +
      FPS=<-1|0|value>
 +
      FORMAT=<bgr24|uyvy|...> (mencoder notation for v4l PALETTE)
 +
      PALETTE=<RGB24|UYVY|...> (overriden by FORMAT)
 +
      SCALE=<none|qntsc|qpal|ntsc|pal|sntsc|spal>
 +
      FILTER=<none|mencoder_filter_chain>
 +
      DEPTH=<value>
 +
 +
avldfeed send the specified video stream to the avld video device.
 +
 +
Previous parameters are saved in ~/.avldfeed so that you can
 +
run the command again with no parameters or a subset, or with a
 +
configuration file as first command argument (it will
 +
replace ~/.avldfeed)
 +
 +
== avld-0.13 patches ==
 +
 +
 +
http://community.elphel.com/files/avld/avld_0.13-VIDIOCGWIN_null_framesize+skype_compatibility+palette_change+depth_change+more.patch
 +
 +
(apply with "patch -P0 < filename.patch" in the avld sourcecode directory)
 +
 +
 +
Opencv v4l capture initialization method was receiving a null frame size when it was run before watching once the stream with mplayer which is using an alternative initialization method.
 +
 +
 +
I found a patch for skype compatibility on http://doc.ubuntu-fr.org/webcamvirtuelle
 +
 +
 +
And I did add "palette" and "depth" to the list of the avld module expected arguments, it accepts now a v4l palette name or a v4l palette number, as in linux/videodev.h:
 +
 +
v4l palette names:
 +
 +
        0  RGB24 (default)
 +
        1  GREY
 +
        2  HI240
 +
        3  RGB565
 +
        4  RGB24
 +
        5  RGB32
 +
        6  RGB555
 +
        7  YUV422
 +
        8  YUYV
 +
        9  UYVY
 +
        10 YUV420
 +
        11 YUV411
 +
        12 RAW
 +
        13 YUV422P
 +
        14 YUV411P
 +
        15 YUV420P
 +
        16 YUV410P
 +
 +
 +
'''It could break compatibility with applications using an older module version''' since "palette" and "depth" are now mandatory when changing the module parameters. But it avoid scanning twice the video buffer and remove the necessity to reload the module when those parameters must be changed.
 +
 +
Applications that are unaware of avld and aren't changing the avld parameters themselves are not affected.
  
  
 
AVLD homepage: http://allonlinux.free.fr/Projets/AVLD/
 
AVLD homepage: http://allonlinux.free.fr/Projets/AVLD/

Latest revision as of 16:49, 19 September 2008

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


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

After loading the AVLD module, indicating the maximum frame size you will use:

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


Helper scripts

Note: To run those scripts you must patch avld/video_driver.c and rebuild the module before, using the patches found on the section below.

http://community.elphel.com/files/avld/avldfeed

http://community.elphel.com/files/avld/avldplay

For skype, use avldfeed options WIDTH=640 HEIGHT=480 FPS=25 FORMAT=uyvy DEPTH=24 SCALE=sntsc FILTER=none, but generally FORMAT (mencoder notation for palette) is bgr24

Usage: avldfeed [ -h ] [ <configuration_file> ] [ <OPTION=value> ... ]

OPTIONS:

      URL=<value>
      DEVICE=<value>
      WIDTH=<value>
      HEIGHT=<value>
      FPS=<-1|0|value>
      FORMAT=<bgr24|uyvy|...> (mencoder notation for v4l PALETTE)
      PALETTE=<RGB24|UYVY|...> (overriden by FORMAT)
      SCALE=<none|qntsc|qpal|ntsc|pal|sntsc|spal>
      FILTER=<none|mencoder_filter_chain>
      DEPTH=<value>

avldfeed send the specified video stream to the avld video device.

Previous parameters are saved in ~/.avldfeed so that you can
run the command again with no parameters or a subset, or with a
configuration file as first command argument (it will
replace ~/.avldfeed)

avld-0.13 patches

http://community.elphel.com/files/avld/avld_0.13-VIDIOCGWIN_null_framesize+skype_compatibility+palette_change+depth_change+more.patch

(apply with "patch -P0 < filename.patch" in the avld sourcecode directory)


Opencv v4l capture initialization method was receiving a null frame size when it was run before watching once the stream with mplayer which is using an alternative initialization method.


I found a patch for skype compatibility on http://doc.ubuntu-fr.org/webcamvirtuelle


And I did add "palette" and "depth" to the list of the avld module expected arguments, it accepts now a v4l palette name or a v4l palette number, as in linux/videodev.h:

v4l palette names:

       0  RGB24 (default)
       1  GREY
       2  HI240
       3  RGB565
       4  RGB24
       5  RGB32
       6  RGB555
       7  YUV422
       8  YUYV
       9  UYVY
       10 YUV420
       11 YUV411
       12 RAW
       13 YUV422P
       14 YUV411P
       15 YUV420P
       16 YUV410P


It could break compatibility with applications using an older module version since "palette" and "depth" are now mandatory when changing the module parameters. But it avoid scanning twice the video buffer and remove the necessity to reload the module when those parameters must be changed.

Applications that are unaware of avld and aren't changing the avld parameters themselves are not affected.


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