What I use
- a linux system
- a USB Composite Video Capture Adapter (10,45€, Somagic, Inc. SMI Grabber (EasyCAP DC60+ clone) [SMI-2021CBE])
- a cheap cmos composite cam (china 5€+)
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
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:
- after this play, you want this: zoneminder.com
- added support for multiple devices