How To Properly Install USB Easycap Device In Ubuntu

This article aims to be a more updated and clear instructional on how to install the Easycap video capture device in Ubuntu and it’s variants . Given the price of these capture devices and there relatively good video quality they are fairly popular devices, at an average cost of $10-$15 how can you not pick one up to at least check it out. Until not to recently there wasn’t a great deal of support for the devices and what support and drivers there were weren’t always the greatest for all of the Easycap versions and hardware.

The old driver had bad video quality and compatibility for all hardware types is pretty low and finicky. Additionally you had to use their capture software piped through Mplayer to capture video unless you installed the slightly more finicky kernel patch. And that is what I will be guiding you through now is installing the current stable kernel module you will need to properly install and use your Easycap device in ubuntu.

Description

Linux kernel module driver for the Somagic Easycap capture device.

  • EasyCAP Model DC60, with CVBS, S-VIDEO, AUDIO(L), and AUDIO(R) inputs. The uninitialized device shows in lsusb as “1c88:0007 Somagic, Inc.”. Once initialized, it shows as “1c88:003c Somagic, Inc”.
  • EzCAP USB 2.0, with unlabeled CVBS, S-VIDEO, AUDIO(L), and AUDIO(R) inputs. The device is initialized automatically and shows in lsusb as “1c88:003d Somagic, Inc”.
  • EasyCAP Model 002 (or EasyCAP002), with 1, 2, 3, 4, and unlabeled microphone inputs. The uninitialized device shows in lsusb as “1c88:0007 Somagic, Inc.”. Once initialized, it shows as either “1c88:003e Somagic, Inc” or “1c88:003f Somagic, Inc”.

Identification

Indentify the device before buying

It is hard to identify the chipset of any EasyCAP device before buying because most onlineshops (ebay, amazon) do not mention in the provided technical data the chipset of the device. Example from logilik.de where the chipset is declared

Identify device using installation instructions for Windows
Windows-installer.png

If the chipset is not mentioned in device specifications on the website, one way to figure out the chipset inside the EaysCAP is to read through the installation instructions for Windows (if provided for download).

Screenshots of the windowsinstaller often reveal the devicename.

  • STK1160 EasyCAP is in Windows: (Syntek) STK1160 or STK1150
  • Empia EasyCAP is in Windows: USB 2861 Device or EMP
  • Somagic EasyCAP is in Windows: SM-USB 007 or SMI Grabber Device
  • UTV007 based EasyCAP is in Windows: USBTV007e

Known Easycap devices

 STK1160 EasyCAP

For the stk1160 based EasyCAPs exists another article on this wiki with further information.

It is assumed that the stk1160 based “EasyCAP DC60” ist the “originally” EasyCAP device. This device is sold in different varieties (models) and even under different names like: EzCap, LogiLink, Mumbi, Weltbild, and some more.

Components Used

  • Syntek STK1160 (USB video bridge)
  • Silan SC8113 or GM7113 (Philips SAA7113 compatible video decoder)
  • AC’97 audio processor (In the 4 inputs model this chip is missing. Audio capturing is done by the STK1160 chips built-in ADC for mono microphone audio recording.)

Indentification

# lsusb
Bus 001 Device 003: ID 05e1:0408 Syntek Semiconductor Co., Ltd STK1160 Video Capture Device

Making it work

STK1160 based devices are supported (video and audio) under Linux by the easycap kernel module (kernel 2.6.38 and later) and further on by the stk1160 kernel module (kernel 3.7). More information on this wiki: Stk1160

Audio support

More information on this wiki: Stk1160#Drivers

 


Empia EasyCAP

The Empia EasyCAP is based on the EM2860 chip from Empia.

Components Used

  • Empia EM2860 (EM2861 ?) (USB video bridge)
  • Silan SC8113 (Philips SAA7113 compatible video decoder)
  • AC’97 audio processor

Indentification

# lsusb
Bus XXX Device XXX: ID eb1a:2861 eMPIA Technology, Inc.

Making it work

EM2860 (EM2861) based devices are supported in Linux by the em28xx kernle module. More information on this wiki: Em28xx_devices

Audio support

The em28xx kernel module should create a Em28xx Audio ALSA soundcard which can be used for sound capturing.

 


 Somagic EasyCAP

The Somagic EasyCAP is based on the SMI-2021 chip from Somagic. It needs a firmware for operation.

Components Used

  • Somagic SMI-2021CBE (USB video bridge)
  • SAA7113 compatible video decoder
  • Cirrus Logic 5340-CZZ audio processor

Indentification

# lsusb
Bus XXX Device XXX: ID 1c88:0007 Somagic, Inc. 
and after loading the firmware
# lsusb
Bus XXX Device XXX: ID 1c88:003c Somagic, Inc. or Bus XXX Device XXX: ID 1c88:003f Somagic, Inc.

