frigate: Unable to rotate camera image for portrait view

Describe the bug I have used the following output_arg to rotate the image of one of my cams, but I get error messages and a green screen for my camera. I have also tried inverting (swapping height and width 1080*1920)

rtmp: -vf transpose=2 -f -rawvideo -pix_fmt yuv420p and have tried:

rtmp: -vf transpose=1 -r 5 -f rawvideo -pix_fmt yuv420p

Version of frigate 0.8.4-5043040

Config file

mqtt:
  host: 192.168.1.101
  port: 1883
  user: ereacted
  password: redacted
cameras:
  back_facing_house:
    ffmpeg:
      inputs:
        - path: rtsp://viewer:redacted@192.168.1.70:555/user=admin_password=_channel=1_stream=0
          roles:
            - detect
            - rtmp
            - clips
    width: 1280
    height: 720
    fps: 5
  fri_side_door:
    ffmpeg:
      inputs:
        - path: rtsp://viewer:redacted@192.168.1.74:554/user=admin_password=_channel=1_stream=0
          roles:
            - detect
            - rtmp
            - clips
      output_args:
#        record: -vf transpose=1 -f rawvideo -pix_fmt -yuv420p
#        clips: -vf transpose=1 -f -rawvideo -pix_fmt yuv420p
        rtmp: -vf transpose=2 -f -rawvideo -pix_fmt yuv420p
    width: 1920
    height: 1080
    fps: 5
detectors:
  coral:
    type: edgetpu
    device: usb
objects:
  track:
    - person
    - dog
    - car

Frigate container logs

frigate    | frigate.video                  INFO    : fri_side_door: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate    | frigate.video                  INFO    : fri_side_door: ffmpeg process is not running. exiting capture thread...
frigate    | ffmpeg.fri_side_door.detect    ERROR   : [NULL @ 0x5629e49fd540] Requested output format '-rawvideo' is not a suitable output format
frigate    | ffmpeg.fri_side_door.detect    ERROR   : rtmp://127.0.0.1/live/fri_side_door: Invalid argument
frigate    | frigate.video                  INFO    : fri_side_door: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate    | frigate.video                  INFO    : fri_side_door: ffmpeg process is not running. exiting capture thread...
frigate    | ffmpeg.fri_side_door.detect    ERROR   : [NULL @ 0x558547ad1fc0] Requested output format '-rawvideo' is not a suitable output format
frigate    | ffmpeg.fri_side_door.detect    ERROR   : rtmp://127.0.0.1/live/fri_side_door: Invalid argument
frigate    | frigate.video                  INFO    : fri_side_door: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate    | frigate.video                  INFO    : fri_side_door: ffmpeg process is not running. exiting capture thread...
frigate    | ffmpeg.fri_side_door.detect    ERROR   : [NULL @ 0x563a1e788fc0] Requested output format '-rawvideo' is not a suitable output format
frigate    | ffmpeg.fri_side_door.detect    ERROR   : rtmp://127.0.0.1/live/fri_side_door: Invalid argument
frigate    | frigate.video                  INFO    : fri_side_door: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate    | frigate.video                  INFO    : fri_side_door: ffmpeg process is not running. exiting capture thread...
frigate    | ffmpeg.fri_side_door.detect    ERROR   : [NULL @ 0x564f36f77540] Requested output format '-rawvideo' is not a suitable output format
frigate    | ffmpeg.fri_side_door.detect    ERROR   : rtmp://127.0.0.1/live/fri_side_door: Invalid argument
frigate    | frigate.video                  INFO    : fri_side_door: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate    | frigate.video                  INFO    : fri_side_door: ffmpeg process is not running. exiting capture thread...
frigate    | ffmpeg.fri_side_door.detect    ERROR   : [NULL @ 0x55a26e8b5440] Requested output format '-rawvideo' is not a suitable output format
frigate    | ffmpeg.fri_side_door.detect    ERROR   : rtmp://127.0.0.1/live/fri_side_door: Invalid argument
frigate    | frigate.video                  INFO    : fri_side_door: ffmpeg sent a broken frame. memoryview assignment: lvalue and rvalue have different structures
frigate    | frigate.video                  INFO    : fri_side_door: ffmpeg process is not running. exiting capture thread...

Frigate stats

  "back_facing_house": {
    "camera_fps": 5.0, 
    "capture_pid": 44, 
    "detection_fps": 0.0, 
    "pid": 42, 
    "process_fps": 5.0, 
    "skipped_fps": 0.0
  }, 
  "detection_fps": 0.0, 
  "detectors": {
    "coral": {
      "detection_start": 0.0, 
      "inference_speed": 9.33, 
      "pid": 39
    }
  }, 
  "fri_side_door": {
    "camera_fps": 0.0, 
    "capture_pid": 45, 
    "detection_fps": 0.0, 
    "pid": 43, 
    "process_fps": 0.0, 
    "skipped_fps": 0.0
  }, 
  "service": {
    "storage": {
      "/dev/shm": {
        "free": 65.0, 
        "mount_type": "tmpfs", 
        "total": 67.1, 
        "used": 2.1
      }, 
      "/media/frigate/clips": {
        "free": 274723.4, 
        "mount_type": "ext4", 
        "total": 4233172.6, 
        "used": 3776418.7
      }, 
      "/media/frigate/recordings": {
        "free": 274723.4, 
        "mount_type": "ext4", 
        "total": 4233172.6, 
        "used": 3776418.7
      }, 
      "/tmp/cache": {
        "free": 983.9, 
        "mount_type": "tmpfs", 
        "total": 1000.0, 
        "used": 16.1
      }
    }, 
    "uptime": 653, 
    "version": "0.8.4-5043040"
  }
}

FFprobe from your camera

Run the following command and paste output below

ffprobe <stream_url>
ffprobe rtsp://:@192.168.1.74:554/user=admin_password=_channel=1_stream=0
ffprobe version 3.4.4-1~16.04.york0 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.10) 20160609
  configuration: --prefix=/usr --extra-version='1~16.04.york0' --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Input #0, rtsp, from 'rtsp://:@192.168.1.74:554/user=admin_password=_channel=1_stream=0':
  Metadata:
    title           : RTSP Session
  Duration: N/A, start: 0.200000, bitrate: N/A
    Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 1920x1080, 5 fps, 5 tbr, 90k tbn, 180k tbc

Screenshots If applicable, add screenshots to help explain your problem.

Computer Hardware

  • OS: Ubuntu 16.04
  • Install method:Docker Compose
  • Virtualization:
  • Coral Version: USB
  • Network Setup: Wired

Camera Info:

  • Manufacturer: Generic IP ONVIF
  • Model: n/a
  • Resolution: 1080p
  • FPS: 5

Additional context The camera works fine when I remove the output_args to attempt to rotate the image to accommodate portrait view. See screen shot. Screenshot 2021-06-16 21 19 32

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 64 (9 by maintainers)

Most upvoted comments

Yea, I kinda understand but is there more details on the topic or just we should learn go2rtc by ourselves?

there’s a whole page of documentation for go2rtc on the go2rtc repo https://github.com/AlexxIT/go2rtc#source-ffmpeg

@noelhibbard can you post the command you were trying with the -f segment args? One feature I have been considering for the future is “post processors” to modify mp4 files afterwards, and this would fit in that use case.