I have three cameras that are 16x9 but my doorbell camera is 4:3. I’m able to get it to show more or less correctly in the grid by forcing the Picture Entity to an aspect ratio of 16:9 however this just crops off the bottom of the image.
Is there a way to set it to center the image when forcing an aspect ratio?
Card:
Actual Image:
The code:
type: picture-entity
entity: camera.front_door
camera_image: camera.front_door
camera_view: live
show_name: false
show_state: false
aspect_ratio: '16:9'
tom_l
July 19, 2021, 4:20am
2
You would probably have to use card-mod and the contain
CSS option:
https://www.w3schools.com/css/css3_object-fit.asp
Looks like the default is cover
, which clips the image/video.
roofyw
(Raf W.)
September 3, 2021, 4:30pm
3
Hi. Did you ever get this figured out? Having similar issue with Nest doorbell
I’m afraid not. Try as I might, I couldn’t find the appropriate CSS to remedy this issue.
magyarl89
(Magyarl89)
October 30, 2022, 1:15pm
5
I was also messing with the card-mod CSS without luck.
Simple picture card was working in this way:
type: picture
image: https://demo.home-assistant.io/stub_config/t-shirt-promo.png
card_mod:
style: |
img {
width: 100px;
height: 50px;
object-fit: fill;
}
For live rtsp video card it doesn’t work. I tried to switch the “img” to “video”. nothing helped.
Only this has any effect:
card_mod:
style: |
ha-card {
width: 100px;
height: 50px;
object-fit: fill;
}
But unfortunately it takes consider only the with parameter, it doesn’t use the height. So I couldn’t change the aspect ratio in this way.
Has anyone any results in this topic?
pravardhan
(Pravardhan Nagireddy)
May 14, 2023, 5:58am
6
I am facing the same issue. Anyone able to figure this out?
pravardhan
(Pravardhan Nagireddy)
May 16, 2023, 3:30am
7
I finally found a solution using the frigate card. It has options for controlling precisely this.
opened 08:35PM - 14 May 23 UTC
closed 03:28AM - 16 May 23 UTC
question
<!-- READ THIS FIRST:
- If you need additional help with this template please r… efer to https://www.home-assistant.io/help/reporting_issues/
- Make sure you are running the latest version of Home Assistant before reporting an issue: https://github.com/home-assistant/home-assistant/releases
- Provide as many details as possible. Do not delete any text from this template!
-->
**Checklist:**
- [x] I updated to the latest version available
- [x] I cleared the cache of my browser
**Release with the issue:**
v5.0.0
**Last working release (if known):**
None
**Browser and Operating System:**
Chrome, Ubuntu 22.04
<!--
Provide details about what browser (and version) you are seeing the issue in. And also which operating system this is on. If possible try to replicate the issue in other browsers and include your findings here.
-->
**Description of problem:**
The card provides option for setting the aspect ratio of the card. However, when set to static aspect ratio, the card just created white space around the video instead of fitting the video to the provided aspect ratio.
![image](https://github.com/dermotduffy/frigate-hass-card/assets/30177846/5a06f9f3-200e-4890-93cf-d026a9f90eb2)
The stream is from a CP Plus security camera. FFmpeg says the stream is 960x1080. The config for go2rtc and frigate is as follows:
```yaml
go2rtc:
streams:
first_floor: rtsp://192.168.29.129/cam/realmonitor?channel=3\&subtype=0
cameras:
first_floor:
ffmpeg:
inputs:
- path: rtsp://127.0.0.1:8554/first_floor
input_args: preset-rtsp-restream
roles:
- record
```
<!--
Explain what the issue is, and how things should look/behave. If possible provide a screenshot with a description.
-->
**Javascript errors shown in the web inspector (if applicable):**
```
```
**Additional information:**