[Config Support]: Rotated camera does not hold proper aspect ratio #22425
-
Beta Was this translation helpful? Give feedback.
Replies: 13 comments 18 replies
-
|
The aspect ratio switching behavior you're experiencing on the Live dashboard is a known characteristic of how Frigate handles streams. Frigate uses different streams for different purposes, and with Smart Streaming enabled, it shows a static image from the The camera image will change size if your streams use different aspect ratios. To prevent this, you need to make the Since you're rotating the stream to 1080x1920 (portrait orientation), you need to ensure your cameras:
your_doorbell_cam:
detect:
width: 720
height: 1280 # Maintains 9:16 portrait aspect ratio to match your rotated streamAdditionally, when using go2rtc's ffmpeg source for rotation and transcoding, the stream format is being re-encoded. If the video codec might be unsupported by your browser or if there are issues with the rotated output, you may want to check the go2rtc web interface at port 1984 to verify the stream is being received correctly with the expected dimensions. (3) For recordings specifically, ensure the recording stream input also receives the properly rotated stream from go2rtc's restream output rather than the original camera stream directly. 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
Since the distorted aspect ratio is visible directly in go2rtc's web interface at port 1984, the issue is occurring at the go2rtc stream level before Frigate even processes it. (1) Your go2rtc ffmpeg source configuration appears to be the problem area. When using the ffmpeg module in go2rtc with rotation and dimension parameters, the syntax and parameter order matter. (1) Looking at your go2rtc config: - ffmpeg:rtsp://user:pass@wvdb1.iot.local:554/ch0#video=h264#rotate=90#width=1080#height=1920#audio=copy#hardwareA few things to check:
Since this is a go2rtc ffmpeg transcoding/rotation issue rather than a Frigate configuration issue, I don't have specific documentation on the exact ffmpeg rotation parameters supported by go2rtc. You may want to consult the go2rtc FFmpeg documentation for the correct syntax for rotation with dimension preservation. 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
This is an interesting finding. The fact that the stream displays correctly in go2rtc's web interface (port 1984) but Frigate shows "no frames have been received" suggests the issue is with how Frigate is receiving or processing the rotated stream from go2rtc's restream. A few things to investigate based on the documentation: 1. Detect resolution mismatch - Frigate uses the detect:
width: 1080
height: 19202. Aspect ratio and jsmpeg rendering - The Live view documentation mentions that incorrect dimensions in your detect width or height can cause rendering issues with the jsmpeg player. It recommends adjusting to a standard aspect ratio. (2) Since 1080x1920 is a 9:16 ratio (standard portrait), this should be fine, but you could try slightly adjusting if needed. 3. Stream codec compatibility - For Live view, the recommended video codec is H.264 and audio codec is AAC. (2) Verify that your go2rtc ffmpeg transcoding is outputting H.264. The 4. Check stream info - You can access go2rtc stream info at Unfortunately, the specific interaction between go2rtc's rotation/transcoding and Frigate's frame reception isn't fully documented in the available sources. This may require further debugging or could be a bug worth reporting with the specific details about the rotated stream working in go2rtc but not in Frigate. 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
Based on what you've described, here are some specific things to try: 2. Alternative aspect ratios/resolutions to try: The Live view documentation specifically mentions adjusting detect dimensions to standard aspect ratios when experiencing display issues. (1) Examples given include:
For your 9:16 portrait orientation, try these standard portrait resolutions:
3. H.265 to H.264 conversion: Since your camera outputs H.265 and you're transcoding to H.264, this is the correct approach for browser compatibility. (2) The documentation confirms that if using H265, you should switch to H264, and if unable to switch from H265 to H264, re-encode the video using FFmpeg parameters. (2) Additional debugging step: If the stream works correctly in go2rtc's web interface but not in Frigate, try enabling "compatibility mode" in your camera group dashboard's stream settings. This option is specifically mentioned for cases where the live stream displays color artifacts or has rendering issues. (1) However, the documentation notes that depending on your browser and device, more than a few cameras in compatibility mode may not be supported. (1) Given that the rotated stream displays correctly in go2rtc but Frigate can't receive frames without forcing dimensions (which then causes distortion), this appears to be a specific interaction issue between rotated/transcoded streams and Frigate's frame processing that isn't fully covered in the available documentation. 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
The error logs reveal the root cause of your issue. The key error is: This indicates a hardware acceleration incompatibility between the stream coming from go2rtc (which was transcoded/rotated) and Frigate's RKNN/Rockchip hardware acceleration for decoding. The When go2rtc transcodes and rotates your stream, the output is a software-decoded stream. When Frigate then tries to apply Rockchip hardware acceleration to decode/scale this already-transcoded stream, the hardware context chain is broken. Potential solutions:
cameras:
wvdb1:
ffmpeg:
hwaccel_args: "" # Disable hardware acceleration for this camera
inputs:
- path: rtsp://127.0.0.1:8554/wvdb1
input_args: preset-rtsp-restream
roles:
- record
- detect
- audio
detect:
enabled: true
width: 1080
height: 1920
fps: 5The documentation notes that you may need to disable hardware acceleration (
📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
The issue relates to how hardware-accelerated video decoding works at a fundamental level. Why this happens: When go2rtc transcodes and rotates your stream using its Hardware acceleration for video decoding works by keeping video frames in GPU memory throughout the decode and scaling pipeline. When Frigate receives a stream that was already decoded/transcoded elsewhere (even if that transcoding used hardware), the frames are coming over the network as a regular encoded stream. When Frigate's Rockchip hardware decoder tries to apply hardware-accelerated scaling, it expects the frames to already be in GPU memory with the proper hardware context—but they're not, because they came from go2rtc's restream. (1) This only affects your rotated camera because your other cameras send their original streams directly to Frigate (via go2rtc restream without transcoding), allowing Frigate's hardware decoder to establish the full hardware context from the start. (1) Can this be fixed without disabling hwaccel? The available documentation doesn't describe a method to re-establish hardware context for streams that have been transcoded by go2rtc. The hardware acceleration documentation focuses on ensuring hardware devices are accessible and using the correct presets for direct camera streams. (1) Your current workaround of disabling 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
You're correct, and I apologize for the inaccurate statement. Let me address your actual question. Why Frigate is attempting scaling: Frigate applies scaling when the stream resolution doesn't match the configured detect:
width: 1080
height: 1920Frigate uses the The error
Why your other H.265→H.264 transcoded cameras work: The difference is likely that those cameras maintain their original resolution through transcoding, and that resolution matches what Frigate expects. The rotation operation changes the dimensional relationship in a way that may cause a mismatch or trigger the scaling path differently. Unfortunately, the available documentation doesn't provide detailed information about the internal hardware acceleration pipeline behavior or why the 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
The 1536x2304 resolution is unexpected—your original camera is 1920x1080, which when rotated 90° should become 1080x1920. The upscaling to 1536x2304 is happening in go2rtc's ffmpeg transcoding, likely due to the The Regarding the upscaling issue: Your go2rtc config: - ffmpeg:rtsp://user:pass@wvdb1.iot.local:554/ch0#video=h264#rotate=90#width=1080#height=1920#audio=copy#hardwareTry removing the explicit width/height parameters and let go2rtc handle the rotation naturally: - ffmpeg:rtsp://user:pass@wvdb1.iot.local:554/ch0#video=h264#rotate=90#audio=copy#hardwareThen check ffplay again to see what resolution the rotated stream actually outputs, and set your detect dimensions to match that exactly. The core hwaccel incompatibility with Rockchip and transcoded streams isn't documented with a workaround in the available sources. A developer would need to provide guidance on whether there's a way to make 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
Good progress on getting the correct 1080x1920 output resolution from go2rtc. The persistent The available documentation doesn't provide a method to make Rockchip hardware acceleration work with streams that have been transcoded by go2rtc. (1) The Your options based on the documented configurations: 1. Keep hwaccel disabled for this camera (your current working solution): cameras:
wvdb1:
ffmpeg:
hwaccel_args: ""2. Consider if rotation can happen at the camera level - If your doorbell camera firmware supports rotating the output stream natively, that would allow Frigate to receive the stream without go2rtc transcoding, preserving the hardware context. The 50%+ CPU usage you're seeing without hwaccel is significant. This specific incompatibility between Rockchip's 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
You've identified an important distinction—the issue is specifically with rotation combined with transcoding, not transcoding alone. This narrows down the problem to how the rotation operation in go2rtc's ffmpeg module interacts with Rockchip's hardware acceleration pipeline. The available documentation doesn't address this specific scenario of rotated streams and Rockchip hardware acceleration compatibility. (1) The go2rtc configuration guides cover transcoding and rotation parameters, but don't document hardware context requirements for rotated output streams when consumed by Rockchip-based hardware decoders. (1) What the documentation does confirm: When using the ffmpeg module in go2rtc for transcoding, the stream is re-encoded. (1) The rotation operation likely changes something about the stream's metadata or encoding characteristics that breaks compatibility with Your working configuration for reference: cameras:
wvdb1:
ffmpeg:
hwaccel_args: ""
inputs:
- path: rtsp://127.0.0.1:8554/wvdb1
input_args: preset-rtsp-restream
roles:
- record
- detect
- audio
detect:
width: 1080
height: 1920This appears to be a platform-specific limitation with Rockchip/RKNN that isn't documented. A developer familiar with the Rockchip ffmpeg implementation would need to explain why rotation specifically breaks the hardware context while transcoding alone doesn't. 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
I had a very similar issue and had to use This does a few more things than just rotate—like set fps, gop, gpu, and framerate. When rotating, you can only seem to have the rotation work done on the CPU and the rest of the pipeline on gpu with Nvidia due to missing npp in ffmeg (as its non free). Not sure what hardware you're using.
|
Beta Was this translation helpful? Give feedback.
-
|
Yes, you can configure Frigate to use FFmpeg 7 instead of the default version. In your Frigate config, you can set the ffmpeg path globally or per-camera: (1) ffmpeg:
path: "7.0"This can be set globally to use FFmpeg 7 for all cameras, or at the camera level to use it only for specific cameras. (2) The documentation specifically notes this option when encountering certain hardware acceleration errors on Rockchip platforms. If you see errors like: (2) ...you should try upgrading to FFmpeg 7 using this config option. (2) Note that this setting controls which FFmpeg Frigate uses for its processing—it's separate from the 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.
-
|
You're correct that the For go2rtc to use a different FFmpeg version, you would need to use the go2rtc:
streams:
wvdb1_raw:
- rtsp://user:pass@wvdb1.iot.local:554/ch0
wvdb1:
- exec:/usr/lib/ffmpeg/7.0/bin/ffmpeg -hide_banner -rtsp_transport tcp -i rtsp://127.0.0.1:8554/wvdb1_raw -vf transpose=1 -c:v h264 -f rtsp -rtsp_transport tcp {{output}}This approach uses the raw stream as input and explicitly calls FFmpeg 7.0 for the rotation/transcoding. You'll need to adjust the transpose value and other parameters for your specific rotation needs. Regarding whether FFmpeg 7 in the 📚 Sources: Have another question? Just tag @inkeep. |
Beta Was this translation helpful? Give feedback.



#19227