question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to rotate camera image for portrait view

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:26 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
blakeblackshearcommented, Jun 30, 2021

@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.

0reactions
stale[bot]commented, Jul 30, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pictures in Windows Photo Viewer Won't Rotate (SOLUTION)
Can't rotate picture in Windows Photo Viewer ; Right-click the file and select Properties from the context menu. Go to the Security tab....
Read more >
My camera will not rotate - Apple Community
My camera will not rotate · Make sure that Portrait Orientation Lock is turned off. To check, open Control Center. If you see...
Read more >
Unable to get photos taken in portrait orientation to view in ...
The only thing this setting does is (statically!) rotating images taken in portrait orientation so they can be viewed with camera screen in ......
Read more >
Controlling the camera to take pictures in portrait doesn't ...
//STEP #1: Get rotation degrees Camera.CameraInfo info = new Camera.CameraInfo(); Camera.getCameraInfo(Camera.CameraInfo.CAMERA_FACING_BACK, ...
Read more >
Camera image orientation on the viewfinder of the display is ...
Camera image orientation on the viewfinder of the display is rotated 90 ... You cannot duplicate the display to the second monitor on...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found