somagic easycap working well

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
q7joey
Posts: 2
Joined: Fri Feb 12, 2016 9:23 pm

somagic easycap working well

Post by q7joey »

i have made some minor tweaks to the somagic-capture tool available on the net and with some help from xinetd and libvlc, i have zoneminder using two easycap devices working great. it is video only, audio might be doable, but i haven't looked into how to easily combine two separate streams together. and before i go to any more effort, i wanted to see if there are others out there that might want to use this stuff. the method i used seems like it might be useful for a number of other capture devices.

basically, i have xinetd setup to listen on a tcp port and invoke the somagic-capture tool. i then use the libvlc source method to connect to tcp://localhost:### and use the rawvideo demux with all the appropriate flags:

--demux=rawvideo,--rawvid-chroma=UYVY,--rawvid-width=720,--rawvid-height=480,--rawvid-fps=30000/1001,--rawvid-aspect=4:3

and bingo, zoneminder is happy. each usb dongle uses about 20% of a core for somagic-capture. i made a small code change to somagic-capture to be able to specify which usb dongle to read from, so that multiple ones can be used on a single server.

if anyone else is interested, i can write this up and put stuff into the wiki, but if i'm the only one, then i'll just sit quietly in the corner :-).
tuxmos
Posts: 20
Joined: Fri Oct 30, 2015 11:13 am

Re: somagic easycap working well

Post by tuxmos »

You are not allone. Please write. :D
carlos_miguel26
Posts: 1
Joined: Sun May 22, 2016 6:29 pm

Re: somagic easycap working well

Post by carlos_miguel26 »

A tutorial PLEEEAAASEEEE!!! I don't need to connect multiple dongles, but it would be great to be able to use the 4 inputs in mine. If that's not possible, it would be great to know at least how to have one output displayed on zoneminder. I'm able to obtain image through ffmpeg, but that's about it. So, any help would be very much appreciated. Thanks!!!
emanuelez
Posts: 1
Joined: Fri May 27, 2016 8:43 pm

Re: somagic easycap working well

Post by emanuelez »

A tutorial would be greatly appreciated :)
q7joey
Posts: 2
Joined: Fri Feb 12, 2016 9:23 pm

Re: somagic easycap working well

Post by q7joey »

i'll address the multiple units later since that takes code changes. all of this relies on the somagic-capture tool. i had a hard time tracking it down, but it does live out there still.

what i did was to create an inetd based server to let me get the raw stream via a network port.

Code: Select all

service vid0
{
    disable = no
    socket_type     = stream
    port            = 5000
    bind            = localhost
    protocol        = tcp
    wait            = no
    user            = root
    server          = PATH_TO/somagic-capture
    server_args     = -n -B 150
    type            = UNLISTED
}
tweak the -n -B 150 flags to your liking. -n is NTSC and -B sets the brightness. there are other lfags as well, but i didn't need to fiddle with any of them.

then i configure zoneminder to use a libvlc source with the following parameters:

Code: Select all

Source Path			tcp://localhost:5000
Remote Method			RTP/Unicast
Options (?)			--demux=rawvideo,--rawvid-chroma=UYVY,--rawvid-width=720,--rawvid-height=480,--rawvid-fps=30000/1001,--rawvid-aspect=4:3
Target colorspace		24 bit color
Capture Width (pixels)	720
Capture Height (pixels)	480
Preserve Aspect Ratio	unchecked
Orientation			Normal
Deinterlacing			Disabled
every so often after restarting zm, things will come up out of whack. i just kill the somagic-capture process and wait for zm to respawn it and that usually clears things up.

as for the 4 input model, i don't know that you can monitor all of those at once. with the above info about how to even start, maybe you can figure that out. you'd need to create a separate tcp stream for each one, but i am guessing that the first somagic-capture process will lock the device and you won't be able to start another. i think that internally there is just a 4 way switch in front of the digitizer, so only one signal can be viewed at a time.
hamkaling2016
Posts: 1
Joined: Sun Mar 27, 2016 6:48 am

Re: somagic easycap working well

Post by hamkaling2016 »

somagic-capture is required root to run...that is a pain in the A55.. any ideas to make not run as root?

