Experiences with the easycap DC60 audio and video capture adapter on Linux

This Blog is dedicated to all owners of the STK1160 chip based EasyCAP (or identical) devices, who want to use it under Linux.

Activating audio for the STK1160 device: read the this post

German speaking users: read my article on ubuntuusers.de

The EasyCAP DC60 and its clones are cheap little USB analogue capturing devices which can be used for viewing and recording video under Linux from different sources like VHS tape recorders, satellitereceivers, camcorders ...

Quickstart

Quickstart information 

How to get analogue TV capture devices (v4l2 devices), like the EasyCAP DC60 or any TV-card, Webcam ... (NOT DVB devices !!!) to work quickly on Linux.


When you do not know if your EasyCAP labeled device is supported under Linux read my
Easycap article on the linuxtv.org wiki
before!

It is assumed for this guide that you know how to start and use the terminal and the software/ packagemanager on a Linux desktop. 

What is v4l2 ?
"Video4Linux second version or V4L2 is a video capture application programming interface for Linux. Many USB webcams, TV tuners, and other devices are supported." (Wikipedia)

V4l2 is part of almost all Linux distributions. For capturing video an appropriate v4l2 driver for every capture device (especially for the chip inside the device) is needed. The drivers for all Linux supported devices are in the Linux kernel.

For some new or exotic devices Linux drivers may not exist.

