AlexxIT / go2rtc

Ultimate camera streaming application with support RTSP, RTMP, HTTP-FLV, WebRTC, MSE, HLS, MP4, MJPEG, HomeKit, FFmpeg, etc.
https://github.com/AlexxIT/Blog
MIT License
4.25k stars 346 forks source link

Performance Linux/Windows #1322

Open ilcalmo opened 2 weeks ago

ilcalmo commented 2 weeks ago

I am using go2rtc standalone to restream 9 cams with 2 clients: frigate and Essential+ by Milestone. I installed Debian bookworm on a Onlogic CL250 and used the go2rtc binary for amd64 (stable and nightly build) and the CPU usage of the go2rtc process was about 38%-45% Same CPU usage (only go2rtc process) on a Debian bookwork in a system based on i5-7300U with the same config file, and same CPU usage also with Docker. On the Onlogic CL250 I tried Win11 IOT and installed the go2rtc binary and the same related config file of the other systems. The CPU usage of the go2rtc process was always between 15-20%.!!!

All the tests have been done only with go2rtc running. No other process such as Frigate or other stuff.

Since I am a Linux supporter and looking always a Linux alternative for everything, I am wondering how this can be possible!

Any comments/suggestions? Am I wrong somewhere? Thank you.

AlexxIT commented 2 weeks ago

There's too low information. Start by providing information for all streams - /api/streams. You can remove all sensitive data.

ilcalmo commented 2 weeks ago

Here is the config:

api:
  listen: ":1985"

rtsp:
  listen: ":8554"

streams:
    Cam0:
      - onvif://192.168.19.159:5000
      - ffmpeg:Cam0#audio=aac#audio=opus
    Cam1:
      - onvif://user:pwd@192.168.19.151
      - ffmpeg:Cam1#audio=aac#audio=opus
    Cam2: onvif://user:pwd@192.168.19.152:8899
    Cam3: onvif://user:pwd@192.168.19.156:8899
    Cam4: onvif://user:pwd@192.168.19.155:80
    Cam5: onvif://user:pwd@192.168.19.153:80
    Cam6: onvif://user:pwd@192.168.19.157:80
    Cam7: onvif://user:pwd@192.168.19.158:8899
    Cam8: rtsp://user:pwd@192.168.19.154:554/live0.264

Cam0 -> ffprobe:

  Metadata:
    title           : H.264 Video, RtspServer_0.0.0.2
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: h264 (Baseline), yuv420p(progressive), 1280x720, 90k tbr, 90k tbn
  Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s

Cam1 -> ffprobe:

Metadata:
    title           : Media Presentation
  Duration: N/A, start: 0.049956, bitrate: N/A
  Stream #0:0: Video: h264 (Baseline), yuvj420p(pc, bt709, progressive), 2048x1536 [SAR 1:1 DAR 4:3], 20 tbr, 90k tbn
  Stream #0:1: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s

Cam2/3/7 -> ffprobe:

Metadata:
    title           : RTSP Session
  Duration: N/A, start: 0.040000, bitrate: N/A
  Stream #0:0: Video: h264 (Baseline), yuv420p(progressive), 1280x720, 25 fps, 25 tbr, 90k tbn

Cam4/5/6 -> ffprobe:

Metadata:
    title           : sample
  Duration: N/A, start: 0.000000, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 2560x1440, 15 fps, 15 tbr, 90k tbn
  Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp

Cam8 -> ffprobe:

Metadata:
    title           : Session Streamed by LIBZRTSP
    comment         : live0.264
  Duration: N/A, start: 0.040000, bitrate: N/A
  Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 2304x1296, 25 tbr, 90k tbn
AlexxIT commented 2 weeks ago

Stream info is a URL from go2rtc WebUI. If you remove stream name from this URL - your will get info for all streams

ilcalmo commented 2 weeks ago

Ok fine, I got it! I attached a text file to avoid a very long msg (more than 1000 lines).

Some sensitive data are replaced with "user:pwd", some cameras url are dynamically generated, so passwords change on each connection. Cam0 is used only from a client. Cam8 is not used, even if configured, since it allows multiple connections, and I let each client to connect directly, to avoid more load to go2rtc.

Thank you.

Stream_Info.txt