cpu usage for source ffmpeg vs remote

Forum for questions and support relating to the 1.29.x releases only.
Locked
kevin186
Posts: 55
Joined: Mon May 10, 2010 4:11 am
Location: Worth, IL

cpu usage for source ffmpeg vs remote

Post by kevin186 »

After trying out version 1.29 on ubuntu 15.10, after following instructions https://wiki.zoneminder.com/Ubuntu_Serv ... e_easy_way and https://wiki.zoneminder.com/Ubuntu_Serv ... e_easy_way, I was able to get my old chinese h264 streamer to work, which previously did not work on my zm 1.25 box. The device allows for 4 analog cameras to connect via bnc, then connects via ethernet, so I think it may be categorized as a network digitizer. I notice a difference in cpu usage depending on the configuration used for the Source Type. For testing purposes, I have the maxed out the cameras streaming at 30fps and I used the same source camera stream for each of the 2 entries in zoneminder, but using a different source configuration.

configuration for monitor 16:
source type: ffmpeg
source path: rtsp://192.168.1.160:554/user=admin&password=&channel=1&stream=0.sdp
remote method: rtp/rtsp
target colorspace: 24 bit color
capture width: 352
capture height: 240

configuration for monitor 17:
source type: remote
remote protocol: rtsp
remote method: rtp/rtsp
remote host name: 192.168.1.160
remote host port: 554
remote host path: /user=admin&password=&channel=1&stream=0.sdp
target colorspace: 24 bit color
capture width: 352
capture height: 240

Running the command "htop -u www-data" shows the processes of zoneminder. Monitor 16 cpu usage is about 4.3 and monitor 17 is about 2.8. I am not complaining that the cpu usage may be high, I am just describing that there seems to be a difference between the 2 source types. Is that the expected behavior?
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: cpu usage for source ffmpeg vs remote

Post by knight-of-ni »

The following three source types are interchangeable:
- ffmpeg
- libvlc
- remote/rtsp

Generally, you should always use ffmpeg as it is the most compatible and most efficient.

Note that you will get a performance boost if you change to 32bit colorspace.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
kevin186
Posts: 55
Joined: Mon May 10, 2010 4:11 am
Location: Worth, IL

Re: cpu usage for source ffmpeg vs remote

Post by kevin186 »

knnniggett wrote:The following three source types are interchangeable:
- ffmpeg
- libvlc
- remote/rtsp

Generally, you should always use ffmpeg as it is the most compatible and most efficient.

Note that you will get a performance boost if you change to 32bit colorspace.
Thanks for the tip about the 32bit colorspace. I also tried libvlc, after reading your response and then installing the lib. I am able to stream using that option, also. Comparing the 3 different options, monitor 16 is set for remote, 17 is ffmpeg, and 18 is libvlc. All 3 monitors are using the same remote stream as the source.
Screen Shot 2016-03-28 at 8.06.50 PM.png
Screen Shot 2016-03-28 at 8.06.50 PM.png (664.16 KiB) Viewed 9428 times
Monitor 18 seems to use the most cpu and memory, followed by monitor 17, and then monitor 16. I am curious why there would be multiple pids per process. I am not a linux expert, so maybe that is normal for the different.
kevin186
Posts: 55
Joined: Mon May 10, 2010 4:11 am
Location: Worth, IL

Re: cpu usage for source ffmpeg vs remote

Post by kevin186 »

kevin186 wrote:I am curious why there would be multiple pids per process. I am not a linux expert, so maybe that is normal for the different.
Just found out that is an htop thing, showing threads per process. Pressing shift h will hide the threads. But the cpu usage is still the same, of course. All 3 options appeared to have the same quality, but for efficient cpu usage: remote > ffmpeg > libvlc, on my system, atleast.
PacoLM
Posts: 971
Joined: Wed Dec 02, 2009 9:55 pm
Location: Spain

Re: cpu usage for source ffmpeg vs remote

Post by PacoLM »

knnniggett wrote:Note that you will get a performance boost if you change to 32bit colorspace.
Wow, not only an improvement in the performance, the image quality (at least in my cameras) is way better after switching to 32bits from 24bits. I'm impresses, every day I learn something in this forum!

Thanks a lot,

PacoLM

After more than 15 years, no longer using ZM as surveillance system.
Now in the dark side, using a commercial system...
nirv199
Posts: 27
Joined: Wed May 13, 2015 11:55 am

Re: cpu usage for source ffmpeg vs remote

Post by nirv199 »

knnniggett wrote: Note that you will get a performance boost if you change to 32bit colorspace.
Sorry for the dumb question, but why is there a performance boost from 24 to 32bit colorspace? I did notice a small improvement when I changed it from 24bit to 32bit, just trying to understand.

Thanks
thomas1977
Posts: 17
Joined: Mon Oct 31, 2011 5:19 pm

Re: cpu usage for source ffmpeg vs remote

Post by thomas1977 »

I want to ask again, why 32bit boots performance?
Dont I also need more diskspace to store those images? Hope someone can explain this.

regards
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: cpu usage for source ffmpeg vs remote

Post by knight-of-ni »

thomas1977 wrote:I want to ask again, why 32bit boots performance?
Dont I also need more diskspace to store those images? Hope someone can explain this.

regards
See:
viewtopic.php?f=36&t=25140&p=96041#p96041
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
bbunge
Posts: 2930
Joined: Mon Mar 26, 2012 11:40 am
Location: Pennsylvania

Re: cpu usage for source ffmpeg vs remote

Post by bbunge »

thomas1977 wrote:I want to ask again, why 32bit boots performance?
Dont I also need more diskspace to store those images? Hope someone can explain this.

regards
I did an unscientific test on my production system of 17 cameras and set the colorspace to 32 bits on all the cameras. The system load went down a bit, color was improved and the image size (from one camera) went from 5.68 KB to 4.94 KB (camera at 320x240).
thomas1977
Posts: 17
Joined: Mon Oct 31, 2011 5:19 pm

Re: cpu usage for source ffmpeg vs remote

Post by thomas1977 »

thanks to both of you for the explanation
Locked