Difference between revisions of "Doing your best to get rid of smudging in FFMPEG transcoding of RTSP streams"

From ZoneMinder Wiki
Jump to navigationJump to search
Line 1: Line 1:
[[Various Learnings from getting Zomeminder 1.28.1 working well on Ubuntu Server 14.04|<Home]]
[[Various Learnings from getting Zomeminder 1.28.1 working well on Ubuntu Server 14.04|<Home]]


===Background===
===Background===
Line 29: Line 30:
2015-03-23 18:42:10.721264 zmc_m3 770 FAT No RTSP sources zm_remote_camera_rtsp.cpp
2015-03-23 18:42:10.721264 zmc_m3 770 FAT No RTSP sources zm_remote_camera_rtsp.cpp
</nowiki>
</nowiki>
===Smearing===
 
Once I had ZM up and running for a day or two, I started noticing a lot of frame "smearing". This is what I mean by smearing:
====Source Type: libVLC====
 
VLC is supposed to be a drop in replacement for FFMPEG. It works, but here is the rub:
* With 5 cameras capturing HD streams, using FFMPEG, my CPU consumption always hovered between 12% - 30%
* The moment I changed ONE camera to VLC, my CPU consumption shot up to 67% and stayed there
* The moment I changed TWO cameras to VLC, I'd hit 97% and then I'd start getting spurts of green screens and other erros
 
So obviously, VLC was a fail for me.
 
====Source Type: FFMPEG====
 
FFMPEG worked, but:
* I noticed a lot of smearing and smudging while FFMPEG transcoded RTSP to images. The smearing would be random and quite frequent. The problem was that this made ZM think there were large changes in frames and it would trigger all sorts of alarms
 
This is what I mean by smearing:


[[File:Smearing_example.jpeg]]
[[File:Smearing_example.jpeg]]

Revision as of 11:38, 24 March 2015

<Home


Background

All my cameras are Foscam HD cameras (1280x960) and support RTSP. Further , 4 out of my 5 cameras are connected via WiFi. Zone minder has many options to capture frames, but for Foscam cameras it boils down to:

  • Using the Foscam "snapshot2" URL to capture images instead of live streaming
  • Using RTSP URL
  • Using MJPEG URL (needs a configuration change to Foscam)

I investigated all 3 options.

  • In terms of quality, Option 1 (image snapshot) is the best. No artifacts, no smudging nothing. The downside is there are a high amount of connection drops, even if I dropped the HD stream to 720p.
  • Foscam seems to only stream MJPEG as 640x480. That was not acceptable (and the quality of the stream seemed to have a lot of artifacting)
  • So really, the only option left was RTSP


RTSP via FFMPEG/VLC/Remote

Now that RTSP was the only viable option, there are 3 methods you can use (well, maybe 4, not sure if Curl supports RTSP - never tried)

  • You can use source type as FFMPEG, VLC or (a new addition with ZM 1.28) Remote


Source Type: Remote

Based on this issue in github, knnniggett writes that starting ZM 1.28, they have built in their own RTSP handler that does not rely on FFMPEG. Well, that's great. Except, it never worked for me. When I tried, I would get errors like this:

2015-03-23 18:39:44.255471 zmc_m3 713 INF Recieved new Content-Base in DESCRIBE reponse header. Updated device Url to: 'rtsp://192.168.1.xxx:65534/videoMain/' zm_rtsp.cpp
2015-03-23 18:42:10.721264 zmc_m3 770 FAT No RTSP sources zm_remote_camera_rtsp.cpp

Source Type: libVLC

VLC is supposed to be a drop in replacement for FFMPEG. It works, but here is the rub:

  • With 5 cameras capturing HD streams, using FFMPEG, my CPU consumption always hovered between 12% - 30%
  • The moment I changed ONE camera to VLC, my CPU consumption shot up to 67% and stayed there
  • The moment I changed TWO cameras to VLC, I'd hit 97% and then I'd start getting spurts of green screens and other erros

So obviously, VLC was a fail for me.

Source Type: FFMPEG

FFMPEG worked, but:

  • I noticed a lot of smearing and smudging while FFMPEG transcoded RTSP to images. The smearing would be random and quite frequent. The problem was that this made ZM think there were large changes in frames and it would trigger all sorts of alarms

This is what I mean by smearing:

Smearing example.jpeg