Here's how I make it run on zoneminder.
  1. Login as root
  2. Initialized the somagic - 'somagic-init'
  3. I ran this commands on my terminal
    somagic-capture -p --sync=1 --iso-transfers 20 2>/dev/null | ffmpeg -f rawvideo -pix_fmt uyvy422 -s 720x576 -y -an -r pal -i - -s 320x240 -c:v libx264 -preset ultrafast -f mpegts - | su user -c "cvlc -q --sout '#rtp{sdp=rtsp://192.168.1.111:8099/v.sdp}' "
  4. On zoneminder
    Source Type : Libvlc
    Source Path : rtsp://192.168.1.111:8099/v.sdp
    Remote Method : RTP/Unicast
    Cap Width : 320
    Cap Height : 240
Others you have to tweak and play. I'm using a pal camera.
Image
xenDE
Posts: 2
Joined: Thu Feb 09, 2017 11:09 am

Re: somagic easycap working well

Post by xenDE »

Thanks for your informations!

i reinstalled my cam system and made a short howto for multiple Somagic cams:

https://blog.mameso.com/2017/02/zonemin ... agic-cams/
vveren
Posts: 3
Joined: Sun Jun 18, 2017 10:11 pm

Re: somagic easycap working well

Post by vveren »

Hi!

I'm trying to make the easycap somagic work identified by lsusb below: Bus 001 Device 004: ID 1c88:003f Somagic, Inc.

In the general tab zoneminder, I configured it as follows:

Source Type: Libvlc

In the source tab zoneminder, I configured it as follows:

Source Path: rtsp://localhost:8099/v.sdp
Remote Method: UDP

In the terminal I typed the following command:

sudo somagic-capture -p --sync=1 --iso-transfers 20 2>/dev/null | ffmpeg -f rawvideo -pix_fmt uyvy422 -s 720x576 -y -an -r pal -i - -s 320x240 -c:v libx264 -preset ultrafast -f mpegts - | su USER -c "cvlc -q --sout '#rtp{sdp=rtsp://localhost:8099/v.sdp}' "

Resulting in the terminal:
----------------------------------------------------------------------------------------------
VLC media player 2.1.6 Rincewind (revision 2.1.6-0-gea01d28)
ffmpeg version 2.4.3-1ubuntu1~trusty6 Copyright (c) 2000-2014 the FFmpeg developers
built on Nov 22 2014 17:07:19 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
configuration: --prefix=/usr --extra-version='1ubuntu1~trusty6' --build-suffix=-ffmpeg --toolchain=hardened --extra-cflags= --extra-cxxflags= --libdir=/usr/lib/x86_64-linux-gnu --shlibdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --enable-shared --disable-stripping --enable-avresample --enable-avisynth --enable-fontconfig --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libshine --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-opengl --enable-x11grab --enable-libxvid --enable-libx265 --enable-libdc1394 --enable-libiec61883 --enable-libzvbi --enable-libzmq --enable-frei0r --enable-libx264 --enable-libsoxr --enable-openal --enable-libopencv
libavutil 54. 7.100 / 54. 7.100
libavcodec 56. 1.100 / 56. 1.100
libavformat 56. 4.101 / 56. 4.101
libavdevice 56. 0.100 / 56. 0.100
libavfilter 5. 1.100 / 5. 1.100
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 0.100 / 3. 0.100
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 0.100 / 53. 0.100
Input #0, rawvideo, from 'pipe:':
Duration: N/A, start: 0.000000, bitrate: 165888 kb/s
Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 720x576, 165888 kb/s, 25 tbr, 25 tbn, 25 tbc
No pixel format specified, yuv422p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
[libx264 @ 0x1590840] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.1 Cache64
[libx264 @ 0x1590840] profile High 4:2:2, level 1.3, 4:2:2 8-bit
Output #0, mpegts, to 'pipe:':
Metadata:
encoder : Lavf56.4.101
Stream #0:0: Video: h264 (libx264), yuv422p, 320x240, q=-1--1, 25 fps, 90k tbn, 25 tbc
Metadata:
encoder : Lavc56.1.100 libx264
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
----------------------------------------------------------------------------------------------

NOTHING APPEARS ON ZONEMINDER! ANYONE HAVE ANY IDEA WHAT I'M DOING WRONG????


Thanks!
Edson Weren
Post Reply