Making it work

For SMI-2021 based devices exists a proceeding Linux-driver project: easycap-somagic-linux which this tutorial explains the installation process for Ubuntu. Continue to the installation portion of this instructional

More information on this wiki: Somagic

Audio support

Audio support is provided by the easycap-somagic-linux driver at an unknown stage.


USBTV007 EasyCAP

This EasyCAP is based on a single UTV007 labeled chip.

This device is sold as “USB video capture QS702” from SHENZHEN FUSHICAI ELECTRONIC CO.,LTD

lsusb reports

  • Manufacturer: Fushicai
  • Product: usbtv007

 Components Used

  • Single chip: UTV007 A614231.1 1136L1BK
  • Inscriptions on the board: FSC VIDEO DVR

Indentification

# lsusb Bus XXX Device XXX: ID 1b71:3002

Full lsusb -v

Making it work

Linux kernel driver, enable CONFIG_VIDEO_USBTV: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/media/usb/usbtv

  • From 3.11 (“Linux for Workgroups”) on: Supports NTSC, Composite input
  • From 3.12 : S-Video input, Fixed deinterlacing, Throw corrupted frames away
  • From 3.13 (rc5) : PAL support
  • In works: Controls (brightness, …)

Also, a very experimental (for testing purposes only) userspace driver is available on github: http://github.com/memeruiz/usbtv007

  • Currently doesn’t do anything beyond what kernel driver does
  • Written using Python libusb1 and v4l bindings
  • Requires v4l loopback
  • Could be useful for easy protocol testing, prototypin
Audio support

A work in progress on the audio support can be found at: https://github.com/simon3z/usbtv

Status: tested and working for composite input (48Khz 2ch 16bit).

Work needed

  • Testing and fixing of eventual bugs is very welcome!
  • Audio is currently not supported on the last Linux kernel. Audio is working with the Windows driver (tested on Windows 2000 with the XP driver not on a virtualized computer with a playstation PSX for the video and audio inputs with the software “honestech HD DVR 2.5”).

The Windows driver shipped with the device was for another model. Here’s the correct one: http://v3.sk/~lkundrak/usbtv/usbtv-wxp32.zip

Slides from talk describing setup for reverse-engineering what does the hardware do are available: http://www.slideshare.net/LubomirRintel/usb-reversing

List of known Easycap capture devices  Identify your USB device from this list and continue to the kernel module only installation

 


Somagic-Easycap Installation

Prerequisites

All developement and testing of this driver has been done on a computer running Xubuntu 13.10 but should be no different for any other Ubuntu distribution or version provided you are using Kernel 3.11 or newer. If you are running another distribution, you’ll should visit http://code.google.com/p/easycap-somagic-linux/wiki/BuildingKernelModule and read their installation instructions as they apply to a generic linux in general.

You will of course also need:

  • Kernel 3.11.x
  • Kernel source and headers
  • git
  • gcc/make and friends
  • wget
  • wine
  • mplayer (for testing the device)
  • vcl
  • available hard-disk space for the kernel tree source and headers
  • The firmware for your EasyCap device installed in /lib/firmware
  • Somagic variant of the EasyCAP. To determine that: plug in the EasyCAP, run “lsusb“, and verify “1c88:0007 Somagic, Inc” or “1c88:003f Somagic, Inc“.
  • EasyCAP USB 2.0 Video Adapter with Audio or EasyCAP002 4-Channel USB 2.0 DVR installation CD-ROM.

Somagic-Easycap Getting started

Firstly we will need  to update our packages and download and install the following dependencies

sudo apt-get update

Were first going to download the current kernel header source code.

All of the Ubuntu Kernel source is maintained under git. The source for each release is maintained in its own git repository on kernel.ubuntu.com. To obtain a local copy you can simply git clone the repository for the release you are interested in as shown below.

  • git clone git://kernel.ubuntu.com/ubuntu/ubuntu-<release>.git

For example to obtain the precise tree:

git clone git://kernel.ubuntu.com/ubuntu/ubuntu-precise.git kernel-source
change into the kernel source directory and use the following command to update the drivers for the kernel
git remote add linuxtv git://linuxtv.org/media_tree.git
git remote update    
git checkout -b media-master remotes/linuxtv/master

This will download the whole kernel, and also the media-tree into a directory called “kernel-source” under your current directory.

All commands from here on should be typed while you are in the linux source-tree unless specified otherwise.

If you are already tracking Linus’ kernel-tree, or are using your distribution’s current kernel-tree, you don’t have to download the media-tree, but then you will need up to six additional patches to build the module (These patches should not be necessary after kernel version 3.12)

