Page 1 of 1

iP Cams aspect ratio

Posted: Sunday 17 October 2021 15:52
by Lars77
i have been a long time user of Domoticz, but one thing still doesnt seem to get implemented: the aspect ratio of the cams...

I know I can manualy edit the aspect ratio in the .js files, but everytime Domoticz gets updated, I have to do it again...
A simple option in the configuration screen, to set the aspect ratio of the ip cams would be easy to implemend not?

besides that, almost all ip camera's use: 16/9 aspect ratio instead of 3/4, now when I click on an Ip cam on my dashboard, I get an ugly stretched Camera image...

Is there any way, to resolve this, or do I just have to accept the fact that it is never going to be implemented ?

Re: iP Cams aspect ratio

Posted: Monday 18 October 2021 6:47
by kiddigital
Maybe create a feature request issue on Github describing what you want.

Should it be a default for all cameras or per camera?

Where do you propose these setting(s) should be? Maybe create a ‘screenshot’.

Where do you make the change(s), and which changes, now in the UI?

Re: iP Cams aspect ratio

Posted: Wednesday 20 October 2021 20:25
by Lars77
It doesn't matter if it is per camera or for all cameras, a selection switch 3/4 or 16/9 at the camera settings screen (edit camera) would be perfect...

Now, I have to ssh into the Domoticz installation, go to the: /www/js/domoticz.js file and edit the ShowCameraLiveStream function:

Code: Select all

function ShowCameraLiveStream(Name, camIdx) {
        $.count = 0;
        $.camfeed = "camsnapshot.jpg?idx=" + camIdx;

        $('#dialog-camera-live #camfeed').attr("src", "images/camera_default.png");
        //$('#dialog-camera-live #camfeed').attr("src", FeedURL);

        var windowWidth = $(window).width() - 20;
        var windowHeight = $(window).height() - 150;

        var AspectSource = 4 / 3; 
        
        var height = windowHeight;
        var width = Math.round(height * AspectSource) & ~1;
        if (width > windowWidth) {
                width = windowWidth;
                height = Math.round(width / AspectSource) & ~1;
        }
and change: 4 / 3 to 16 / 9, every time domoticz gets updated...

but I will try to ask for a feature request on Github, maybe they will look into it...

Re: iP Cams aspect ratio

Posted: Wednesday 20 October 2021 21:10
by Xenomes
Lars77 wrote: Wednesday 20 October 2021 20:25 It doesn't matter if it is per camera or for all cameras, a selection switch 3/4 or 16/9 at the camera settings screen (edit camera) would be perfect...

Now, I have to ssh into the Domoticz installation, go to the: /www/js/domoticz.js file and edit the ShowCameraLiveStream function:

Code: Select all

var AspectSource = 4 / 3;
and change: 4 / 3 to 16 / 9, every time domoticz gets updated...

but I will try to ask for a feature request on Github, maybe they will look into it...
Thanks for the tip! is a good feature for a next release!

Re: iP Cams aspect ratio

Posted: Tuesday 19 April 2022 14:24
by waltervl
For reference: Is implemented in Beta 14183 (februari 2022)

https://github.com/domoticz/domoticz/issues/5155