Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constrain the view port (only) to a fixed aspect ratio #1581

Open
felipecrs opened this issue Sep 24, 2024 · 5 comments
Open

Constrain the view port (only) to a fixed aspect ratio #1581

felipecrs opened this issue Sep 24, 2024 · 5 comments
Labels
feature New feature or request

Comments

@felipecrs
Copy link
Contributor

felipecrs commented Sep 24, 2024

Is your feature request related to a problem? Please describe.

In 5.2.0 I was able to constrain the view port to 16:9 with:

dimensions:
  aspect_ratio_mode: static
  aspect_ratio: '16:9'

But the same configuration now will constrain the whole card, including the external menu, to 16:9.

Instead of:

image

It now looks like:

image

Which is not optimal, as it is very hard to predict the card aspect ratio when taking into consideration the menu.

The reason why I want to constrain the card is to make the dashboard loading look a bit better. For example, the following:

image

In favor of:

image

Describe the solution you'd like

Perhaps...

dimensions:
  aspect_ratio_mode: static
  aspect_ratio: '16:9'
  aspect_ratio_view_port_only: true

Or maybe just make it the default with no ability to configure? I wonder if there is a use case to constrain the card beyond the view port.

Describe alternatives you've considered
I was playing with the camera dimensions configuration, but that doesn't seem to have the effect I wanted.

Additional context

@felipecrs felipecrs changed the title Allow to constrain the view port to a fixed aspect ratio (excluding the menu bar) Allow to constrain the view port to a fixed aspect ratio Sep 24, 2024
@dermotduffy
Copy link
Owner

dermotduffy commented Sep 24, 2024

I think you want to set the camera aspect-ratio, but not the card, with this:

type: custom:frigate-card
cameras:
  - camera_entity: camera.office
    dimensions:
      aspect_ratio: '4:3'
# Not this, as this sets it for the whole card
# dimensions:
#   aspect_ratio: '4:3'
menu:
  style: outside

Does this do what you want, or do I misunderstand?

@felipecrs
Copy link
Contributor Author

felipecrs commented Sep 24, 2024

Yes and no. Check this:

With card fixed aspect ratio:

chrome_42oXrJMAN7.mp4

With camera fixed aspect ratio:

chrome_ndCzKA74cD.mp4

Notice how the first video starts already with its final size.

Notice how the latter one starts small and takes a while to figure out its final size.

If you play both clips at 0.5x it should be a lot easier to spot.

@dermotduffy
Copy link
Owner

dermotduffy commented Sep 25, 2024

Notice how the latter one starts small and takes a while to figure out its final size.

Ah, yes. That's while the card is loading, the view (which may or may not be a camera) is not yet loaded, so camera-level aspect_ratio cannot be enforced.

Or maybe just make it the default with no ability to configure? I wonder if there is a use case to constrain the card beyond the view port.

Views that are not just a simple camera come to mind (e.g. gallery, or grid of multiple cameras).

Let me think on this!

@dermotduffy dermotduffy added the feature New feature or request label Sep 25, 2024
@dermotduffy dermotduffy changed the title Allow to constrain the view port to a fixed aspect ratio Constrain the view port (only) to a fixed aspect ratio Sep 25, 2024
@felipecrs
Copy link
Contributor Author

I found a (very lucky) solution for this:

dimensions:
  aspect_ratio_mode: static
  aspect_ratio: "3:2"

This seems to be the exact ratio I need to fit both the external menu and a 16:9 camera.

chrome_6liSLb5a9g.mp4

@dermotduffy, if you believe this cannot be fixed otherwise, I'm ok closing it.

@felipecrs
Copy link
Contributor Author

But for some other cases, with more customizations like menu height, it's a bit more challenging to find an aspect ratio that works in all conditions.

It would be great if this could be calculated by the card itself. Perhaps based on:

  1. The menu height
  2. cameras_global.dimensions.aspect_ratio

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants