2017/01/08

Running the USB EasyCAP Video Capture Device in Ubuntu 16.04

I bought an external USB2 video capture device in order to convert old VHS material to digital and to let the kids play with an old vtech v.smile game console on Linux. The device I ended up was a "Mumbi Video Grabber USB 2.0" from Amazon (e.g. https://www.amazon.de/dp/B0042EZ596/ref=pe_217221_31005211_dp_1). It appears that this device is a clone of the so-called "EasyCAP" device. This chipset is well supported under Linux: https://linuxtv.org/wiki/index.php/Easycap.

Technical details:
$ lsusb
...
Bus 001 Device 008: ID 05e1:0408 Syntek Semiconductor Co., Ltd STK1160 Video Capture Device
Although the video capture function did work out-of-the-box, I had some trouble with grabbing the sound.

I ended up with the following bash script that reliably captures the video AND sound. Just create a shell-script file in your home-directory, add the "execute" permissions and create a launcher that references your script.
#!/bin/bash
amixer -c stk1160mixer sset Line unmute cap 
cvlc -vvv --color --input-slave=alsa://pulse --live-caching=300 \
  --v4l2-standard=PAL  --deinterlace-mode=yadif \
  --video-filter=deinterlace v4l:///dev/video0
Details about this script:
  • by default the sound from the USB device is muted. You have to unmute it with the amixer command or, manually, with the alsamixer interface. See https://linuxtv.org/wiki/index.php/Stk1160#Enable_sound_capture for details. 
  • cvlc runs VLC without the window decorators (menu, etc.). This is handy for having a simple launcher for the kids. Use plain vlc if you don't mind the menus and buttons. 
  • Ubuntu use pulse-audio, so it is important tot use the "pulse" input-slave parameter. I couldn't get other suggested settings like "hw2,0" etc. to work, so stick with "pulse"...
  • You can try to improve the deinterlace-mode. See https://wiki.videolan.org/deinterlacing#VLC_deinterlace_modes for possible values and how they work.
Known issues: 
  • Make sure you configure the video capture device as your sound input device in "Sound Settings":
  • The linuxtv wiki says that the amixer command must only be run once, but I ended up running it always. This doesn't seem to have any bad effects, so I left it in for now.
  • When plugging in the USB stick on a live Ubuntu system, the stk1160mixer is not always present. I had the most reliable operation by plugging in the USB device before booting.
And it all works :




No comments: