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 ...

Sunday, July 8, 2012

New driver for the EasyCAP DC60 - stk1160

Great news!

Some time ago Ezequiel Garcia informed me:
"I just wanted you to know I've re-worked the old easycap driver
from scratch. Now it's called stk1160, because it's the correct name
for such driver. "
Inbetween the driver has been succesfully tested on Ubuntu 12.04 and Bodhilinux 1.4.0 with kernel 3.2. So it should work even on most systems which have the 3.2.0 kernel.

Although some enhancements have to be done, the driver already can be used as a replacement of the easycapdriver. It is expexted that the driver soon will get into the mainline kernel.

The great improvements compared to the easycapdriver are:
- there is no framedropping anymore
- the snd_usb_audio issue is solved
- the driver loads and registers quicker than the easycapdriver

Installation and usage (tested on Ubuntu 12.04)


Note: Although the driver is tested on Ubuntu, you do the installation at your own risk!

Download the driver from here:
https://github.com/ezequielgarcia/stk1160-standalone/zipball/for_v3.2

Unpack the content into your homedir and open a terminal.

At first we blacklist the easycap module (driver), so it cannot conflict with the new driver.

echo "blacklist easycap" | sudo tee -a /etc/modprobe.d/blacklist.conf 
If you want to reuse the easycap module, simply run
sudo modprobe easycap
or delete the entry
blacklist easycap 
in /etc/modprobe.d/blacklist.conf

Enter the unpacked directory with the driversource inside
cd ezequielgarcia-stk1160-standalone-...(the exact name)
and run
make
sudo make install
sudo depmod -a
With the next command you can check if the module has been correctly installed:
modinfo stk1160

After plugging in the EasyCAP test it with mplayer:
mplayer tv://

Configure sound 


The stk1160 module registers a control-only alsa soundcard. This sound card is called 'stk1160-mixer'.
The real sound capture is done through the 'Controlle' soundcard which is also created after plugging in the EasyCAP.
To get a list of the registerd ALSA soundcards, run the following command:
cat /proc/asound/cards
Sample output:
  0 [Intel          ]: HDA-Intel - HDA Intel
                      HDA Intel at 0xf0580000 irq 43
 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
To enable sound capture you have to open alsamixer when the EasyCAP is plugged in and select the 'Line' item on the capture menu for stk1160-mixer device:
1. start alsamixer
2. select stk1160-mixer sound card (with F6)
3. select capture controls (with F4)
4. select "Line" output (with space key) 

You can do this on the commandline as well with this line:
amixer -c stk1160mixer sset Line unmute cap 

Note! In the viewing- or capturing program you must then select the 'Controlle' soundcard or its number to hear sound!

Reinstallation oft the driver is required after kernel update!

If you have installed a new kernel on your system (or your update-manager did so automatically)  you need to reinstall the stk1160 driver!

 

When you do not want to use the stk1160 driver anymore


Simply blacklist the stk1160 module as described above and revert the blacklisting of the easycap module.


Thanks to Ezequiel for his work and support!

Andrew

