Tapo Cameras with Frigate

I am having trouble configuring my Frigate Config file to work with my Tapo Cameras.

I was using this as my guideline: Tapo cameras, frigate, go2rtc - I cannot figure out how to pass audio

However I cannot get it working.

Here is my config data:

mqtt:
host: 192.168.10.10
user: mqtt-user
password: myPassword

go2rtc:
streams:
driveway:
- rtsp://driveway-cam:[email protected]:554/stream1
driveway_sub:
- rtsp://driveway-cam:[email protected]:554/stream2

cameras:
driveway:
ffmpeg:
#output_args:
#record: preset-record-generic-audio-copy
inputs:
- path: rtsp://192.168.10.11:8554/driveway
input_args: preset-rtsp-restream
roles:
- record
- path: rtsp://192.168.10.11:8554/driveway_sub
input_args: preset-rtsp-restream
roles:
- detect
live:
stream_name: driveway

detectors:
cpu1:
type: cpu
cpu2:
type: cpu

Please make sure you correctly indent your code and use the code snippet thingyimage So it’s clear if you have a code issue.

Here is my code for tapo cameras, hope it helps:

mqtt:
  host: mqtt-server-ip
  user: un
  password: pw

go2rtc:
  streams:
    dn_dr_1_cam: 
      - rtsp://un:pw@ip:554/stream1
      - "ffmpeg:dn_dr_1_cam#audio=aac" 
    dn_dr_1_cam_sub: 
      - rtsp://un:pw@ip::554/stream2

cameras:
  dn_dr_1_cam:
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/dn_dr_1_cam
          input_args: preset-rtsp-restream
          roles:
            - record
        - path: rtsp://127.0.0.1:8554/dn_dr_1_cam_sub # <--- the name here must match the name of the camera_sub in restream
          input_args: preset-rtsp-restream
          roles:
            - detect
    live:
        stream_name: dn_dr_1_cam_sub

detectors: 
  coral:
    type: edgetpu
    device: usb
  # cpu1:
  #   type: cpu
  # cpu2:
  #   type: cpu

objects:...
birdseye:...
record:...
detect:...
snapshots:...
ffmpeg:...
7 Likes

Thank you.
The code is indented properly, it just pasted that way.

I will copy your code and adjust it to my details, thank you.


Im not winning. Here is my errors… (I copied and pasted your code, just changed the camera names, accounts details and ip addresses).

Thank you.

Sorry, i was not clear.
I have shortened the last part of the setup.
Here it is all again, after cameras:

detectors: 
  coral:
    type: edgetpu
    device: usb
  # cpu1:
  #   type: cpu
  # cpu2:
  #   type: cpu


objects:
  # Optional: list of objects to track from labelmap.txt (default: shown below)
  track:
    - person
    - dog
    # -cat
    # - car
    # - tv
birdseye:
  # Optional: Enable birdseye view (default: shown below)
  enabled: true
  mode: motion

record:
  # Optional: Enable recording (default: shown below)
  # WARNING: If recording is disabled in the config, turning it on via 
  #          the UI or MQTT later will have no effect.
  # WARNING: Frigate does not currently support limiting recordings based
  #          on available disk space automatically. If using recordings,
  #          you must specify retention settings for a number of days that
  #          will fit within the available disk space of your drive or Frigate
  #          will crash.
  enabled: True
  # Optional: Number of minutes to wait between cleanup runs (default: shown below)
  # This can be used to reduce the frequency of deleting recording segments from disk if you want to minimize i/o
  expire_interval: 120
  # Optional: Retention settings for recording
  retain:
    # Optional: Number of days to retain recordings regardless of events (default: shown below)
    # NOTE: This should be set to 0 and retention should be defined in events section below
    #       if you only want to retain recordings of events.
    days: 0
    # Optional: Mode for retention. Available options are: all, motion, and active_objects
    #   all - save all recording segments regardless of activity
    #   motion - save all recordings segments with any detected motion
    #   active_objects - save all recording segments with active/moving objects
    # NOTE: this mode only applies when the days setting above is greater than 0
    mode: all
  # Optional: Event recording settings
  events:
    # Optional: Number of seconds before the event to include (default: shown below)
    pre_capture: 5
    # Optional: Number of seconds after the event to include (default: shown below)
    post_capture: 5
    # Optional: Objects to save recordings for. (default: all tracked objects)
    objects:
      - person
    # Optional: Restrict recordings to objects that entered any of the listed zones (default: no required zones)
    required_zones: []
    # Optional: Retention settings for recordings of events
    retain:
      # Required: Default retention days (default: shown below)
      default: 20
      # Optional: Mode for retention. (default: shown below)
      #   all - save all recording segments for events regardless of activity
      #   motion - save all recordings segments for events with any detected motion
      #   active_objects - save all recording segments for event with active/moving objects
      #
      # NOTE: If the retain mode for the camera is more restrictive than the mode configured
      #       here, the segments will already be gone by the time this mode is applied.
      #       For example, if the camera retain mode is "motion", the segments without motion are
      #       never stored, so setting the mode to "all" here won't bring them back.
      mode: motion
      # Optional: Per object retention days
      objects:
        person: 30
  # Optional: Event recording settings


detect:
  # Optional: width of the frame for the input with the detect role (default: shown below)
  # width: 1280
  width: 640
  # Optional: height of the frame for the input with the detect role (default: shown below)
  # height: 7201
  height: 360
  # Optional: desired fps for your camera for the input with the detect role (default: shown below)
  # NOTE: Recommended value of 5. Ideally, try and reduce your FPS on the camera.
  fps: 15
  # Optional: enables detection for the camera (default: True)
  # This value can be set via MQTT and will be updated in startup based on retained value
  enabled: True
  # Optional: Number of frames without a detection before frigate considers an object to be gone. (default: 5x the frame rate)
  max_disappeared: 25
  # Optional: Configuration for stationary object tracking
  stationary:
    # Optional: Frequency for confirming stationary objects (default: shown below)
    # When set to 0, object detection will not confirm stationary objects until movement is detected.
    # If set to 10, object detection will run to confirm the object still exists on every 10th frame.
    interval: 10
    # Optional: Number of frames without a position change for an object to be considered stationary (default: 10x the frame rate or 10s)
    threshold: 50
    # Optional: Define a maximum number of frames for tracking a stationary object (default: not set, track forever)
    # This can help with false positives for objects that should only be stationary for a limited amount of time.
    # It can also be used to disable stationary object tracking. For example, you may want to set a value for person, but leave
    # car at the default.
    # WARNING: Setting these values overrides default behavior and disables stationary object tracking.
    #          There are very few situations where you would want it disabled. It is NOT recommended to
    #          copy these values from the example config into your config unless you know they are needed.
    max_frames:
      # Optional: Default for all object types (default: not set, track forever)
      default: 3000
      # Optional: Object specific values
      objects:
        person: 1000

snapshots:
  # Optional: Enable writing jpg snapshot to /media/frigate/clips (default: shown below)
  # This value can be set via MQTT and will be updated in startup based on retained value
  enabled: True
  # Optional: save a clean PNG copy of the snapshot image (default: shown below)
  clean_copy: True
  # Optional: print a timestamp on the snapshots (default: shown below)
  timestamp: False
  # Optional: draw bounding box on the snapshots (default: shown below)
  bounding_box: False
  # Optional: crop the snapshot (default: shown below)
  crop: False
  # Optional: height to resize the snapshot to (default: original size)
  # height: 175
  # Optional: Restrict snapshots to objects that entered any of the listed zones (default: no required zones)
  required_zones: []
  # Optional: Camera override for retention settings (default: global values)
  retain:
    # Required: Default retention days (default: shown below)
    default: 10
    # Optional: Per object retention days
    objects:
      person: 15

# Optional: ffmpeg configuration
ffmpeg:
  # Optional: global ffmpeg args (default: shown below)
  global_args: -hide_banner -loglevel warning
  # Optional: global hwaccel args (default: shown below)
  # NOTE: See hardware acceleration docs for your specific device
  hwaccel_args: -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format yuv420p
  # Optional: global input args (default: shown below)
  input_args: -avoid_negative_ts make_zero -fflags +genpts+discardcorrupt -rtsp_transport tcp -timeout 5000000 -use_wallclock_as_timestamps 1
  # Optional: global output args
  output_args:
    # Optional: output args for detect streams (default: shown below)
    detect: -f rawvideo -pix_fmt yuv420p
    # Optional: output args for record streams (default: shown below)
    record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c copy -an

Thank you. Ive added everything.
Still not winning! (the detectors field is there)

Do you get some error on the frigate logs when it’s starting up?
Go to settings->addons->frigate, and click on logs on the top center, maybe that will help you out to figure out what’s wrong.

Also, you have posted your passwords on the screenshots. Be sure to change them and not use them somewhere else.

Hi there,
Thank you.
Here is the logs:

Did you find any difference using coral?

and did you manage to get the GPU stats? as I know will get this message:
There was an error getting usage stats. This does not mean hardware acceleration is not working. Either your GPU does not support this or Frigate does not have proper access to get statistics. This is expected for the Home Assistant addon.

I have not messed with GPU at all.
I have a coral doing the hard lifting but i had it since i set up my machine, so i can’t really compare between cpu/coral.
All i know is the cpu would not have been able to handle 12 cams as my coral does today (with no sweat)
It seems from your error logs that there’s an issue in the snapshots part of the code (remove the
whole part and use the default values for now - see if the message goes away.
There’s another issue in the cameras: part that you need to troubleshoot. It seems you have some extra fields under the drivewa_cam that are not accepted, try something under the live: part.

I installed Coral, and it is working now, thank you :slightly_smiling_face:

1 Like

i have the problem with my cameras tapo. I received entrada: Unable to read frames from ffmpeg process.

mqtt:
  host: host_mqtt
  enabled: True
  user: user_mqtt
  password: pass_mqtt

go2rtc:
  streams:
    entrada: 
      - rtsp://user:pass@ip_cam_entrada:554/stream1
      - "ffmpeg:entrada#audio=aac" 

cameras:
  entrada:
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
        - path: rtsp://127.0.0.1:8554/entrada
          input_args: preset-rtsp-restream
          roles:
            - record
            - detect
    live:
        stream_name: entrada

detectors: 
  cpu1:
    type: cpu
  cpu2:
    type: cpu

ffmpeg:
  hwaccel_args: preset-intel-qsv-h264

can you help me?

Not sure if you solved this issue yet or not, but I noticed that with my Tapo cameras, if i had them blocked from the internet when Frigate restarts, the ffmpeg process crashes or never starts. If you are blocking them from the internet, try unblocking them, restart frigate, then once everything is working, you can reblock through your router.

If that doesnt help, update the firmware on the camera and reboot it through the Tapo app.

1 Like

Hi krash!

Just want to say thank you here, this config helped me a lot on the setup for recording audio in the TP-Link C340
I leave this model here for google to index because apparently works the same as Tapo

Tnx! :+1::+1:

1 Like

I see this issue is still open - it’s the closest I can find to my problem, but I may have to start a new thread. I have a Tapo C100 set up in Frigate and it works. I got a new one today and the Frigate log says “WRN [rtsp] error=“streams: wrong user/pass, exec: exit status 1” stream=”. I used the same username and password in account settings for the new camera. That gave me the error so I changed to a unique username and password - still get the error. I can pull the stream up in VLC either way. Saw somewhere to reboot the camera with the app - no dice. Also saw one that said Tapo cams have a limited amount of connections - so why does one work and not the other? And why does it work in VLC?

Did you find a solution yet? It’s exactly the same for me here.

I completely forgot about my post/question. I seemed to have figured it out as the camera is working in Frigate now - at least partly. I only have the main stream. I see in the Tapo app that there is only one setting for “video and display” so I’m thinking there isn’t a substream. Why VLC comes up with stream2 for the other camera I don’t know. Also stream2 works as a sub in Frigate for 1 camera but not the other. All settings look the same and firmware is the same version. No big deal I guess since it’s only 1080p - if it was I could lower resolution. Frigate says CPU is 3% on either Tapo - my 2 Reolink Lumus are at 15.6% each according to Frigate and I don’t have the option to lower from 1920x1080. I won’t be using Lumus when these crap out although I really like the image quality, spotlight on motion, and 2 way audio.

Hi all, i have a tapo c212 configured and working in frigate, but now i wold like to add onvif ptz controls. Someone know how to do this?

go2rtc:
  streams:
    cam:
    - rtsp://usrer:[email protected]:554/stream1
    cam_sub:
    - rtsp://user:[email protected]:554/stream2
cam:
    enabled: true
    ffmpeg:
      output_args:
        record: preset-record-generic-audio-copy
      inputs:
      - path: rtsp://127.0.0.1:8554/cam
        roles:
        - record
      - path: rtsp://127.0.0.1:8554/cam_sub
        roles:
        - detect
    record:
      enabled: true
    onvif:
      host: 192.168.XX.XXX
      port: 2020
      user: user
      password: password
    detect:
      enabled: true
1 Like