ESP32 cam with Frigate (Getting MJPEG stream working with Frigate)

I’m trying to get object detection with Frigate (addon) working with an ESP32 camera. Since the ESP32 provides an MJPEG stream, I’ve been struggling to get the Frigate config set up such that ffmpeg can correctly process the ESP32 stream.

Below is my current config. The input_args were set as per the Frigate Documentation. This is running on an RPi 4B.

cameras:
  esp_cam:
    ffmpeg:
      input_args: -avoid_negative_ts make_zero -fflags nobuffer -flags low_delay -strict experimental -fflags +genpts+discardcorrupt -use_wallclock_as_timestamps 1 -c:v mjpeg
      inputs:
        - path: http://192.168.1.48/mjpeg/1
          roles:
            - detect
      
    detect:
        width: 1600
        height: 1200
        fps: 5

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

But I’m getting the following error:

frigate.video                  ERROR   : esp_cam: Unable to read frames from ffmpeg process.
frigate.video                  ERROR   : esp_cam: ffmpeg process is not running. exiting capture thread...
watchdog.esp_cam               ERROR   : Ffmpeg process crashed unexpectedly for esp_cam.
watchdog.esp_cam               ERROR   : The following ffmpeg logs include the last 100 lines prior to exit.
ffmpeg.esp_cam.detect          ERROR   : [flv @ 0x55bf69c6b0] Video codec mjpeg not compatible with flv
ffmpeg.esp_cam.detect          ERROR   : Could not write header for output file #0 (incorrect codec parameters ?): Function not implemented
ffmpeg.esp_cam.detect          ERROR   : Error initializing output stream 0:0 -- 

I can confirm that the camera works, I get a video stream when I navigate to http://192.168.1.48/mjpeg/1.

Any advice would be really appreciated.

bump

any help would be appreciated

You need to disable RTMP or use the necessary output args as are described in those same docs you linked

rtmp:
  enabled: false

OR

output_args:
  record: -f segment -segment_time 10 -segment_format mp4 -reset_timestamps 1 -strftime 1 -c:v libx264 -an
  rtmp: -c:v libx264 -an -f flv
1 Like