datarhei / restreamer

The Restreamer is a complete streaming server solution for self-hosting. It has a visually appealing user interface and no ongoing license costs. Upload your live stream to YouTube, Twitch, Facebook, Vimeo, or other streaming solutions like Wowza. Receive video data from OBS and publish it with the RTMP and SRT server.
https://docs.datarhei.com/restreamer/
Apache License 2.0
3.96k stars 452 forks source link

High CPU usage #508

Open troykelly opened 1 year ago

troykelly commented 1 year ago

Subject of the issue I'm trying to work out why restreamer is using high CPU, it's not for transcoding but I can't see what it's doing that needs so much CPU

Your environment No playersite enabled Multiple network sources via TCP eg tcp://gpu123.example.com:6001, tcp://gpu123.example.com:6002, tcp://gpu123.example.com:6003 etc Multiple mp4/h.264 network sources via hls eg https://iptv001.example.com/050e140537e5468a4341777684dcf488 One of the streams (a video mosaic generated by ffmpeg) will not play in restreamer, but does work via HLS, SRT etc

Screenshot 2023-02-10 at 12 09 43 pm Screenshot 2023-02-10 at 11 59 57 am

Files

{
  "about": {
    "id": "c5517647-c271-4c68-8f4c-c367661ac109",
    "name": "lively-glitter-4368",
    "created_at": "2023-02-10T00:41:25.000Z",
    "version": {
      "number": "16.11.0",
      "repository_commit": "8ba1c8c0ac327224428f8234a4f546e9364198f9",
      "repository_branch": "main",
      "build_date": "2022-11-09T14:41:59Z",
      "arch": "linux/amd64",
      "compiler": "go1.19.3"
    },
    "auths": [
      "localjwt"
    ],
    "app": "datarhei-core",
    "uptime_seconds": 1524
  },
  "ffmpeg": {
    "version": "5.1.2",
    "compiler": "gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)",
    "configuration": "--extra-version=datahrei --prefix=/usr/local --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-cuda --enable-cuvid --enable-nvenc --enable-libnpp --enable-libv4l2 --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-ffprobe --disable-debug --disable-doc",
    "libraries": [
      {
        "name": "libavutil",
        "compiled": "57. 28.100",
        "linked": "57. 28.100"
      },
      {
        "name": "libavcodec",
        "compiled": "59. 37.100",
        "linked": "59. 37.100"
      },
      {
        "name": "libavformat",
        "compiled": "59. 27.100",
        "linked": "59. 27.100"
      },
      {
        "name": "libavdevice",
        "compiled": "59.  7.100",
        "linked": "59.  7.100"
      },
      {
        "name": "libavfilter",
        "compiled": "8. 44.100",
        "linked": "8. 44.100"
      },
      {
        "name": "libswscale",
        "compiled": "6.  7.100",
        "linked": "6.  7.100"
      },
      {
        "name": "libswresample",
        "compiled": "4.  7.100",
        "linked": "4.  7.100"
      },
      {
        "name": "libpostproc",
        "compiled": "56.  6.100",
        "linked": "56.  6.100"
      }
    ]
  },
  "config": {
    "created_at": "2023-02-10T00:41:25.626232347Z",
    "version": 3,
    "id": "c5517647-c271-4c68-8f4c-c367661ac109",
    "name": "lively-glitter-4368",
    "address": ":8080",
    "update_check": true,
    "log": {
      "level": "info",
      "topics": [],
      "max_lines": 1000
    },
    "db": {
      "dir": "/core/config"
    },
    "host": {
      "name": [
        "[anonymized]"
      ],
      "auto": true
    },
    "api": {
      "read_only": false,
      "access": {
        "http": {
          "allow": [],
          "block": []
        },
        "https": {
          "allow": [],
          "block": []
        }
      },
      "auth": {
        "enable": true,
        "disable_localhost": false,
        "username": "[anonymized]",
        "password": "[anonymized]",
        "jwt": {
          "secret": "[anonymized]"
        },
        "auth0": {
          "enable": false,
          "tenants": [
            "[anonymized]"
          ]
        }
      }
    },
    "tls": {
      "address": ":8181",
      "enable": false,
      "auto": false,
      "email": "cert@datarhei.com",
      "cert_file": "",
      "key_file": ""
    },
    "storage": {
      "disk": {
        "dir": "/core/data",
        "max_size_mbytes": 0,
        "cache": {
          "enable": true,
          "max_size_mbytes": 0,
          "ttl_seconds": 300,
          "max_file_size_mbytes": 1,
          "types": {
            "allow": [],
            "block": []
          }
        }
      },
      "memory": {
        "auth": {
          "enable": true,
          "username": "[anonymized]",
          "password": "[anonymized]"
        },
        "max_size_mbytes": 536870912,
        "purge": true
      },
      "cors": {
        "origins": [
          "*"
        ]
      },
      "mimetypes_file": "./mime.types"
    },
    "rtmp": {
      "enable": true,
      "enable_tls": false,
      "address": ":1935",
      "address_tls": ":1936",
      "app": "[anonymized]",
      "token": "[anonymized]"
    },
    "srt": {
      "enable": true,
      "address": ":6002",
      "passphrase": "a6ea5a89bba76828d6ff224637a3a6ae",
      "token": "7510685b75f36696b2bbea65709b9730",
      "log": {
        "enable": false,
        "topics": []
      }
    },
    "ffmpeg": {
      "binary": "ffmpeg",
      "max_processes": 0,
      "access": {
        "input": {
          "allow": [],
          "block": []
        },
        "output": {
          "allow": [],
          "block": []
        }
      },
      "log": {
        "max_lines": 50,
        "max_history": 3
      }
    },
    "playout": {
      "enable": true,
      "min_port": 1025,
      "max_port": 65535
    },
    "debug": {
      "profiling": false,
      "force_gc": 0
    },
    "metrics": {
      "enable": true,
      "enable_prometheus": true,
      "range_sec": 300,
      "interval_sec": 2
    },
    "sessions": {
      "enable": true,
      "ip_ignorelist": [
        "[anonymized]",
        "[anonymized]"
      ],
      "session_timeout_sec": 30,
      "persist": true,
      "persist_interval_sec": 300,
      "max_bitrate_mbit": 0,
      "max_sessions": 0
    },
    "service": {
      "enable": false,
      "token": "[anonymized]",
      "url": "https://service.datarhei.com"
    },
    "router": {
      "blocked_prefixes": [
        "/api"
      ],
      "routes": {},
      "ui_path": "/core/ui"
    }
  },
  "process": {
    "id": "restreamer-ui:ingest:e0c2c3ce-889c-4823-8b40-c11bd5f40f32",
    "type": "ffmpeg",
    "reference": "e0c2c3ce-889c-4823-8b40-c11bd5f40f32",
    "created_at": 1675320031,
    "config": {
      "id": "restreamer-ui:ingest:e0c2c3ce-889c-4823-8b40-c11bd5f40f32",
      "type": "ffmpeg",
      "reference": "e0c2c3ce-889c-4823-8b40-c11bd5f40f32",
      "input": [
        {
          "id": "input_0",
          "address": "tcp://[anonymized]",
          "options": [
            "-fflags",
            "+genpts",
            "-thread_queue_size",
            "512"
          ]
        }
      ],
      "output": [
        {
          "id": "output_0",
          "address": "[f=hls:start_number=0:hls_time=2:hls_list_size=6:hls_flags=append_list+delete_segments+program_date_time+temp_file:hls_delete_threshold=4:hls_segment_filename={memfs^:}/[anonymized]/e0c2c3ce-889c-4823-8b40-c11bd5f40f32_{outputid}.m3u8|[f=flv]{rtmp,name=e0c2c3ce-889c-4823-8b40-c11bd5f40f32.stream}|[f=mpegts]{srt,name=e0c2c3ce-889c-4823-8b40-c11bd5f40f32,mode=publish}",
          "options": [
            "-dn",
            "-sn",
            "-map",
            "0:0",
            "-codec:v",
            "copy",
            "-map",
            "0:2",
            "-codec:a",
            "copy",
            "-metadata",
            "title=https://[anonymized]",
            "-metadata",
            "service_provider=datarhei-Restreamer",
            "-flags",
            "+low_delay+global_header",
            "-tag:v",
            "7",
            "-tag:a",
            "10",
            "-f",
            "tee"
          ],
          "cleanup": [
            {
              "pattern": "memfs:/e0c2c3ce-889c-4823-8b40-c11bd5f40f32**",
              "max_files": 0,
              "max_file_age_seconds": 0,
              "purge_on_delete": true
            },
            {
              "pattern": "memfs:/e0c2c3ce-889c-4823-8b40-c11bd5f40f32_{outputid}.m3u8",
              "max_files": 0,
              "max_file_age_seconds": 24,
              "purge_on_delete": true
            },
            {
              "pattern": "memfs:/e0c2c3ce-889c-4823-8b40-c11bd5f40f32_{outputid}_**.ts",
              "max_files": 12,
              "max_file_age_seconds": 24,
              "purge_on_delete": true
            },
            {
              "pattern": "memfs:/e0c2c3ce-889c-4823-8b40-c11bd5f40f32.m3u8",
              "max_files": 0,
              "max_file_age_seconds": 24,
              "purge_on_delete": true
            }
          ]
        }
      ],
      "options": [
        "-err_detect",
        "ignore_err",
        "-y"
      ],
      "reconnect": true,
      "reconnect_delay_seconds": 15,
      "autostart": true,
      "stale_timeout_seconds": 30,
      "limits": {
        "cpu_usage": 0,
        "memory_mbytes": 0,
        "waitfor_seconds": 0
      }
    },
    "state": {
      "order": "start",
      "exec": "running",
      "runtime_seconds": 1205,
      "reconnect_seconds": -1,
      "last_logline": "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing",
      "progress": {
        "inputs": [
          {
            "id": "input_0",
            "address": "tcp://[anonymized]",
            "index": 0,
            "stream": 0,
            "format": "matroska,webm",
            "type": "video",
            "codec": "h264",
            "coder": "h264",
            "frame": 23350,
            "fps": 17.133,
            "packet": 23350,
            "pps": 17.133,
            "size_kb": 1709114,
            "bitrate_kbit": 10602.933,
            "pix_fmt": "yuv420p",
            "q": 0,
            "width": 1920,
            "height": 1080,
            "avstream": null
          },
          {
            "id": "input_0",
            "address": "tcp://[anonymized]",
            "index": 0,
            "stream": 1,
            "format": "matroska,webm",
            "type": "audio",
            "codec": "aac",
            "coder": "aac",
            "frame": 58,
            "fps": 0,
            "packet": 58,
            "pps": 0,
            "size_kb": 29,
            "bitrate_kbit": 0,
            "q": 0,
            "sampling_hz": 16000,
            "layout": "mono",
            "channels": 1,
            "avstream": null
          },
          {
            "id": "input_0",
            "address": "tcp://[anonymized]",
            "index": 0,
            "stream": 2,
            "format": "matroska,webm",
            "type": "audio",
            "codec": "aac",
            "coder": "aac",
            "frame": 15171,
            "fps": 11.067,
            "packet": 15171,
            "pps": 11.067,
            "size_kb": 8588,
            "bitrate_kbit": 46.4,
            "q": 0,
            "sampling_hz": 16000,
            "layout": "stereo",
            "channels": 2,
            "avstream": null
          },
          {
            "id": "input_0",
            "address": "tcp://[anonymized]",
            "index": 0,
            "stream": 3,
            "format": "matroska,webm",
            "type": "audio",
            "codec": "aac",
            "coder": "aac",
            "frame": 147,
            "fps": 0,
            "packet": 147,
            "pps": 0,
            "size_kb": 49,
            "bitrate_kbit": 0,
            "q": 0,
            "sampling_hz": 48000,
            "layout": "stereo",
            "channels": 2,
            "avstream": null
          },
          {
            "id": "input_0",
            "address": "tcp://[anonymized]",
            "index": 0,
            "stream": 4,
            "format": "matroska,webm",
            "type": "audio",
            "codec": "aac",
            "coder": "aac",
            "frame": 0,
            "fps": 0,
            "packet": 0,
            "pps": 0,
            "size_kb": 0,
            "bitrate_kbit": 0,
            "q": 0,
            "sampling_hz": 48000,
            "layout": "stereo",
            "channels": 2,
            "avstream": null
          },
          {
            "id": "input_0",
            "address": "tcp://[anonymized]",
            "index": 0,
            "stream": 5,
            "format": "matroska,webm",
            "type": "audio",
            "codec": "aac",
            "coder": "aac",
            "frame": 149,
            "fps": 0,
            "packet": 149,
            "pps": 0,
            "size_kb": 51,
            "bitrate_kbit": 0,
            "q": 0,
            "sampling_hz": 48000,
            "layout": "stereo",
            "channels": 2,
            "avstream": null
          }
        ],
        "outputs": [
          {
            "id": "output_0",
            "address": "[f=hls:start_number=0:hls_time=2:hls_list_size=6:hls_flags=append_list+delete_segments+program_date_time+temp_file:hls_delete_threshold=4:hls_segment_filename=http\\\\:/[anonymized]/localhost:6002?mode=caller&transtype=live&streamid=#!:m=publish,r=e0c2c3ce-889c-4823-8b40-c11bd5f40f32,token=7510685b75f36696b2bbea65709b9730&passphrase=a6ea5a89bba76828d6ff224637a3a6ae",
            "index": 0,
            "stream": 0,
            "format": "tee",
            "type": "video",
            "codec": "h264",
            "coder": "copy",
            "frame": 23350,
            "fps": 17.133,
            "packet": 23350,
            "pps": 17.133,
            "size_kb": 1709114,
            "bitrate_kbit": 10602.933,
            "pix_fmt": "yuv420p",
            "q": -1,
            "width": 1920,
            "height": 1080,
            "avstream": null
          },
          {
            "id": "output_0",
            "address": "[f=hls:start_number=0:hls_time=2:hls_list_size=6:hls_flags=append_list+delete_segments+program_date_time+temp_file:hls_delete_threshold=4:hls_segment_filename=http\\\\:/[anonymized]/localhost:6002?mode=caller&transtype=live&streamid=#!:m=publish,r=e0c2c3ce-889c-4823-8b40-c11bd5f40f32,token=7510685b75f36696b2bbea65709b9730&passphrase=a6ea5a89bba76828d6ff224637a3a6ae",
            "index": 0,
            "stream": 1,
            "format": "tee",
            "type": "audio",
            "codec": "aac",
            "coder": "copy",
            "frame": 15171,
            "fps": 11.067,
            "packet": 15171,
            "pps": 11.067,
            "size_kb": 8588,
            "bitrate_kbit": 46.4,
            "q": 0,
            "sampling_hz": 16000,
            "layout": "stereo",
            "channels": 2,
            "avstream": null
          }
        ],
        "frame": 23350,
        "packet": 23350,
        "fps": 17.133,
        "q": -1,
        "size_kb": 1717702,
        "time": 94687.2,
        "bitrate_kbit": 10649.333,
        "speed": 79,
        "drop": 0,
        "dup": 0
      },
      "memory_bytes": 76881920,
      "cpu_usage": 0.5,
      "command": [
        "-err_detect",
        "ignore_err",
        "-y",
        "-fflags",
        "+genpts",
        "-thread_queue_size",
        "512",
        "-i",
        "tcp://[anonymized]",
        "-dn",
        "-sn",
        "-map",
        "0:0",
        "-codec:v",
        "copy",
        "-map",
        "0:2",
        "-codec:a",
        "copy",
        "-metadata",
        "title=https://[anonymized]",
        "-metadata",
        "service_provider=datarhei-Restreamer",
        "-flags",
        "+low_delay+global_header",
        "-tag:v",
        "7",
        "-tag:a",
        "10",
        "-f",
        "tee",
        "[f=hls:start_number=0:hls_time=2:hls_list_size=6:hls_flags=append_list+delete_segments+program_date_time+temp_file:hls_delete_threshold=4:hls_segment_filename=http\\\\:/[anonymized]/localhost:6002?mode=caller&transtype=live&streamid=#!:m=publish,r=e0c2c3ce-889c-4823-8b40-c11bd5f40f32,token=7510685b75f36696b2bbea65709b9730&passphrase=a6ea5a89bba76828d6ff224637a3a6ae"
      ]
    },
    "report": {
      "created_at": 1675990005,
      "prelude": [
        "ffmpeg version 5.1.2-datahrei Copyright (c) 2000-2022 the FFmpeg developers",
        "  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)",
        "  configuration: --extra-version=datahrei --prefix=/[anonymized]/local --extra-cflags=-I/[anonymized]/include --extra-ldflags=-L/[anonymized]/lib64 --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-cuda --enable-cuvid --enable-nvenc --enable-libnpp --enable-libv4l2 --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-ffprobe --disable-debug --disable-doc",
        "  libavutil      57. 28.100 / 57. 28.100",
        "  libavcodec     59. 37.100 / 59. 37.100",
        "  libavformat    59. 27.100 / 59. 27.100",
        "  libavdevice    59.  7.100 / 59.  7.100",
        "  libavfilter     8. 44.100 /  8. 44.100",
        "  libswscale      6.  7.100 /  6.  7.100",
        "  libswresample   4.  7.100 /  4.  7.100",
        "  libpostproc    56.  6.100 / 56.  6.100",
        "Input #0, matroska,webm, from 'tcp://[anonymized]",
        "  Metadata:",
        "    title           : Mosaic",
        "    SERVICE_PROVIDER: ffmpeg",
        "    ENCODER         : Lavf59.27.100",
        "  Duration: N/A, start: 0.000000, bitrate: N/A",
        "  Stream #0:0: Video: h264 (Main), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 1k tbn",
        "    Metadata:",
        "      ENCODER         : Lavc59.37.100 h264_nvenc",
        "  Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp (default)",
        "    Metadata:",
        "      ENCODER         : Lavc59.37.100 aac",
        "  Stream #0:2: Audio: aac (LC), 16000 Hz, stereo, fltp",
        "    Metadata:",
        "      ENCODER         : Lavc59.37.100 aac",
        "  Stream #0:3: Audio: aac (LC), 48000 Hz, stereo, fltp",
        "    Metadata:",
        "      ENCODER         : Lavc59.37.100 aac",
        "  Stream #0:4: Audio: aac, 48000 Hz, stereo, fltp",
        "    Metadata:",
        "      ENCODER         : Lavc59.37.100 aac",
        "  Stream #0:5: Audio: aac (LC), 48000 Hz, stereo, fltp",
        "    Metadata:",
        "      ENCODER         : Lavc59.37.100 aac",
        "[http @ 0x56036ea58400] HTTP error 404 Not Found",
        "Output #0, tee, to '[f=hls:start_number=0:hls_time=2:hls_list_size=6:hls_flags=append_list+delete_segments+program_date_time+temp_file:hls_delete_threshold=4:hls_segment_filename=http\\\\:/[anonymized]/localhost:6002?mode=caller&transtype=live&streamid=#!:m=publish,r=e0c2c3ce-889c-4823-8b40-c11bd5f40f32,token=7510685b75f36696b2bbea65709b9730&passphrase=a6ea5a89bba76828d6ff224637a3a6ae':",
        "  Metadata:",
        "    service_provider: datarhei-Restreamer",
        "    title           : https://[anonymized]",
        "    encoder         : Lavf59.27.100",
        "  Stream #0:0: Video: h264 (Main) ([7][0][0][0] / 0x0007), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 24 fps, 24 tbr, 24 tbn",
        "    Metadata:",
        "      ENCODER         : Lavc59.37.100 h264_nvenc",
        "  Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 16000 Hz, stereo, fltp",
        "    Metadata:",
        "      ENCODER         : Lavc59.37.100 aac"
      ],
      "log": [
        [
          "1675991158",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991158",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991161",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991161",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991161",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991163",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991163",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991166",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991166",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991166",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991168",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991168",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991171",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991171",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991171",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991173",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991173",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991176",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991176",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991176",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991179",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991179",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991181",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991181",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991181",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991184",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991184",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991187",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991187",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991187",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991189",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991189",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991192",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991192",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991192",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991194",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991194",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991197",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991197",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991197",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991200",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991200",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991203",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991203",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991203",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991206",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991206",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991209",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991209",
          "[mpegts @ 0x56036ea599c0] Opening 'http://[anonymized] for writing"
        ],
        [
          "1675991209",
          "[hls @ 0x56036ea59d40] Opening 'http://[anonymized] for writing"
        ]
      ],
      "history": [
        {
          "created_at": 1675989960,
          "prelude": [
            "ffmpeg version 5.1.2-datahrei Copyright (c) 2000-2022 the FFmpeg developers",
            "  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)",
            "  configuration: --extra-version=datahrei --prefix=/[anonymized]/local --extra-cflags=-I/[anonymized]/include --extra-ldflags=-L/[anonymized]/lib64 --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-cuda --enable-cuvid --enable-nvenc --enable-libnpp --enable-libv4l2 --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-ffprobe --disable-debug --disable-doc",
            "  libavutil      57. 28.100 / 57. 28.100",
            "  libavcodec     59. 37.100 / 59. 37.100",
            "  libavformat    59. 27.100 / 59. 27.100",
            "  libavdevice    59.  7.100 / 59.  7.100",
            "  libavfilter     8. 44.100 /  8. 44.100",
            "  libswscale      6.  7.100 /  6.  7.100",
            "  libswresample   4.  7.100 /  4.  7.100",
            "  libpostproc    56.  6.100 / 56.  6.100",
            "[tcp @ 0x555c60c10340] Connection to tcp://[anonymized] failed: Cannot assign requested address",
            "tcp://[anonymized] Cannot assign requested address"
          ],
          "log": [
            [
              "1675989960",
              "ffmpeg version 5.1.2-datahrei Copyright (c) 2000-2022 the FFmpeg developers"
            ],
            [
              "1675989960",
              "  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)"
            ],
            [
              "1675989960",
              "  configuration: --extra-version=datahrei --prefix=/[anonymized]/local --extra-cflags=-I/[anonymized]/include --extra-ldflags=-L/[anonymized]/lib64 --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-cuda --enable-cuvid --enable-nvenc --enable-libnpp --enable-libv4l2 --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-ffprobe --disable-debug --disable-doc"
            ],
            [
              "1675989960",
              "  libavutil      57. 28.100 / 57. 28.100"
            ],
            [
              "1675989960",
              "  libavcodec     59. 37.100 / 59. 37.100"
            ],
            [
              "1675989960",
              "  libavformat    59. 27.100 / 59. 27.100"
            ],
            [
              "1675989960",
              "  libavdevice    59.  7.100 / 59.  7.100"
            ],
            [
              "1675989960",
              "  libavfilter     8. 44.100 /  8. 44.100"
            ],
            [
              "1675989960",
              "  libswscale      6.  7.100 /  6.  7.100"
            ],
            [
              "1675989960",
              "  libswresample   4.  7.100 /  4.  7.100"
            ],
            [
              "1675989960",
              "  libpostproc    56.  6.100 / 56.  6.100"
            ],
            [
              "1675989960",
              "[tcp @ 0x555c60c10340] Connection to tcp://[anonymized] failed: Cannot assign requested address"
            ],
            [
              "1675989960",
              "tcp://[anonymized] Cannot assign requested address"
            ]
          ]
        },
        {
          "created_at": 1675989975,
          "prelude": [
            "ffmpeg version 5.1.2-datahrei Copyright (c) 2000-2022 the FFmpeg developers",
            "  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)",
            "  configuration: --extra-version=datahrei --prefix=/[anonymized]/local --extra-cflags=-I/[anonymized]/include --extra-ldflags=-L/[anonymized]/lib64 --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-cuda --enable-cuvid --enable-nvenc --enable-libnpp --enable-libv4l2 --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-ffprobe --disable-debug --disable-doc",
            "  libavutil      57. 28.100 / 57. 28.100",
            "  libavcodec     59. 37.100 / 59. 37.100",
            "  libavformat    59. 27.100 / 59. 27.100",
            "  libavdevice    59.  7.100 / 59.  7.100",
            "  libavfilter     8. 44.100 /  8. 44.100",
            "  libswscale      6.  7.100 /  6.  7.100",
            "  libswresample   4.  7.100 /  4.  7.100",
            "  libpostproc    56.  6.100 / 56.  6.100",
            "[tcp @ 0x5602fe5a5340] Connection to tcp://[anonymized] failed: Cannot assign requested address",
            "tcp://[anonymized] Cannot assign requested address"
          ],
          "log": [
            [
              "1675989975",
              "ffmpeg version 5.1.2-datahrei Copyright (c) 2000-2022 the FFmpeg developers"
            ],
            [
              "1675989975",
              "  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)"
            ],
            [
              "1675989975",
              "  configuration: --extra-version=datahrei --prefix=/[anonymized]/local --extra-cflags=-I/[anonymized]/include --extra-ldflags=-L/[anonymized]/lib64 --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-cuda --enable-cuvid --enable-nvenc --enable-libnpp --enable-libv4l2 --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-ffprobe --disable-debug --disable-doc"
            ],
            [
              "1675989975",
              "  libavutil      57. 28.100 / 57. 28.100"
            ],
            [
              "1675989975",
              "  libavcodec     59. 37.100 / 59. 37.100"
            ],
            [
              "1675989975",
              "  libavformat    59. 27.100 / 59. 27.100"
            ],
            [
              "1675989975",
              "  libavdevice    59.  7.100 / 59.  7.100"
            ],
            [
              "1675989975",
              "  libavfilter     8. 44.100 /  8. 44.100"
            ],
            [
              "1675989975",
              "  libswscale      6.  7.100 /  6.  7.100"
            ],
            [
              "1675989975",
              "  libswresample   4.  7.100 /  4.  7.100"
            ],
            [
              "1675989975",
              "  libpostproc    56.  6.100 / 56.  6.100"
            ],
            [
              "1675989975",
              "[tcp @ 0x5602fe5a5340] Connection to tcp://[anonymized] failed: Cannot assign requested address"
            ],
            [
              "1675989975",
              "tcp://[anonymized] Cannot assign requested address"
            ]
          ]
        },
        {
          "created_at": 1675989990,
          "prelude": [
            "ffmpeg version 5.1.2-datahrei Copyright (c) 2000-2022 the FFmpeg developers",
            "  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)",
            "  configuration: --extra-version=datahrei --prefix=/[anonymized]/local --extra-cflags=-I/[anonymized]/include --extra-ldflags=-L/[anonymized]/lib64 --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-cuda --enable-cuvid --enable-nvenc --enable-libnpp --enable-libv4l2 --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-ffprobe --disable-debug --disable-doc",
            "  libavutil      57. 28.100 / 57. 28.100",
            "  libavcodec     59. 37.100 / 59. 37.100",
            "  libavformat    59. 27.100 / 59. 27.100",
            "  libavdevice    59.  7.100 / 59.  7.100",
            "  libavfilter     8. 44.100 /  8. 44.100",
            "  libswscale      6.  7.100 /  6.  7.100",
            "  libswresample   4.  7.100 /  4.  7.100",
            "  libpostproc    56.  6.100 / 56.  6.100",
            "[tcp @ 0x559d51a36340] Connection to tcp://[anonymized] failed: Cannot assign requested address",
            "tcp://[anonymized] Cannot assign requested address"
          ],
          "log": [
            [
              "1675989990",
              "ffmpeg version 5.1.2-datahrei Copyright (c) 2000-2022 the FFmpeg developers"
            ],
            [
              "1675989990",
              "  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)"
            ],
            [
              "1675989990",
              "  configuration: --extra-version=datahrei --prefix=/[anonymized]/local --extra-cflags=-I/[anonymized]/include --extra-ldflags=-L/[anonymized]/lib64 --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-static --enable-openssl --enable-libxml2 --enable-cuda --enable-cuvid --enable-nvenc --enable-libnpp --enable-libv4l2 --enable-libfreetype --enable-libsrt --enable-libx264 --enable-libx265 --enable-libvpx --enable-libmp3lame --enable-libopus --enable-libvorbis --disable-ffplay --disable-ffprobe --disable-debug --disable-doc"
            ],
            [
              "1675989990",
              "  libavutil      57. 28.100 / 57. 28.100"
            ],
            [
              "1675989990",
              "  libavcodec     59. 37.100 / 59. 37.100"
            ],
            [
              "1675989990",
              "  libavformat    59. 27.100 / 59. 27.100"
            ],
            [
              "1675989990",
              "  libavdevice    59.  7.100 / 59.  7.100"
            ],
            [
              "1675989990",
              "  libavfilter     8. 44.100 /  8. 44.100"
            ],
            [
              "1675989990",
              "  libswscale      6.  7.100 /  6.  7.100"
            ],
            [
              "1675989990",
              "  libswresample   4.  7.100 /  4.  7.100"
            ],
            [
              "1675989990",
              "  libpostproc    56.  6.100 / 56.  6.100"
            ],
            [
              "1675989990",
              "[tcp @ 0x559d51a36340] Connection to tcp://[anonymized] failed: Cannot assign requested address"
            ],
            [
              "1675989990",
              "tcp://[anonymized] Cannot assign requested address"
            ]
          ]
        }
      ]
    }
  }
}

Steps to reproduce It's happening all the time for me

Awesome ⭐⭐⭐⭐⭐ The restreamer server is public facing - I will send the URL to support@datarhei.com with the issue number

Expected behavior There's no transcoding - so I wouldn't expect CPU to be so high.

Actual behavior High CPU use

jstabenow commented 1 year ago

Hey @troykelly Thanks for your detailed report.

What CPU do you use? Compared to HTTP and RTMP, SRT requires more CPU power. Please have a look if this is the reason. Thank you very much.

troykelly commented 1 year ago

Thanks @jstabenow Intel(R) Core(TM) i9-10940X CPU @ 3.30GHz running VMWare The VM running restreamer is: CPU: 8 vCPUs Memory: 32 GB Hard disk 1 50 GB Hard disk 2 1,024 GB Hard disk 3 50 GB PCI device 0 TU106 [GeForce RTX 2060 SUPER] PCI device 1 TU106 High Definition Audio Controller PCI device 2 TU106 USB 3.1 Host Controller PCI device 3 TU106 USB Type-C UCSI Controller

It seems the high CPU is just receiving the stream (via tcp://) even with no clients it gets to 100% CPU after a while. One stream is far worse than the others (the mosaic stream).

This is new behaviour, but unfortunately, I'm not sure if the container updated and it's a new restreamer version or not

Is there any way to interrogate what is going on in more detail? Perhaps there is transcoding happening (although it's not set to do that)

rahtechonline commented 1 year ago

Hi,

I am exactly facing the same issue, I have vCPU - 10 with 60GB of RAM and every time the CPU utilization shows above 80%. And when users starts viewing the video stream it reaches up to 99%.

Kindly provide a solution on the same.

image

troykelly commented 1 year ago

@rahtechonline I had to stop using restreamer - there just seems to be something that's causing CPU's to run away. I'm now just using ffmpeg in a docker container.

rahtechonline commented 1 year ago

Is there any better solution, where I can publish 100s of LIVE CCTV camera and get the direct web URL of those camera and along with that monitor all the camera from the web panel

Any alternative to restreamer or and way to handle the CPU load.

troykelly commented 1 year ago

That doesn't sound like a restreamer issue - it just sounds like a massive amount of processing is needed for what you want to achieve. Was this working with restreamer historically? My issue was that I had restreamer handling 8 or so streams + GPU transcoding very well, then suddenly started needing a tonne of CPU to do the same job it had done before.

Are you transcoding? How are you publishing? HLS, RTSP, WebRTC? Some publishing modalities will require significant system resources (memory, disk, etc)

rahtechonline commented 1 year ago

I am new to this application and have deployed it recently.

When I deployed this with the active cameras it was taking the CPUs between 60% - 80%, but from last 2-3 days it continuously CPU is showing above 98%.

The ./bin/core is consuming the highest amount of CPU above 70%.

I just wanted to us the LIVE stream through the player URL and nothing else as of now. Is there anything where we can stop FFMPEG or some other resources, which can smoothen the server, but provide me the LIVE stream through player URL.

troykelly commented 1 year ago

It might be best to ask this on the ffmpeg mail list - I'm not sure if turning this ticket into a discovery of what you need is the right place for the conversation.

If you think that there is a similar issue with excessive CPU usage, you will need to provide the same information that I did up the top of the ticket so the restreamer gurus can analyse it.