Skip to content

Instantly share code, notes, and snippets.

@jasonmadigan
Last active March 13, 2024 19:36
Show Gist options
  • Save jasonmadigan/910d1fb0997c5fa69997340b84367aa8 to your computer and use it in GitHub Desktop.
Save jasonmadigan/910d1fb0997c5fa69997340b84367aa8 to your computer and use it in GitHub Desktop.
Frigate Test Camera

Frigate Test Clip

To tune Frigate, it can sometimes be useful to input saved clips in order to see how detection works. I've found the easiest way to accomplish this is by grabbing a clip (say, from your NVR), and streaming this on a loop via RTSP to Frigate. This will let you tune settings with an existing configuration, which is a bit different to using process_clip.py that's included with Frigate.

Pre-requisites

  • A sample clip, in a format supported by ffmpeg (.mp4 is good)
  • Docker on a machine that'll do the streaming
  • A working ffmpeg install. I'm using a mac, so I typically install via Brew: brew install ffmpeg

Stream a clip

To stream a file called trimmed.mp4:

  • Setup an RTSP server - run docker run --rm -it -e RTSP_PROTOCOLS=tcp -p 8888:8554 aler9/rtsp-simple-server
  • Stream the file: ffmpeg -re -stream_loop -1 -i trimmed.mp4 -an -c copy -f rtsp rtsp://localhost:8888/mystream
  • Update Frigate's config.yml to add a new test camera to point at our looping clip (assuming 192.168.1.180 is the host running the RTSP server):
    cameras:
      testcamera:
        ffmpeg:
          input: rtsp://192.168.1.180:8888/mystream 
    
@jasonmadigan
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment