question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Config Support]: ffmpeg still runs a decode + fps + scale stream even though detect is disabled

See original GitHub issue

Describe the problem you are having

I’m currently planning on using Frigate just for recording at night, no detection for now. As far as I can tell from the docs, the RTMP and record streams simply remux the existing h264 stream without any processing.

However, ffmpeg is still running with ~20% CPU usage (on an i3), and I suspect because it has the -r 5 -s 1280x720 command line args attached. My camera has a 15fps 1080p stream.

Is this intended? Since I have detect disabled, there’s no reason for this low fps, scaled stream to be running at all? If intended, is there any way to reduce my CPU usage further then? I don’t care about motion or object detection at all right now.

Version

0.11.1-2EADA21

Frigate config file

mqtt:
  host: localhost
  user: <redacted>
  password: <redacted>

ffmpeg: # I've tried both with and without this -- it does actually help since that scaling stream exists, but ideally I shouldn't need it at all because no decoding should be happening
  hwaccel_args: -c:v h264_cuvid

record:
  enabled: True
  retain:
    days: 7
    mode: all

detect:
  enabled: False

birdseye:
  enabled: False

cameras:
  tapo_c200_living_room:
    ffmpeg:
      inputs:
        - path: rtsp://redacted:redacted@192.168.1.82/stream1
          roles:
            - record
            - rtmp

Relevant log output

FFmpeg full command line args:

ffmpeg -hide_banner -loglevel warning -c:v h264_cuvid -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1 -i rtsp://redacted:redacted@192.168.1.82/stream1 -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an /tmp/cache/tapo_c200_living_room-%Y%m%d%H%M%S.mp4 -c copy -f flv rtmp://127.0.0.1/live/tapo_c200_living_room -r 5 -s 1280x720 -f rawvideo -pix_fmt yuv420p pipe:

Frigate logs

[2022-10-15 17:59:55] frigate.app                    INFO    : Starting Frigate (0.11.1-2eada21)
Starting migrations
[2022-10-15 17:59:55] peewee_migrate                 INFO    : Starting migrations
There is nothing to migrate
[2022-10-15 17:59:55] peewee_migrate                 INFO    : There is nothing to migrate
[2022-10-15 17:59:55] frigate.mqtt                   INFO    : Turning off recordings for tapo_c200_living_room via mqtt
[2022-10-15 17:59:55] detector.cpu                   INFO    : Starting detection process: 216
[2022-10-15 17:59:55] frigate.edgetpu                WARNING : CPU detectors are not recommended and should only be used for testing or for trial purposes.
[2022-10-15 17:59:55] frigate.app                    INFO    : Output process started: 218
[2022-10-15 17:59:55] ws4py                          INFO    : Using epoll
[2022-10-15 17:59:55] frigate.app                    INFO    : Camera processor started for tapo_c200_living_room: 222
[2022-10-15 17:59:55] frigate.app                    INFO    : Capture process started for tapo_c200_living_room: 223
[2022-10-15 17:59:55] ws4py                          INFO    : Using epoll

Frigate stats

{
  "detection_fps": 0.0,
  "detectors": {
    "cpu": {
      "detection_start": 0.0,
      "inference_speed": 10.0,
      "pid": 217
    }
  },
  "service": {
    "latest_version": "0.11.1",
    "storage": {
      "/dev/shm": {
        "free": 65.4,
        "mount_type": "tmpfs",
        "total": 67.1,
        "used": 1.7
      },
      "/media/frigate/clips": {
        "free": 11399867.7,
        "mount_type": "zfs",
        "total": 11399868.7,
        "used": 1.0
      },
      "/media/frigate/recordings": {
        "free": 11399867.7,
        "mount_type": "zfs",
        "total": 11399868.7,
        "used": 1.0
      },
      "/tmp/cache": {
        "free": 999.2,
        "mount_type": "tmpfs",
        "total": 1000.0,
        "used": 0.8
      }
    },
    "temperatures": {},
    "uptime": 12133,
    "version": "0.11.1-2eada21"
  },
  "tapo_c200_living_room": {
    "camera_fps": 5.0,
    "capture_pid": 222,
    "detection_fps": 0.0,
    "pid": 221,
    "process_fps": 5.0,
    "skipped_fps": 0.0
  }
}

Operating system

Other Linux

Install method

Docker Compose

Coral version

CPU (no coral)

Any other information that may be helpful

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
blakeblackshearcommented, Oct 15, 2022

This is a duplicate. Currently frigate does not function without at least one stream being decoded since the live view and the rest of the UI depend on it. Some have set the detect stream to a solid black small frame to minimize CPU load. That’s what you will see in the UI, but recordings will work.

0reactions
bitnimblecommented, Oct 15, 2022

Perfect, thanks for the confirmation. Would be lovely to have this option supported first-class in the future but this workaround is good enough for me 😃

For future readers, you can get the 2x2 black square video here: https://github.com/blakeblackshear/frigate/issues/1911#issuecomment-1182952523

Read more comments on GitHub >

github_iconTop Results From Across the Web

ffmpeg Documentation
Selecting which streams from which inputs will go into which output is either done automatically or with the -map option (see the Stream...
Read more >
ffmpeg Documentation
The decoder produces uncompressed frames (raw video/PCM audio/. ... Matches streams with usable configuration, the codec must be defined and the essential ...
Read more >
MP4 with HEVC keyint=2 not decoded properly due to edit list ...
Problem: HEVC streams encoded with short key intervals (2,4,...) inside MP4 cannot be decoded properly. Description: The first few frames (probably the ...
Read more >
ffplay Documentation - FFmpeg
Matches streams with usable configuration, the codec must be defined and the ... Specify the frame rate of a video, expressed as the...
Read more >
Hardware/VAAPI - FFmpeg Wiki
No other codecs are supported by Mesa for encode yet. ... With the decode hwaccel, each input stream can then be given a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found