zoneminder with multiple Somagic CAMs

Februar 9th, 2017

3 CAMs on different USB BUSs:

# lsusb |grep SMI
Bus 008 Device 095: ID 1c88:003c Somagic, Inc. SMI Grabber (EasyCAP DC60+ clone) [SMI-2021CBE]
Bus 003 Device 008: ID 1c88:003c Somagic, Inc. SMI Grabber (EasyCAP DC60+ clone) [SMI-2021CBE]
Bus 001 Device 010: ID 1c88:003c Somagic, Inc. SMI Grabber (EasyCAP DC60+ clone) [SMI-2021CBE]

Info: if you connect two SMI Grabber Sticks on the same USB-Bus, the bandwidth will not be enough.

Init your devices:

retcode=0
while [ $retcode -eq 0 ]; do
	somagic-init
	retcode=$?
done

define your cams with xinetd:

/etc/xinet.d/vid0:

service vid0
{
	disable = no
	socket_type = stream
	port = 7100
	bind = localhost
	protocol = tcp
	wait = no
	user = root
	server = /usr/local/bin/somagic-capture
	server_args = -d 1 -p
	type = UNLISTED
}

/etc/xinet.d/vid1:

service vid1
{
	disable = no
	socket_type = stream
	port = 7101
	bind = localhost
	protocol = tcp
	wait = no
	user = root
	server = /usr/local/bin/somagic-capture
	server_args = -d 2 -p
	type = UNLISTED
}

And so on… (-d 1-9 sets the device number, you need somagic-capture with multiple device support!)

Thanks!

Define the needed count of fcgiwrappers in /etc/init.d/fcgiwrap to view more than one cam at the same time:

FCGI_CHILDREN="3"

Info: 3 means one client (Browser/App) can view 3 cams at the same time or 3 clients can view one cam. If you want 3 clients (PC-Browser, smartphone and tablet) can view 3 cams at the same time, then you need 3*3=9 child’s!

Thanks!

install ZoneMinder:

Thanks!

configure your cams in ZoneMinder:

https://yourdom.tld/zm/ create Monitors for every cam:

  • Source Type: libvlc
  • Source Path: tcp://localhost:7100
  • Options (?): –demux=rawvideo,–rawvid-chroma=UYVY,–rawvid-width=720,–rawvid-height=576,–rawvid-fps=25,–rawvid-aspect=4:3

network traffic monitoring

Februar 1st, 2017

was macht traffic auf deiner Linux Maschine?

Deine Freunde:

#> bmon
#> nethogs -p
#> iftop -B

easy cam live streaming on your smartphone

Juni 15th, 2016

What I use

install cam driver

make & make install(firmware included):
https://github.com/stevelacy/EasyCap/blob/master/documentation/installation.md

test the cam with mplayer:

somagic-capture --pal --sync=1 -c --iso-transfers=20 | mplayer -nocache -vf yadif -demuxer rawvideo -rawvideo "pal:format=uyvy:fps=25" -aspect 4:3 -

install ffmpeg for HLS streaming

https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

use apache as webserver

add needed mime types to apache:

AddType application/x-mpegURL .m3u8
AddType video/MP2T .ts

create www/index.html in your document root

<head>
 <link href="https://cdnjs.cloudflare.com/ajax/libs/video.js/5.10.5/alt/video-js-cdn.min.css" rel="stylesheet">
 <script src="https://cdnjs.cloudflare.com/ajax/libs/video.js/5.10.5/video.min.js"></script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/videojs-contrib-hls/3.1.0/videojs-contrib-hls.js"></script>
</head>
<body>
<video id="maplayer" width=600 height=300 class="video-js vjs-default-skin" controls>
 <source src="/data/playlist.m3u8" type="application/x-mpegURL">
</video>
<script>
 var player = videojs('maplayer');
 player.play();
</script>
</body>
</html>

autogenerate streaming files in www/data/

somagic-capture --pal --sync=1 -c --iso-transfers=20 | ffmpeg -f rawvideo -pix_fmt uyvy422 -vtag 2vuy -s 720x576 -y -an -r pal -i - -vf yadif -map 0 -codec:v libx264 -an -crf 18 -profile:v baseline -maxrate 500k -bufsize 1835k -pix_fmt yuv420p -flags -global_header -f ssegment -hls_wrap 10 -segment_wrap 10 -segment_list_size 10 -segment_list playlist.m3u8 -segment_list_flags +live -segment_time 5 out%01d.ts

done – you have the live stream with 20s lag time on your phone

livestream

 

Sources:
https://github.com/stevelacy/EasyCap/blob/master/documentation/installation.md
http://www.bogotobogo.com/VideoStreaming/ffmpeg_http_live_streaming_hls.php
https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu

Edit/Nachtrag: