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 :




2017/01/04

Fixing an external USB3 ethernet adapter (Realtek r8152) in Ubuntu 16.04

I have an external USB3 ethernet adapter that wasn't working under Ubuntu 16.04.

Details of the adapter:

$ lsusb
...
Bus 001 Device 012: ID 0bda:8153 Realtek Semiconductor Corp. 
Bus 001 Device 011: ID 2109:2812 VIA Labs, Inc. VL812 Hub

$ lsmod | grep r8152
r8152                  49152  0
mii                    16384  2 r8152,usbnet
Error log:
$ dmesg
...
[ 584.877219] usb 1-2.3.3: reset high-speed USB device number 15 using xhci_hcd
[ 585.017923] r8152 1-2.3.3:1.0 eth0: v1.08.2
[ 586.623086] r8152 1-2.3.3:1.0 enx00e04c...d: renamed from eth0
[ 586.658451] IPv6: ADDRCONF(NETDEV_UP): enx00e04c...d: link is not ready
[ 586.708837] IPv6: ADDRCONF(NETDEV_UP): enx00e04c...d: link is not ready
After some googling, I found that the issue is related to the USB autosuspend feature (https://bugzilla.redhat.com/show_bug.cgi?id=1236679). Luckily, the fix is very easy:
sudo nano /etc/default/tlp
and in this file add the following line:
# Exclude listed devices from USB autosuspend (separate with spaces).
# Use lsusb to get the ids.
# Note: input devices (usbhid) are excluded automatically (see below)
#USB_BLACKLIST="1111:2222 3333:4444"
USB_BLACKLIST="0bda:8153"
After a reboot, the USB3 wired ethernet works just fine:
$ dmesg
...
[ 87.910485] IPv6: ADDRCONF(NETDEV_CHANGE): enx00e04c...d: link becomes ready