Over the last few month 1-2 a week our newspaper was missing. This, most of the mornings, really ticket me off as it disrupted my breakfast routine. A while later I got a letter from the courier announcing that in our neighborhood newspapers get stolen.
I need my morning newspaper even though there is hardly any news in there. I considered cancelling the subscription but realized that I was not ready to let go of this habit. I also grew curious who would steal newspapers when most of the news was freely available on-line. Maybe one of my lovely neighbors had a dark side. So I took the challenge and set out to solve this mystery.
I ordered a Samsung SNH-P6410BN in-door and Samsung SNH-E6440BN outdoor wireless IP security camera. These are really great Hi-Def cameras with a wide field of view and good picture quality during daylight as well as at night.
The camera comes with pretty decent cloud support and an Android and iPhone app. It can store the video feeds to microSD cards that can be inserted into the cameras. However I did not want to fiddle with SD-cards as the camera is connected to my network and I hoped that additional software could help me out.
I was intrigued by 3rd party Video Software like BlueIris that could in fact connect to my cameras video streams.
While setting up my camera with BlueIris I realized that the camera is able to stream video in any of the following resolutions:
Video Profile 6: h264 (Baseline), yuv420p, 640x360, 30 tbr, 90k tbn, 180k tbc Video Profile 5: h264 (Baseline), yuv420p, 1920x1080, 30 tbr, 90k tbn, 180k tbc Video Profile 4: h264, yuv420p, 1280x720, q=2-31, 90k tbn, 90k tbc: Video Profile 3: h264 (Baseline), yuv420p, 640x360, 30 tbr, 90k tbn, 180k tbc Video Profile 2: h264 (Baseline), yuv420p, 640x360, 10 fps, 10 tbr, 90k tbn, 180k tbc Video Profile 1: mjpeg, yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 1:1 DAR 16:9], 1 tbr, 90k tbn, 90k tbc
This is no where documented in the product manual that shipped with the camera. Anyway, I managed to open the camera streams in VLC and watch the live feed using a URL like this:
However I was mostly interested in dumping these streams to a hard drive so that I could zap through them with VLC. That is when I started to look into ffmpeg.
What a tool this is! The Swiss-Army knife of Video. Is there something that cannot be done with this utility? However, the flexibility comes at a price. There are so many options and parameters that exploring them feels like an entry riddle to a secret society. That said, the ffmpeg user community is large and there are many example and posts that are available on the internet to get you started.
So here is a simple command that dumps my stream:
ffmpeg -i rtsp://admin:YOUR_PASSWORD@192.168.1.100/profile5/media.smp -vcodec copy VideoDump.mp4
This line dumps the input video stream into the file VideoDump.mp4. The option “-vcodec copy” makes sure that the stream is not re-coded so the process hardly takes any CPU resources. This worked really well. However the files started to become big as a 1920×1080 stream uses about 1 GByte of hard disk space per hour. Is there a way to split the files into 1hour segments? You bet!
The following command line will dump segments of 1 hour:
ffmpeg -i rtsp://admin:YOUR_PASSWORD@192.168.1.100/profile5/media.smp -vcodec copy -segment_time 3600 -segment_time_delta 0.03 -reset_timestamps 1 VideoDump_%03d.mp4
The segment time is specified with the option “-segment_time 3600” that takes seconds as the argument. The option “-segment_time_delta 0.03″ allows the utility some 0.03 second flexibiliy where to cut a segment so it can do it at a key frame. The option ” -reset_timestamps 1″ will reset the time inside a segment to start at 00:00. Also the segments get numbered. The segment files are named like this:
VideoDump_000.mp4 VideoDump_001.mp4 VideoDump_002.mp4 : :
The amount of video data I collected was rapidly growing and I was interested to start and turn off the capturing at define moments. Sure ffmpeg can do this:
ffmpeg -i rtsp://admin:YOUR_PASSWORD@192.168.1.100/profile5/media.smp -vcodec copy -segment_time 3600 -segment_time_delta 0.03 -reset_timestamps 1 -ss 00:00:00 -t 02:30:00 VideoDump_%03d.mp4
Adding the option “-ss 00:00:00 -t 02:30:00” will capture 2.5 hours of footage and then stop. I then used a cron job on my Mac to start the stream capturing.
In summary ffmpeg works great with the Samsung IP cameras and allows to capture videos exactly during the hours of interest.
So coming back to the missing newspaper, you wonder who the culprit was? Well to my surprise there was no thief. The footage clearly revealed that the newspaper never got delivered the days it was “stolen”.