SDB:Dvsource-alien howto

Jump to: navigation, search
Icon-cleanup.png
This article is in need of attention because it does not follow our wiki guidelines.
If you want to contribute, please read the rules for this wiki and if you have any questions, don't hesitate to contact the wiki team, we are more then willing to help you! :-)

Download source from [github/jnweiger/dvswitch branch susedevel] Download binaries from [pmbs://home:jnweiger]

dvsource-alien is a extension to dvswitch, written by Jürgen Weigert. It allows to connect the dvswitch system with non-firewire devices. Most of these devices are less expensive or easier to purchase than the typical Canon HV30 or Twinpact 100 that are officially recommended. Currently two device types are supported:

  • V4L2 devices - these devices show up in your system as /dev/video*, they include:
    • USB-Webcams (very useful as a wide angle fallback camera)
    • VGA2USB framegrabber (extremly useful to replace the rare and expensive twinpact 100 device.
    • Composite Video grabbers.
  • Remote webcams - MJPEG streams can be received via stdin or (by the help of curl) from an HTTP-URL.

Most of these devices do not meet the tight video performance requirements of DV-PAL or DV-NTSC. The following issues normal prevent such devices from being used with dvswitch:

  • The framerate is usually low. Less than 25fps (30fps) and not exactly constant over time. This is especially true for remote webcams, which often only produce 10 to 15 frames per second. The framerate may also be (temporarily) higher than the the DV system rate.
  • Latency is high. A significant delay is visible. Often this due to buffers filling up over time.
  • Audio is either not provided, or at the wrong sample rate.

Dvsource-alien fully decouples the device from the dvswitch system, with regards to frame rate, resolution, aspect ratio and audio. Frames are grabbed as fast as the device can produce them, in whatever resolution. As a nice side-effect this effectively prevents buffers from filling up and thus keeps latency surprisingly low. Audio (if present) is ignored, a synthetic silence audio track is provided with the video at exactly 48000hz. (Version 0.6 does not yet support 32000hz sample rate.)

The DV-video data (including audio) is clocked using the high precision timer code from dvsource-file. Note that no temporal interpolation is currently done. Frames are simply dropped or repeated as needed. The video resolution is rescaled to meet the exact frame format of the DV-system. The fast bilinear algorithm from libswscale is used to do this spacial interpolation.

These devices have been successfully tested with dvsource-alien:

Epiphan KVM2USB

This is a very reliable frame grabber. Epiphan provides proprietary [device drivers] also for SUSE Linux. Their support hotline (info@epiphan.com) is very responsive and helpful. Upon request, they provide drivers for special kernel flavors or version (Thank you Pavel, for supporting SUSE Linux.) Raspbian is also supported, see below.

Their v4l2 driver sends video at 1024x768. A few pixels may be missing at the left hand edge of the screen while the right edge adds a small black stripe. We use the following cropping to adjust the image to fit perfectly:

dvsource-alien -c -12:13:1:5 /dev/video0

Note the negative padding with -12, this is permitted only because we sacrifice one pixel from the top so that we stay entirely within the video-memory (immediate segfault otherwise).

Also note the power requirements. KVM2USB has no power supply, but draws a full 1A from the USB port. An Y-cable is recommended. (A RaspberryPI has exceptionally weak USB ports. It might not work at all without an additional power supply unit.)


Logitech C 270

  1. driver: uvcvideo,
  2. device: UVC 1.00 Camera

Black housing, says "HD 720" near the lens. This webcam deliver a resolution of up to 1184x656. Latency seen in dvswitch is ca 300msec. Excellent quality!

Logitech C 110

This webcam delivers a resolution of up to 1024x768, although sharpness improves very little compared to the standard 640x480 resolution which it delivers per default.

These commands make the image darker or duller than normal:

 v4lctl bright 5
 v4lctl contrast 5
 v4l2-ctl -c contrast=30 -c brightness=80

These make it brighter and harder:

 v4lctl bright 15
 v4lctl contrast 15
 v4l2-ctl -c contrast=80 -c brightness=160

The camera can send MJPEG directly. This is feature is used by WiRC, but not (yet?) by dvsource-alien, which currently asks V4L2 for an uncompressed PIC_FMT_RGB24.

Logilink VG0001

This adapter can take analog composite video or Y/C-Video plus a stereo audio. Per default it starts in NTSC-Mode, not sure why. The resolution is 720x480. (Chipset SAA71)

USB ID "05e1:0408", Internal name: Syntek EasyCAP.

Linux drivers: stk1160 saa715 (both needed)

v4lctl setnorm pal
v4lctl setinput S-Video
v4lctl setinput Composite0


Sometimes it fails with errors like

stk1160: cannot alloc 196608 bytes for tx[0] buffer

These commands helped me:

# disconnect usb 
rmmod stk1160
rmmod saa7115
# connect usb
sudo v4lctl setnorm pal
sudo v4lctl setinput S-Video
xawtv

Canon PowerShot SX210

This pocket photo-camera features an analog composite out on its mini-USB port (needs a special canon 6-pin USB cable). The video out contains the overlay from the backpanel LCD and is switched to black when the camera is idle for a while.

dvsource-alien -g 1024 -c 70:115:68:60

can be used to crop away all overlay displays near the edge of the screen. In video-camera mode or in automatic photo mode no overly is visible, unless the user zooms or operates focus. Retracting the lens when idle, switching off when idle can be disabled from the menu. But the longest setting for switching to black when idle is 3 minutes.

Pressing the trigger half-way restarts the 3 minutes timer. Maybe CHDK can be used to circumvent this? The camera is still very useful as an emergency backup as it features a surprisingly long telephoto lens. Due to the limited resolution available after cropping, it is best used as a PIP insert.

GOPRO Hero 3 Black

This camera has analog composite video out on its mini-USB connector. This is not Canon-compatible and needs a special cable. Cannot test.

Wiring diagram for a Do-It-Yourself cable

The extreme wide-angle lense makes it a promising device.

USBVision USB VIDEO ADAPTER

  1. driver: usbvision
  2. device: USBGear USBG-V1
  3. chipset: saa7115

This adapter can take analog Y/C-Video plus a mono audio channel -- a composite in can be modded. The driver offers a maximum of 320x240, and freezes.

v4l-info also freezes.

Not usable.

Android IP Webcam

This app runs smooth on a Samsung Galaxy S2 with its default resolution of 640x480. Higher resolutions are possible, but may take too much bandwidth on the WLAN.

To connect to the app, the smartphone should be in the same WLAN as the computer running dvsource-alien. The screen of the smartphone shows an IP-Address and port number near the bottom. E.g. 149.44.171.12:8080. A webpage is served there, explaining various options how to connect. Firefox works fine. Multiple connections are possible.

As of version 0.6 of dvsource-alien, these commands can be used to connect:

dvsource-alien http://149.44.171.12:8080/video
curl -s http://149.44.171.12:8080/video | dvsource-alien -

The framerate is surprisingly high delivering a smooth and crisp video, if the app is set to "as fast as possible".

This can be used for closeups when the speaker does demonstrations at his desk. The smartphone truly serves as an extremely mobile and lightweighted camera.

Note that the smartphone gets warm when running the IP Webcam app for 10 minutes or more. Battery lifetime may become a concern.

Dension WiRC

WiRC is officially sold as a RC receiver unit to control RC-model cars through your iPhone or Android SmartPhone. Inside WiRC box, an embedded Linux system runs on the 240 MHz ARM CPU. The box features two USB ports, and 8 rc-servo ports, and other I/O.

One USB port receives a USB WLAN stick. Dension recommends and sells a TP-Link WN727N 150Mbps. With this stick, the WiRC creates a WLAN-AccessPoint where your smartphone can connect to.

The other USB port connects a Logitech Logitech C170 webcam, which streams its video back to the smartphone (or elsewhere).

The video is streamed as MJPEG 352 x 288 at 15 FPS. Multiple receivers can be connected simultaneously. E.g. a smartphone controlling the car and dvsource-wirc. Dvsource-wirc is a trivial adaption of the wrc_client from the official SDK sent out from the dension support team.

Note that this trivial version of dvsource-wirc will not start the camera automatically. You have to type two additional commands at the '>' prompt after it started:

dvsource-wirc | dvsource-alien ... -
> connect 0
> camera 0 start

The source code for dvsource-wirc is here

My wirc device is battery powered. For some reason it has problems initializing the camera properly. Maybe the voltage is not stable enough. When dvsource-wirc or a smartphone connect to the device, the green LED on the camera should light up. If not, power-cycle.

Once it initializes the camera, it works perfectly stable. See also http://jorygen.wordpress.com/2012/04/07/wirc-an-inexpensive-fpv-system/

Raspbery PI

This inexpensive Linux host just does not have sufficient compute power to run dvsource-alien. It would need grab VGA frames through epiphan's KVM2USB, encode it as PAL-DV and send it via ethernet to a dvswitch mixer.

Tested with a logitech C110 webcam, and dvsource-alien: We only have 2-3 frames per second. Not good either.

We should rather try an mjpeg streamer approach as e.g. shown in http://wolfpaulus.com/jounal/embedded/raspberrypi_webcam -- that may have better results, so that dvsource-alien (the DV encoder) could run elsewhere.

Raspicam

Untested.

The Raspberry PI Camera board delivers a high resolution image from a fixed focus wide angle lens.

 raspivid -t 999999 -o – | nc ...

could be used to stream the video out as fast as possible. With the excessive resolution (compared to DV format) software pan/tilt/zoom should be permissible. Default size for video recording is 1080p (1920x1080). The camera has a 5MP