I want to use my webcam as a home surveillance system. I made everything on my desktop which runs fedora 22. It works just fine. The surveillance system is really simple. It's just bash script with this ffmpeg command taping 1 hour videos and re run by cron every hour
ffmpeg -t 3559 -f video4linux2 -input_format mjpeg -i /dev/video$i -c:v mpeg2video -b:v 2500k $savedir/$rec_name.mkv -vf fps=1 -updatefirst 1 $picdir/cam$i.jpg
Not shown is how the bash script only keeps a days worth of video but that's not relevant and will make this post much longer. The way the surveillance system works is that while taping videos, it also updates a thumbnail every second. The thumbnail is stored on a ram disk. I wrote a simple php front end that takes a password and then lets you choose between the various usb web cams. When you choose a webcam a javascript just updates the thumbnail every second giving the appearance of live video. I'm recording in inefficient mpeg2 because I think that's all the router can handle. (Archer c7 v2)
I wanted to test just the thumbnailing but when I run the command by hand in the terminal I get
root@OpenWrt:~# ffmpeg -f video4linux2 -input_format mjpeg -i /dev/video0 -vf -fps=1 -updatefirst 1 /tmp/cam.jpg
ffmpeg version 0.11.5 Copyright (c) 2000-2014 the FFmpeg developers
built on Sep 23 2014 08:52:59 with gcc 4.8.3
configuration: --enable-cross-compile --cross-prefix=mips-openwrt-linux-uclibc- --arch=mips --target-os=linux --prefix=/usr --enable-shared --enable-static --disable-debug --pkg-config=pkg-config --enable-gpl --enable-version3 --disable-altivec --disable-asm --disable-doc --disable-dxva2 --enable-pthreads --disable-optimizations --enable-small --disable-stripping --enable-zlib --disable-outdevs
libavutil 51. 54.100 / 51. 54.100
libavcodec 54. 23.100 / 54. 23.100
libavformat 54. 6.100 / 54. 6.100
libavdevice 54. 0.100 / 54. 0.100
libavfilter 2. 77.100 / 2. 77.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 15.100 / 0. 15.100
libpostproc 52. 0.100 / 52. 0.100
[video4linux2,v4l2 @ 0xb3f5d0] Buffer len [0] = 213333 != 307200
/dev/video0: Operation not permitted
root@OpenWrt:~# ls -l /dev/video0
crw-r--r-- 1 root root 81, 0 Sep 22 21:28 /dev/video0
I like the idea of using the router to do this because of the power consumption compared to the my pentium 4 northwood desktop I retired last year (It served me well).
Any ideas as to what's wrong with the ffmpeg command?
With all the Snowden leaks there's no way I'd get a commercial home surveillance system.
(Last edited by AAccount on 23 Sep 2015, 02:38)