Why are my clips/recordings low quality? (mainstream)

Hi all,

So I’m new to Frigate (and programming in general, literally never done anything like this) so please be kind.

I’ve managed to get it working as an nvidia docker in Unraid. Currently my GPU isn’t being forwarded to any VM, and I’ve filled out the docker template as described in the documentation.

I’ve got it running off a single camera at the moment. Unfortunately however, it’s an Annke C800, which is a 4K model which outputs exclusively to h265 (no h264 output).

I’ve previously read that this shouldn’t be a problem unless I want to display this feed within lovelace, and I guess I’ll have to live with that - but WHY in hell are my clips/recordings looking like garbage? There’s compression artifacts everywhere.

When I stream the video straight from the RSTP feed, it looks crisp and amazing. Isn’t Frigate only supposed to be taking the raw video from the camera and not doing any processing to it? Before you ask, it’s definitely, 100% the main stream (4K). I’ve verified this by playing the exact same URL in VLC and selecting media options and seeing the resolution is 3840x2160.

Here’s my config:

  # Required: host name
  # Optional: port (default: shown below)
  port: 1883
  # Optional: topic prefix (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  topic_prefix: frigate
  # Optional: client id (default: shown below)
  # WARNING: must be unique if you are running multiple instances
  client_id: frigate
  # Optional: user
  user: !secret
  # Optional: password
  # NOTE: Environment variables that begin with 'FRIGATE_' may be referenced in {}.
  #       eg. password: '{FRIGATE_MQTT_PASSWORD}'
  password: !secret
  # Optional: interval in seconds for publishing stats (default: shown below)
  stats_interval: 60
        - -c:v
        - hevc_cuvid
        - path: rtsp://!secret:[email protected]:554/Streaming/Channels/101
            - detect
            - clips
        record: -f segment -segment_time 60 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy
        clips: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy
    width: 3840
    height: 2160
    fps: 5
        - person
        - mouse
        - car
        - motorcycle
        - bird
        - cat
        - dog
      enabled: true
      timestamp: false
      bounding_box: true
        default: 30
      enabled: true
        default: 30
      enabled: true

    type: cpu
    type: cpu

The only reason I’ve added the default output args is because I want audio included with my clips - otherwise I haven’t changed them from the default ones specified in the documentation.

What am I doing wrong? Surely this isn’t normal.

Also, what can I do to increase the camera display fps without changing the detect fps? Currently the live view within the frigate webUI is 5 fps, but I want to increase it to the full 15fps.

Thanks for any help.

My limited understanding of these systems is that you supply a second low resolution stream from the camera for image processing but record the high resolution stream on demand when an object or movement is detected.

You must be recording the low-res stream.

It’s not. It’s definitely, 100% the main stream (4K). I’ve verified this by playing the exact same URL in VLC and selecting media options and seeing the resolution is 3840x2160.

Any ideas?

I have not yet started messing with Frigate (it’s on the to-do list), hopefully someone more experienced can help you.

I might be wrong here, but can’t a stream contain multiple bitrates and resolutions, negotiated with the client?

Yes but I’ve not yet seen a security camera that supports adaptive bitrate streaming.

1 Like

Random thought: You say you didn’t forwarded the GPU but you are forcing GPU-based decode (“hevc_cuvid”).

Did you try without the input_args?

I said the GPU isn’t forwarded to a VM, so it’s available for use with Frigate. Those are the input arguments for Nvidia right? If so, then it’s correct.

What is the connection between frigate and the camera. When I started with frigate I was using a powerline adapter between dvr and frigate and it couldn’t provide the bandwidth required.
A decent 4k camera should be using 8 Meg a sec bitrate.
Also ensure its not variable bit rate as I had to change the dvr to constant bit rate

Ah. I thought Frigate was running inside a VM.
Still worth testing with letting ffmpeg do it’s magic, though, so removing input_args

EDIT: BTW, I assume you tried to visualize your clips with a “eat-all” player like VLC, right?

What is the connection between frigate and the camera?

The camera is running through a PoE switch, which is running to my router, which is running to my Unraid server where Frigate is running in a docker.

Every link and component is gigabit ethernet.

But if I do that, it will no longer be hardware accelerated, right? What’s the point then?

If you mean did I play the clips in VLC, then yes, and they still look like ass.

The camera is set to constant bit rate at 16384 Kbps.

That’s what is called “debugging”. The point is to pinpoint the root cause of an issue.
An alternative is “stare blankly at code, call for help, then ignore suggestions”, but it has been proven less efficient. :slight_smile:


To drive @koying’s point home… When you find out the root cause, you can then start searching for a solution to the root cause, which may be an additional param or different set of params.

1 Like

Ok I’m not sure how it happened, but without changing anything, it seems to have fixed itself. I wish I knew how, so I can prevent it from happening again.

While we’re at it, does anyone know how to achieve the following?:

  1. Somehow improve the ‘events’ interface, at least filtering by date. What if I want to see an event from last week? I’d have to scroll for ages.

  2. Increase display (not detect) fps on the ‘live’ view.

  3. Fix issue where during the same clip, Frigate will detect an additional trigger and cause the creation of a duplicate/overlapping clip.

  4. Somehow get this h265-only camera displaying a live feed on HA. Doesn’t matter if it’s the main or sub stream (both are h265-only), but preferably with sound and full 15fps.