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 .
somagic easycap working well
Re: somagic easycap working well
You are not allone. Please write.
-
- Posts: 1
- Joined: Sun May 22, 2016 6:29 pm
Re: somagic easycap working well
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!!!
Re: somagic easycap working well
A tutorial would be greatly appreciated
Re: somagic easycap working well
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.
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:
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.
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
}
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
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.
-
- Posts: 1
- Joined: Sun Mar 27, 2016 6:48 am
Re: somagic easycap working well
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.
Here's how I make it run on zoneminder.
- Login as root
- Initialized the somagic - 'somagic-init'
- 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}' " - 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
Re: somagic easycap working well
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/
i reinstalled my cam system and made a short howto for multiple Somagic cams:
https://blog.mameso.com/2017/02/zonemin ... agic-cams/
Re: somagic easycap working well
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
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