To determine your kernel version run “uname -r” this should return something like “3.14.0-rc1-custom”

Here we’re going to install the needed dependencies. (The following is meant to be entered as one line)

sudo apt-get install libncurses5-dev fakeroot wget bzip2 libusb-1.0-0 libusb-1.0-0-dev libgcrypt11 libgcrypt11-dev mplayer usbutils libgcrypt11 wine make gcc mplayer git build-essential

sudo apt-get build-dep linux-image-$(uname -r)

Then you will need to download either somagic-easycap-tools_1.1_i386.deb  or somagic-easycap-tools_1.1_amd64.deb and  somagic-easycap_1.1_i386.deb  or somagic-easycap_1.1_amd64.deb  depending on your architecture from the original drivers site because we will need the firmware extractor for the Somagic-EasyCap hardware to work.

Extracting firmware

  1. Please do not ask for or provide links to the copyrighted firmware. If you don’t have your driver CD, you might be able to find the firmware online via a web search.
  2. Using wine, run “Drivers/Setup.exe” (or sometimes “Driver/Setup.exe”), on the EasyCAP installation CD. For the EasyCAP DC60, this should create a file named “Program Files/Common Files/Somagic/SmiUsbGrabber3C/xp/SmiUsbGrabber3C.sys”. For EasyCAP002 this should create a file named either “Program Files/Common Files/Somagic/SmiUsbGrabber3E/xp/SmiUsbGrabber3E.sys” or “Program Files/Common Files/Somagic/SmiUsbGrabber3F/xp/SmiUsbGrabber3F.sys”.
  3. Run “
  4. Run as root “somagic-extract-firmware SmiUsbGrabber.sys”, to create “/lib/firmware/somagic_firmware.bin”.
  5. Depending on whether the installation created SmiUsbGrabber3C.sys or SmiUsbGrabber3D.sysSmiUsbGrabber3E.sys or SmiUsbGrabber3f.sys you will copy /lib/firmware/somagic_firmware.bin to /lib/firmware/smi2021_3f.bin

Testing The EasyCap Device

This test is to ensure the device is functioning properly before continuing to install the kernel module.

  1. Plug in the EasyCAP device.
  2. Run “somagic-init” to initialize the EasyCAP device, which changes its USB id. This step is not necessary for the EzCAP USB 2.0, which is automatically initialized. If there is no output, initialization was successful. However, to manually verify whether initialization was successful, re-run “somagic-init” or check “lsusb” for the new id “1c88:003c Somagic, Inc” (EasyCAP DC60), “1c88:003e Somagic, Inc” (EasyCAP002), or “1c88:003f Somagic, Inc” (EasyCAP002). You can also run “somagic-capture --test-only” and check for a return code of 0 with “echo $?“.
  3. For EzCAP USB 2.0 only, run “modprobe -r usbhid“.
  4. Activate your video source and ensure video is connected, either via CVBS/composite (any device), or S-VIDEO (EasyCAP DC60 or EzCAP USB 2.0). For the EasyCAP002 the correct plug may vary. First try “2”, then “3”.
  5. Choose and run a usage example depending on your input type
    Play PAL video from CVBS/composite input
    somagic-capture | mplayer -vf yadif,screenshot -demuxer rawvideo -rawvideo “pal:format=uyvy:fps=25” -aspect 4:3 –
    Play NTSC video from S-VIDEO input
    somagic-capture -n | mplayer -vf yadif,screenshot -demuxer rawvideo -rawvideo “ntsc:format=uyvy:fps=30000/1001” -aspect 4:3 –


    Installing Somagic Easycap Kernel Module Only

    Add supporting modules

    The smi2021 driver is depending on the saa7115 module.  Some changes had to be made to that module to make the driver work. We will have to download and install 3 or 6 more patches before we can build the kernel Module.

    From here we will change to our kernel headers directory to download the updated saa7115 module and patches

    cd /usr/src/linux-headers-$(uname -r)    (or where ever you have downloaded your kernels headers and source)

    Download the patch with the smi2021 driver module

    sudo wget –no-check-certificate https://patchwork.linuxtv.org/patch/20010/mbox/ -O smi2021v3.patch

    git checkout -b smi2021v3
    git am smi2021v3.patch

    If your kernel-tree is older than 3.11, you will first need these three patches.

    sudo wget –no-check-certificate https://patchwork.linuxtv.org/patch/18233/mbox/ -O saa7115-0001.patch
    sudo wget –no-check-certificate https://patchwork.linuxtv.org/patch/18232/mbox/ -O saa7115-0002.patch
    sudo wget –no-check-certificate https://patchwork.linuxtv.org/patch/18368/mbox/ -O saa7115-0003.patch

    If your kernel-tree is older than 3.12 – and you didn’t download the media-master tree – you will need these three patches.

    sudo wget –no-check-certificate https://patchwork.linuxtv.org/patch/19535/mbox/ -O saa7115-0004.patch
    sudo wget –no-check-certificate https://patchwork.linuxtv.org/patch/19536/mbox/ -O saa7115-0005.patch
    sudo wget –no-check-certificate https://patchwork.linuxtv.org/patch/19537/mbox/ -O saa7115-0006.patch

  6. When you have downloaded the needed patches we need to apply them. This will count the patch files in the saa7115 patch files and apply them all.
  7. git am saa7115-000*

    Compile smi2021 module only

    This is how you just compile the module, without having to compile the whole kernel. If your kernel is older than 3.11 continue to the “Compiling Kernel” section.

    This will only work if the kernel source-tree is the same version as the kernel you are currently running

    First you will need to patch your kernel tree with the smi2021v3.patch, and the three or six saa7115 patches as described above.

    Then you will have to build both the saa7115 module and the smi2021 module. These commands are typed when you are in the root of the kernel-source tree.

    make M=drivers/media/i2c modules
    make M=drivers/media/usb/smi2021 modules

    Then we install the modules.

    sudo /sbin/insmod drivers/media/i2c/saa7115.ko
    sudo /sbin/insmod drivers/media/usb/smi2021/smi2021.ko

    If you get errors about missing symbols when trying to insmod the saa7115 module, this is probably because the saa7115 module needs some other modules that aren’t loaded yet. We can force them to be loaded if do this before the insmod saa7115 command:

    sudo /sbin/modprobe saa7115
    sudo /sbin/rmmod saa7115

    You should now be able to insert your EasyCap, and you will see this line in your kernel log:

    smi2021 2-1.1:1.0: Somagic Easy-Cap Video Grabber