Some drivers (e.g. stk11xx, somagic-easycap) are not yet in the kernel because they are experimental or not fulfilling all requirements for Linux kernel modules. If you have a device which is supported by such a driver, you need to install it by yourself following the instructions of the developer. 


  • GUI programs for testing
    Plug in your device. When your device is supported under Linux (if there is a driver for it in the Linux kernel or if you have installed the driver by yourself) you can test your device with the following programs:
    • The first program I recommend for testing is qv4l2 (V4L2 Test Bench)
      • If you have more than one /dev/videoN on your system, start the program from the commandline: e.g.
        qv4l2 /dev/video1
    • Not so experienced Linux users should try guvcview first.
      Guvcview "provides a GTK interface for capturing and viewing video from devices supported by the linux UVC driver, although it should also work with any v4l2 compatible device." (http://guvcview.sourceforge.net/)

________________________________________________________________________
  • Hardware flash test on the commandline

    Do not plug in the capture device until the system has booted.

    First part:
    To find out how many (if any) /dev/videoN and sound devices (OSS and ALSA) are present without attached capture device, type in the following commands in the terminal:

    1.  ls /dev/video*      Lists all present videodevices
    (You'll have one if there is a builtin webcam, you'll have none if no analogue video device is attached to your system.)
    2.  cat /proc/asound/cards       Lists all present ALSA soundcards

     
    3.  ls /dev/dsp      Check if the OSS soundsystem is supported on your system
    On Ubuntu (since 10.10) and some other newer distros  there is no /dev/dsp anymore because OSS support is entirely disabled.
    Sample output before plugging in the device:
    # ls /dev/video*
    ls: Zugriff auf /dev/video* nicht möglich: Datei oder Verzeichnis nicht gefunden
    # cat /proc/asound/cards
     0 [Intel          ]: HDA-Intel - HDA Intel
                          HDA Intel at 0xf0580000 irq 42
    # ls /dev/dsp
    ls: Zugriff auf /dev/dsp nicht möglich: Datei oder Verzeichnis nicht gefunden
    Second part:
    After plugging in the capture device, repeat the first and second command.
    If after ~10 seconds a new /dev/videoN and an additional ALSA soundcard (if the capture device supports sound capturing) is present, your card should work under Linux.
    Sample output after plugging in the device:
    #  ls /dev/video*
    /dev/video0
    # cat /proc/asound/cards
     0 [Intel          ]: HDA-Intel - HDA Intel
                          HDA Intel at 0xf0580000 irq 42
     1 [Controlle      ]: USB-Audio - USB 2.0 Video Capture Controlle
                          Syntek Semiconductor USB 2.0 Video Capture Controlle at usb-0000:00:1d.7-2, hig
     2 [stk1160mixer   ]: stk1160 - stk1160-mixer
                          stk1160 ac97 codec mixer control

    If the new /dev/videoN is not accessible by a normal user, type in the following command in the terminal as root (with sudo):
    chmod a+rw /dev/videoN (N must be changed to the actual number of your device)

    If you want to find out more about the driver of your capture device, run the command
    dmesg in the terminal.

  • Device nodes and input numbers
    Normally the linux kernel module creates only one /dev/videoN for each analogue capture device (e.g. TV-card, Webcam, ...).
    If there are several inputs on the capture device (e.g. Antenna, Composite, S-Video ...), they are numbered: 0, 1, 2 ... and must be specified as 'input' in the viewing/ capturing program in combination with the /dev/videoN realated to the card
    Example for mplayer (without sound, alter the highlighted parts according to your device and source):
    mplayer tv:// -tv driver=v4l2:width=720:height=576:outfmt=uyvy:norm=PAL:device=/dev/video0:input=1:fps=25 -vo sdl -nosound
     
  • Sounddevice
    If the capture device is capable of capturing sound and video at once, the sound either comes from /dev/dsp (OSS - now obsolete on some Linux distros like Ubuntu), or from an additional ALSA soundcard which is created by the driver (see the sample ALSA soundcard list above).
    In the capture programs the ALSA soundcard must be specified by its number or ALSA name.
    Notation of the second ALSA soundcard from the listing above:
    • in Mplayer/ mencoder: hw.1 or hw.Controlle
    • in Vlc: hw:1 or hw:Controlle
    • in Avconv: hw:1 or hw:Controlle
  • Setting up the viewing/ capturing program
    In general, the videodevice, the input number, the TV norm and the sounddevice must be specified in the program.
    So, you "simply" have to find out, how to do this in your favourite program.

    Continue reading on the Command Line TV and GUI TV pages.

  • Programs for viewing and capturing

16 comments:

  1. Hello! I am trying to get my EasyCAP set up like you have stated here on an Ubuntu 11.10 desktop. I have it plugged directly into the usb port on the front. I am having trouble with even the most basic step one of your guide.
    1. ls /dev/dsp
    2. ls /dev/video*
    Both of these commands produce this error:

    ls: cannot access /dev/dsp: No such file or directory

    I have checked through the filesystem and I don't have a dsp or video folder in dev. Should I look somewhere else? When I open tvtime is says "no suck file or directory, cannot open capture device dev/viedo0.

    I am not new to linux, but I am very new to going this in depth to get something to work. I usually can get by with the package manager. Any help would be appreciated!

    ReplyDelete
    Replies
    1. Hi,
      there is no /dev/dsp on your system because in Ubuntu OSS is entirely disabled in favour of ALSA (I have to point this out in this guide more clearer).
      If you have no /dev/video0 on your system obviously the driver does not recognice your device. Maybe your EasyCAP is not a DC 60 type and therefore not supported by the driver (read through the Devices page to learn more).

      You can publish here (or send me per e-mail) the output of two commands (below) in the terminal, so i can see what happens after plugging in your EasyCAP:
      Plug in your EasyCAP when the system has booted, wait some seconds and fire up these commands:

      dmesg | tail -n 40

      usb-devices

      then copy the whole output and post it here or in an e-mail.

      Regards
      Andrew

      Delete
  2. Here result from:
    dmesg | tail -n 40
    usb-devices

    But in /dev i cant find any /dev/video

    Thanks


    root@Vm:/# dmesg | tail -n 40
    [ 3681.213409] sr 1:0:0:0: [sr0] Sense Key : Medium Error [current]
    [ 3681.213414] sr 1:0:0:0: [sr0] Add. Sense: Unrecovered read error
    [ 3681.213420] sr 1:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 45 cb 00 00 02 00
    [ 3681.213432] end_request: I/O error, dev sr0, sector 71468
    [ 3681.216274] sr 1:0:0:0: [sr0] Unhandled sense code
    [ 3681.216277] sr 1:0:0:0: [sr0] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
    [ 3681.216282] sr 1:0:0:0: [sr0] Sense Key : Medium Error [current]
    [ 3681.216288] sr 1:0:0:0: [sr0] Add. Sense: Unrecovered read error
    [ 3681.216293] sr 1:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 48 55 00 00 01 00
    [ 3681.216306] end_request: I/O error, dev sr0, sector 74068
    [ 3681.219361] sr 1:0:0:0: [sr0] Unhandled sense code
    [ 3681.219365] sr 1:0:0:0: [sr0] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
    [ 3681.219370] sr 1:0:0:0: [sr0] Sense Key : Medium Error [current]
    [ 3681.219375] sr 1:0:0:0: [sr0] Add. Sense: Unrecovered read error
    [ 3681.219381] sr 1:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 45 cb 00 00 02 00
    [ 3681.219394] end_request: I/O error, dev sr0, sector 71468
    [ 3681.225291] sr 1:0:0:0: [sr0] Unhandled sense code
    [ 3681.225295] sr 1:0:0:0: [sr0] Result: hostbyte=DID_OK driverbyte=DRIVER_SENSE
    [ 3681.225301] sr 1:0:0:0: [sr0] Sense Key : Medium Error [current]
    [ 3681.225307] sr 1:0:0:0: [sr0] Add. Sense: Unrecovered read error
    [ 3681.225314] sr 1:0:0:0: [sr0] CDB: Read(10): 28 00 00 00 45 cb 00 00 02 00
    [ 3681.225327] end_request: I/O error, dev sr0, sector 71468
    [ 3796.149431] VFS: busy inodes on changed media or resized disk sr0
    [ 3888.548029] usb 1-4: new high-speed USB device number 9 using ehci_hcd
    [ 3888.686121] Initializing USB Mass Storage driver...
    [ 3888.686269] scsi2 : usb-storage 1-4:1.0
    [ 3888.686386] usbcore: registered new interface driver usb-storage
    [ 3888.686388] USB Mass Storage support registered.
    [ 3889.684890] scsi 2:0:0:0: Direct-Access USB2.0 Disk 0.00 PQ: 0 ANSI: 4
    [ 3889.685722] sd 2:0:0:0: Attached scsi generic sg2 type 0
    [ 3889.687996] sd 2:0:0:0: [sdb] 7822336 512-byte logical blocks: (4.00 GB/3.72 GiB)
    [ 3889.688738] sd 2:0:0:0: [sdb] Write Protect is off
    [ 3889.688743] sd 2:0:0:0: [sdb] Mode Sense: 23 00 00 00
    [ 3889.689490] sd 2:0:0:0: [sdb] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
    [ 3889.695062] sdb: sdb1
    [ 3889.714112] sd 2:0:0:0: [sdb] Attached SCSI removable disk
    [ 3908.020268] WARNING! power/level is deprecated; use power/control instead
    [ 3908.100468] usb 1-4: USB disconnect, device number 9
    [ 5966.316843] usb 1-3: USB disconnect, device number 8
    [ 5966.592034] usb 1-3: new high-speed USB device number 10 using ehci_hcd

    ReplyDelete
  3. root@Vm:/# usb-devices

    T: Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=480 MxCh= 8
    D: Ver= 2.00 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
    P: Vendor=1d6b ProdID=0002 Rev=03.02
    S: Manufacturer=Linux 3.2.0-24-generic-pae ehci_hcd
    S: Product=EHCI Host Controller
    S: SerialNumber=0000:00:1d.7
    C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
    I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub

    T: Bus=01 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#= 10 Spd=480 MxCh= 0
    D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
    P: Vendor=1c88 ProdID=003c Rev=01.00
    S: Manufacturer= Somagic, Inc.
    S: Product=SMI Grabber DEV
    S: SerialNumber=SMIGRABBER9876543210
    C: #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=500mA
    I: If#= 0 Alt= 0 #EPs= 0 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)

    T: Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
    D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
    P: Vendor=1d6b ProdID=0001 Rev=03.02
    S: Manufacturer=Linux 3.2.0-24-generic-pae uhci_hcd
    S: Product=UHCI Host Controller
    S: SerialNumber=0000:00:1d.0
    C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
    I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub

    T: Bus=03 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
    D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
    P: Vendor=1d6b ProdID=0001 Rev=03.02
    S: Manufacturer=Linux 3.2.0-24-generic-pae uhci_hcd
    S: Product=UHCI Host Controller
    S: SerialNumber=0000:00:1d.1
    C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
    I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub

    T: Bus=04 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
    D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
    P: Vendor=1d6b ProdID=0001 Rev=03.02
    S: Manufacturer=Linux 3.2.0-24-generic-pae uhci_hcd
    S: Product=UHCI Host Controller
    S: SerialNumber=0000:00:1d.2
    C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
    I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub

    T: Bus=05 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#= 1 Spd=12 MxCh= 2
    D: Ver= 1.10 Cls=09(hub ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1
    P: Vendor=1d6b ProdID=0001 Rev=03.02
    S: Manufacturer=Linux 3.2.0-24-generic-pae uhci_hcd
    S: Product=UHCI Host Controller
    S: SerialNumber=0000:00:1d.3
    C: #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=0mA
    I: If#= 0 Alt= 0 #EPs= 1 Cls=09(hub ) Sub=00 Prot=00 Driver=hub
    root@Vm:/#

    ReplyDelete
    Replies
    1. Hi rioarie,
      you have got the Easycap model with somagic chip, which is not supported by the easycapdriver.
      Luckily there is a new driver project for this device with somagic chip:
      http://code.google.com/p/easycap-somagic-linux/wiki/GettingStarted
      Hope you are succesful
      Andrew

      Delete
  4. Please help me, I've /dev/video1, lsusb show me my card Semiconductor... But still having problem to see picture...

    ReplyDelete
  5. Hi Denys,
    please run the following command directly (~ 10 seconds) after plugging in your EasyCAP on the commandline and post the outputfile (easycaplog.txt), which is create in your home directory, here (or send it to me per mail - you find my adress in my profile):

    uname -a >> easycaplog.txt; usb-devices >> easycaplog.txt; dmesg | tail -n 60 >> easycaplog.txt

    Andrew

    ReplyDelete
  6. not sure if the last comment posted..

    but anyways, ill repeat just in case

    when mplayer starts, it shows a green screen, and then changes to some static, and then finally shows vertical greyscale bars and it doesn't show further video.

    help?

    ReplyDelete
    Replies
    1. Hi, I need more information about your system:
      What Linux distribution (which kernel version) do you use, do you have an Easycap grabber, which one?

      The greyscale bars indicate, that your grabber uses the legacy easycap driver but there is no appropriate video signal.

      Andrew

      Delete
    2. thank you for the quick reply, wow!

      Okay so I am running a raspbmc on a raspberry pi.
      I am trying to adapt the ambilight system I created following tutorials like this (http://blog.jokielowie.com/2014/02/efekt-swietlny-dla-media-playera-operatego-o-raspberty-pi/?lang=en) so that I can run other HDMI sources through hyperion following this tutorial: http://bite-in.com/?p=9

      Delete
    3. the only difference is that I am using the analog inputs and the S-Video on the grabber to hook up to the HDMI/AV converter.. could that be an issue?

      Delete
    4. You was lucky because you posted your comment just before I checked my inbox this morning;-)

      Here is a first suggestion: The grabber can only capture from one input at a time (CVBS or! S-Video), if your signal goes to the S-Video input you must change the input number in the mplayer command to 4 (input=4: as described above in the paragraph "Device nodes and input numbers").

      Please run dmesg on the commandline and find out if your grabber uses the easycap or the stk1160 driver:
      either
      dmesg | grep easycap
      or
      dmesg | grep stk1160
      should give you some messages

      Andrew


      Delete
    5. I believe I have the easycap driver. is that a problem?

      Delete
    6. also this is my command line:

      mplayer tv:// -tv driver=v4l2:norm=NTSC:width=720:height=576:outfmt=uyvy:device=/dev/video0:input=0:fps=25: -nosound -vf pp=lb -aspect 16:9 -ao sdl -vo sdl

      ive changed the inputs around and till the same greyscale bars :(

      Delete
    7. No the easycapdriver is not a problem, it is known to work well on the RPI.

      It's hard to say whats going wrong because the driver seems to work (greyscale bars). Is the /dev/video0 number right, do you have any other v4l2 device (webcam) plugged into your RPI?
      Since I do not own an RPI personally I do not know all the RPI related pitfalls.
      I found a discussion which may help you out:
      https://github.com/tvdzwan/hyperion/issues/35
      Maybe a powered hub, downscaling, changing the norm and reducing the framerate can help solving your problem.

      Andrew

      Delete
  7. Hi. I tried to capture the Wii output, but I just saw a green screen in MPlayer. Is there an error or is my EasyCap broken? Thanks.
    *Sorry for bad english, because I'm german*

    ReplyDelete

Please be patient, your comment will be published as soon as I'm checking my mailbox next time.
So, I will notice your comment for sure. Andrew