31 comments:

  1. Hey, Andrew! My name is Garcia with a "C" :-)

    Just that! I'm glad that everything is working, any problems found
    you can add an issue on github.

    ReplyDelete
    Replies
    1. Sorry Ezequiel! (just corrected) I think we German speaking people are too familiar with a very hard pronunciation ;-)

      Delete
  2. Possible that recent ubuntu upgrade broke the audio. stk1160mixer is not being created. I had the audio working like week ago in one computer and now it does not work anymore. Tested in 2 different machines with ubuntu 12.04


    dmesg tells me
    [ 385.584324] usb 2-2: new high-speed USB device number 4 using ehci_hcd
    [ 385.717477] usb 2-2: New device Syntek Semiconductor USB 2.0 Video Capture Controller @ 480 Mbps (05e1:0408, interface 0, class 0)
    [ 385.717487] usb 2-2: video interface 0 found
    [ 386.044729] saa7115 15-0025: saa7113 found (1f7113d0e100000) @ 0x4a (stk1160)
    [ 386.764433] stk1160: driver ver 0.9.3 successfully loaded
    [ 386.797463] stk1160: registers to NTSC like standard
    [ 386.801497] AC'97 0 access is not valid [0x0], removing mixer.
    [ 386.968669] stk1160 2-2:1.0: V4L2 device registered as video0
    [ 386.990731] usbcore: registered new interface driver snd-usb-audio

    When I execute
    amixer -c stk1160mixer sset Line unmute cap

    I get
    $ amixer -c stk1160mixer sset Line unmute cap
    Invalid card number.
    Usage: amixer [command]

    Available options:
    -h,--help this help
    ......

    ReplyDelete
    Replies
    1. Hi, I cannot reproduce your problem. I'm also using Ubuntu 12.04 with the latest updates (kernel 3.2.0-30-generic-pae at present). The stk1160 driver works as before on my machine.

      When I look through the output of dmesg (see below) I can see that on my machine the snd-usb-audio driver is loaded before the stk1160 driver and on your machine afterwards.

      Therefore, I suppose, the stk1160 driver cannot access the audio part of the STK1160 device and tells us: 'AC'97 0 access is not valid [0x0], removing mixer'.
      Do you have some other USB sound capturing hardware plugged into your machine?

      I really cannot explain this behaviour, but if this persists we can contact Ezquiel, the developer of the driver, for help.

      In this case please send the stk116log.txt created by the following command with all your devices plugged in to me per mail (adress is in my profile).

      uname -a >> stk1160log.txt; usb-devices >> stk1160log.txt; dmesg >> stk1160log.txt

      Regards
      Andrew

      My dmesg output:

      [ 103.008075] usb 1-2: new high-speed USB device number 2 using ehci_hcd
      [ 103.210534] Linux video capture interface: v2.00
      [ 103.214062] usbcore: registered new interface driver snd-usb-audio
      [ 103.219437] usb 1-2: New device Syntek Semiconductor USB 2.0 Video Capture Controller @ 480 Mbps (05e1:0408, interface 0, class 0)
      [ 103.219447] usb 1-2: video interface 0 found
      [ 103.972370] saa7115 14-0025: saa7113 found (1f7113d0e100000) @ 0x4a (stk1160)
      [ 105.508264] stk1160: driver ver 0.9.3 successfully loaded
      [ 105.606113] stk1160: registers to NTSC like standard
      [ 105.928390] stk1160 1-2:1.0: V4L2 device registered as video0
      [ 105.928440] usbcore: registered new interface driver stk1160
      [ 145.007725] stk1160: fourcc format 0x32315659 invalid
      [ 145.007755] stk1160: fourcc format 0x32315559 invalid
      [ 145.007887] stk1160: registers to PAL like standard

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Hi Andrew,

    I am using ti-omap ubuntu kernel which was compiled with the easycap module disabled. So I guess I don't have to bother blacklisting easycap module.

    I followed all the instructions provided. modinfo throws
    modinfo stk1160
    filename: /lib/modules/3.4.0-1487-omap4/extra/stk1160.ko
    description: STK1160 driver
    author: Ezequiel Garcia
    license: GPL
    srcversion: 8F1281CF294A02369872C2D
    alias: usb:v05E1p0408d*dc*dsc*dp*ic*isc*ip*
    depends: videobuf2-core,videobuf2-vmalloc
    vermagic: 3.4.0-1487-omap4 SMP preempt mod_unload modversions ARMv7 p2v8
    parm: i2c_debug:enable debug messages [i2c] (int)
    parm: debug:enable debug messages (int)
    parm: vidioc_debug:enable debug messages [vidioc] (int)
    parm: input:Set default input (int)


    Now, when I add the easycap device, stk11660 module is not loaded and I get this error.

    [ 593.005676] usb 1-1.2: New USB device found, idVendor=05e1, idProduct=0408
    [ 593.005706] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    [ 593.005737] usb 1-1.2: Product: USB 2.0 Video Capture Controller
    [ 593.005767] usb 1-1.2: Manufacturer: Syntek Semiconductor
    [ 593.006561] usb 1-1.2: usb_probe_device
    [ 593.006591] usb 1-1.2: configuration #1 chosen from 1 choice
    [ 593.007263] usb 1-1.2: adding 1-1.2:1.0 (config #1, interface 0)
    [ 593.008331] usb 1-1.2: adding 1-1.2:1.1 (config #1, interface 1)
    [ 593.009094] snd-usb-audio 1-1.2:1.1: usb_probe_interface
    [ 593.009155] snd-usb-audio 1-1.2:1.1: usb_probe_interface - got id
    [ 593.012145] usb 1-1.2: adding 1-1.2:1.2 (config #1, interface 2)
    [ 593.068328] stk1160: Unknown symbol snd_ac97_mixer (err 0)
    [ 593.068481] stk1160: Unknown symbol snd_ac97_bus (err 0)

    any suggestions

    ReplyDelete
    Replies
    1. Hi, I've tested the driver succesfully with Ubuntu 12.10 beta (kernel 3.5) but I don't know if it works with the omap kernel.
      Some things you can try:
      Reboot the system.
      Unload the driver and reload it with
      sudo rmmod stk1160
      sudo modprobe stk1160
      If this doesn't work you can try the latest driver version from Ezequiels github which works for me on Ubuntu 12.10:
      Got to this page
      https://github.com/ezequielgarcia/stk1160-standalone
      select the svideo2_for_v3.2 branch in the drop down list (top left), now hit the ZIP button for downloading the source code. Installation works the same way as described above.
      You can also try the for_v3.4 branch but I'm not sure if it works at all.
      Regards
      Andrew

      Delete
  5. Hi Andrew, I've been reading your comments and I see that the STK1160 driver has s-video. Does it work? I am trying to install s-video for an online streaming application and would be grateful if you could point me to the s-video STK1160 driver that works. Many thanks Carol

    ReplyDelete
    Replies
    1. Hi Carol,
      I've just published a new post where you find the answer to your question.

      Regards
      Andrew

      Delete
    2. Hi Andrew,
      I've spotted this and will try it with qv4l2.
      Cheers,

      Carol

      Delete
  6. Hi Andrew,
    You have been a big inspiration. We are working on building this for OpenWRT - Attitude Adjustment. As you say, it is built into the kernel now and we enable by some flags. Almost to the point of installing the package and testing.

    Just wanted to say thanks!!

    ReplyDelete
  7. Hi Ezequiel Garcia,
    Is it possible to use two stk1160 at the same time?
    I tried but when one is in use the other one doesn't work.
    Thanks,
    Marco

    ReplyDelete
    Replies
    1. Sorry for my late reply!

      Hi, I'm Andrew not Ezequiel ...
      and I don't really know if two devices are working at the same time because I do own only one.
      You can check after plugging in the two devices if there is a /dev/video0 and! /dev/video1 on your system ( If you have a webcam there should be a /dev/video2 as well - all in all there should be three! /dev/videoN on your system: webcam, stk1160 one, stk1160 two).
      When you read this you can post here or send to me as email the output of
      dmesg
      directly after plugging in the two stk1160 devices.

      Andrew

      Delete
  8. Thank you for all your work on this Driver for Linux. The main driver installed fine and is present with "modinfo stk1160" But after plugging in the device and the green LED light came on, I ran this: "cat /proc/asound/cards"
    and received only these two options:

    0 [SB ]: HDA-Intel - HDA ATI SB
    HDA ATI SB at 0xfe024000 irq 16
    1 [HDMI ]: HDA-Intel - HDA ATI HDMI
    HDA ATI HDMI at 0xfdffc000 irq 19



    dmesg command gives 22 screens of data including this ..

    [444051.246596] Linux video capture interface: v2.00
    [444051.263884] easycap: module is from the staging directory, the quality is unknown, you have been warned.
    [444051.266385] Easycap version: 0.9.01
    [444051.266468] usbcore: registered new interface driver easycap

    Any ideas on what to do next?

    My goal, of course, is to convert VHS formatted tapes from the RCA jacks inputted into the easyCAP capture device and use VLC to save onto DVDs

    ReplyDelete
  9. Hi Rob,

    Thanks go to Ezequiel for programming the driver, I only provide some information about it.

    Obviously the easycapdriver is still active on your system.

    For me there are three possible reasons for your problem.
    1. The installation of the stk1160 driver did not work at all, or
    2. you forgot to blacklist the easycap driver (see the description in the post).
    3. you installed all the updates on your system including a new kernel, but you did not install the driver for the updated kernel you have booted from.

    I added some information about that to the post.

    What system do you have? Ubuntu or some other distro?

    Andrew

    ReplyDelete
  10. this driver looks like it should work wonders! However when i try to run the "make" command i get this:

    pi@raspberrypi ~/ezequielgarcia-stk1160-standalone-0e85b05 $ make
    make -C /lib/modules/3.6.11+/build M=/home/pi/ezequielgarcia-stk1160-standalone-0e85b05 modules
    make: *** /lib/modules/3.6.11+/build: No such file or directory. Stop.
    make: *** [all] Error 2

    ReplyDelete
    Replies
    1. Hi, I see you're trying to compile the driver on your raspberry pi.
      Obviously you do not have the necessary kernel header files installed, but you need them for installing the driver.
      Besides, I don't know if the stk1160 device is fully working on raspberry's hardware.
      Note: if you can get a distribution for the raspberry pi which has already the 3.7.x kernel you do not need to compile the driver by yourself because it is in the 3.7 kernel.
      Andrew

      Delete
  11. Hi, I' ve installed the driver but when I launch the test code it shows this:

    MPlayer svn r34540 (Ubuntu), built with gcc-4.7 (C) 2000-2012 MPlayer Team
    mplayer: could not connect to socket
    mplayer: No such file or directory
    Failed to open LIRC support. You will not be able to use your remote control.

    Playing tv://.
    TV file format detected.
    Selected driver: v4l2
    name: Video 4 Linux 2 input
    author: Martin Olschewski
    comment: first try, more to come ;-)
    v4l2: unable to open '/dev/video0': No such file or directory
    v4l2: ioctl set mute failed: Bad file descriptor
    v4l2: 0 frames successfully processed, 0 frames dropped.


    Exiting... (End of file)

    Do you know if it's possible to fix it?
    Thank you.

    ReplyDelete
    Replies
    1. Hi Enrico, sorry for may late answer.

      Either mplayer cannot read from /dev/video0 or it is not created.

      You can check if the /dev/video0 is present on your system with this command in the terminal:

      ls /dev/video*

      For checking your driver installation please send the stk116log.txt created by the following command, with your stk1160 device plugged in, to me per mail (adress is in my profile).

      uname -a >> stk1160log.txt; usb-devices >> stk1160log.txt; dmesg >> stk1160log.txt

      Note, that after an automatic kernel update the driver must be reinstalled.

      Andrew

      Delete
  12. Hi,

    I'm trying to install the EasyCAP on a GuruPlug (Kirkwood ARM). In the past I've been able to get decent results using the old staging EasyCap driver in kernel 3.5.3.
    I've compiled the stk1160 with the 3.7.9 kernel and I get this when I plug the EasyCap in:


    usb 1-1.3: new high-speed USB device number 3 using orion-ehci
    Linux video capture interface: v2.00
    usb 1-1.3: New device Syntek Semiconductor USB 2.0 Video Capture Controller @ 480 Mbps (05e1:0408, interface 0, class 0)
    usb 1-1.3: video interface 0 found
    saa7115 0-0025: saa7113 found (1f7113d0e100000) @ 0x4a (stk1160)
    stk1160: driver ver 0.9.5 successfully loaded
    stk1160: registers to NTSC like standard
    stk1160 1-1.3:1.0: V4L2 device registered as video0
    usbcore: registered new interface driver stk1160

    When I start Zonemider and add the device I get this:

    stk1160: queue_setup: buffer count 8, each 691200 bytes
    stk1160: queue_setup: buffer count 8, each 691200 bytes
    stk1160: queue_setup: buffer count 8, each 691200 bytes
    ...

    and the device does not work (I've tried in PAL and NTSC). Any ideas?

    Thanks

    Rich

    ReplyDelete
    Replies
    1. Hi,
      sorry, I don't know why it doesn't work because I do not have any experiences with Zoneminder.
      The good news is, that the driver loads and creates a /dev/video0.
      Did you test the device with mplayer? If you can get a picture with mplayer I think the next step is, searching for the right settings for zoneminder.
      Maybe you need to adjust the resolution to 720x480 (I think this is the NTSC resolution of the stk1160 driver) in Zoneminders camera settings.

      http://www.zoneminder.com/wiki/index.php/Capture_Resolution_Width_x_Height

      Hope that helps
      Regards
      Andrew


      Delete
  13. Andrew,

    I am trying to get this working on an Android device (Nexus 7). I have gotten the old EasyCAP driver working by simply building the module. This one seems a little more difficult.

    I have built this driver as well as the following
    videobuf2-core
    videobuf2-vmalloc
    videobuf2-memops
    saa7115

    All of them insmod into the kernel fine. But as soon as I plug in my EasyCAP device, I get a kernel panic and a hard reboot on my N7. I have a log of the kernel pasted http://pastebin.com/fayHMmB5

    Hopefully you can give some insight as to whats causing the kernel panic.

    ReplyDelete
  14. uname -r: 3.2.29
    linux: slackware 14
    modprobe stk1160
    ERROR: could not insert 'stk1160': Exec format error

    ReplyDelete
  15. slackware 14 32 bits

    bash-4.2# uname -a
    Linux defcon 3.2.29 #2 Mon Sep 17 14:10:59 CDT 2012 i686 Intel(R) Celeron(R) CPU 2.26GHz GenuineIntel GNU/Linux

    bash-4.2# modinfo stk1160
    filename: /lib/modules/3.2.29/kernel/drivers/media/video/stk1160.ko
    description: STK1160 driver
    author: Ezequiel Garcia
    license: GPL
    alias: usb:v05E1p0408d*dc*dsc*dp*ic*isc*ip*
    depends: videodev,v4l2-common,videobuf2-core,snd,i2c-core,videobuf2-vmalloc,snd-ac97-codec
    vermagic: 3.2.29-smp SMP mod_unload PENTIUMIII
    parm: i2c_debug:enable debug messages [i2c] (int)
    parm: debug:enable debug messages (int)
    parm: vidioc_debug:enable debug messages [vidioc] (int)
    parm: input:Set default input (int)

    bash-4.2# modprobe stk1160
    ERROR: could not insert 'stk1160': Exec format error

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
    2. Hi, I have no idea what causes your problem. Please read this information on Ezequiel Garcias github.

      https://github.com/ezequielgarcia/stk1160-standalone/blob/for_v3.2/README.md

      Delete
  16. Will this work in kernel 3.5.0-39?

    ReplyDelete
  17. Yes, the source code form here
    https://github.com/ezequielgarcia/stk1160-standalone/tree/svideo2_for_v3.2
    should work with kernel 3.2 up to 3.5 and 3.6

    Andrew

    ReplyDelete
  18. Hi Andrew, I thought i knew a bit about computers until i read all the above... i now feel a very inadequate 63 year old, is there a driver for the DC60 anywhere i can just download and it will work ?? thanks.. frustrated. slaphead.

    ReplyDelete
  19. Hi Andrew, I thought i knew a bit about computers until i read all the above... i now feel a very inadequate 63 year old, is there a driver for the DC60 anywhere i can just download and it will work ?? thanks.. frustrated. slaphead.

    ReplyDelete
    Replies
    1. Hi,
      if you're using Linux, the driver is in the latest distributions (like Ubuntu 13.04 and 13.10) and ready to work.
      Read the Quickstart page on this Blog to know how to get it to work.
      If you're using Windows, you must look for more information elsewhere on the web. This blog only covers the DC60 under LInux.
      Regards
      Andrew

      Delete

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