Compiling A New Kernel And Modules

change directory to the root of where your kernel headers are located

First, we copy the configuration of your current kernel.

sudo cp /boot/.config$(name -r)* > .config

Then we check that we can compile the smi2021 module

Modifying the configuration

This step can be skipped if no configuration changes are wanted. The build process will use a configuration that is put together from various sub-config files. The simplest way to modify anything here is to run:

chmod a+x debian/scripts/*
chmod a+x debian/scripts/misc/*
fakeroot debian/rules clean fakeroot debian/rules editconfigs

This takes the current configuration for each architecture/flavour supported and calls menuconfig for that. The chmod is needed because the way the source package is created loses the executable bits on the scripts.
Device drivers --->
Multimedia support --->
Media USB Adapters --->

Find the entry called “Somagic SMI2021 USB video/audio capture support“. Check that it’s marked with <M>, if not, press m to mark it as a module or y to compile it into the kernel.

Check the config for other options you would like, exit and save the config.

Building the kernel

Building the kernel is quite easy. Change your working directory to the root of the kernel source tree and then type the following commands:

  • fakeroot debian/rules clean
    fakeroot debian/rules binary-headers binary-generic

 

Now, just wait, and hope you’ve done everything correct (and that I didn’t forget anything).

If the build is successful, a set of three .deb binary package files will be produced in the directory above the build root directory. For example after building a kernel with version “2.6.38-7.37” on an amd64 system, these three .deb packages would be produced:

cd ..
ls *.deb
    linux-headers-2.6.38-7_2.6.38-7.37_all.deb
    linux-headers-2.6.38-7-generic_2.6.38-7.37_amd64.deb
    linux-image-2.6.38-7-generic_2.6.38-7.37_amd64.deb

When the compile ends, and there are no errors, we install the modules.

sudo make modules_install

This should complete in a few minutes, and then we are ready to install the kernel.

Install all packages that were created except the tools-generic package as this sometimes doesn’t have the dependency to properly install. Once that is done you can restart your computer and when it loads up you should see another video device in /dev likely video1

Testing the driver

Insert your device, and type this:

vlc v4l2:///dev/videoX :v4l2-standard= :input-slave=alsa://plughw:X,0

In /dev/videoX, the X is the number of the device, on my computer it’s 1, because my web_cam is 0, but it might be any number.

You can get a list of video devices by typing

ls /dev/video*

You can figure out the value of plughw:X,X by typing:

arecord -l

This should give you a list like this:

**** List of CAPTURE Hardware Devices ****
card 0: MID [HDA Intel MID], device 0: 92HD73C1X5 Analog [92HD73C1X5 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: MID [HDA Intel MID], device 2: 92HD73C1X5 Alt Analog [92HD73C1X5 Alt Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: smi2021Audio [smi2021 Audio], device 0: smi2021 Audio [Somagic smi2021 Capture]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Where you see that card2 is smi2021Audio, so the audio-device is plughw:2,0.

Popular Posts
  • No Popular Post Available