A bug? 1.29.0 -- stretched image on rotated streams

Forum for questions and support relating to the 1.29.x releases only.
McFuzz
Posts: 181
Joined: Tue Aug 28, 2012 7:03 am

A bug? 1.29.0 -- stretched image on rotated streams

Post by McFuzz »

I've upgraded to 1.29.0-trusty-2016021001 today and noticed that in the UI, the one camera I have that is rotated left with width of 480 and height of 680 is displayed stretched.

Oddly enough, the image is not stretched when viewed through the new "Montage Review" feature.

Stretched:

Image


How it should be:

Image



If I set orientation to normal and reverse the width/height, the image is displayed properly. Ticking the "preserve aspect ratio" button does not resolve the issue.
rayrayray
Posts: 16
Joined: Sun Apr 25, 2010 10:59 pm

Re: A bug? 1.29.0 -- stretched image on rotated streams

Post by rayrayray »

I have the same issue on my 1.29.0 build. I built a new Ubuntu package yesterday using the do_debian_package.sh script which grabbed the git master branch. OS is Ubuntu 15.10.

EDIT: I had to add a second camera to my test server to see the Montage and Montage Review links. I have the same experience. The image is stretched when clicking directly on the rotated camera and in Montage but shows the correct orientation in Montage Review.
Last edited by rayrayray on Fri Feb 12, 2016 3:22 pm, edited 1 time in total.
You spoony bard!
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: A bug? 1.29.0 -- stretched image on rotated streams

Post by asker »

rayrayray wrote:I have the same issue on my 1.29.0 build. I built a new Ubuntu package yesterday using the do_debian_package.sh script which grabbed the git master branch. OS is Ubuntu 15.10.
rayrayray, which instructions did you follow while building with do_debian_package?
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
rayrayray
Posts: 16
Joined: Sun Apr 25, 2010 10:59 pm

Re: A bug? 1.29.0 -- stretched image on rotated streams

Post by rayrayray »

This is where I found it -- https://github.com/ZoneMinder/ZoneMinder/issues/1231
And this is how I'm calling it -- ./do_debian_package.sh wily `date +%Y%m%d`01 local master

The resulting deb packages I've integrated into a Chef cookbook with the intent of fully automating the ZM install on Ubuntu 15.10. I have it working, but it's a bit of a kludge.
You spoony bard!
User avatar
asker
Posts: 1553
Joined: Sun Mar 01, 2015 12:12 pm

Re: A bug? 1.29.0 -- stretched image on rotated streams

Post by asker »

ok cool - yeah, I was wondering where you read that because it still hasn't made it to the official docs (which use cmake). Thanks
I no longer work on zmNinja, zmeventnotification, pyzm or mlapi. I may respond on occasion based on my available time/interest.

Please read before posting:
How to set up logging properly
How to troubleshoot and report - ES
How to troubleshoot and report - zmNinja
ES docs
zmNinja docs
rayrayray
Posts: 16
Joined: Sun Apr 25, 2010 10:59 pm

Re: A bug? 1.29.0 -- stretched image on rotated streams

Post by rayrayray »

I have done a lot of digging after doing a 1.28.xxx build and finding the API missing. :) I really miss the TinyCam compatibility and want to move to zmNinja.
You spoony bard!
rayrayray
Posts: 16
Joined: Sun Apr 25, 2010 10:59 pm

Re: A bug? 1.29.0 -- stretched image on rotated streams

Post by rayrayray »

To get back to the rotation issue. I did find some exceptions from CSS in Firefox's dev tools.
zms1.jpg
zms1.jpg (128.38 KiB) Viewed 6940 times
And my monitor config. On my 1.28.xxx server that I built a few days earlier, this is working as expected.
zms2.png
zms2.png (27 KiB) Viewed 6940 times
You spoony bard!
rayrayray
Posts: 16
Joined: Sun Apr 25, 2010 10:59 pm

Re: A bug? 1.29.0 -- stretched image on rotated streams

Post by rayrayray »

Ahhhh, nevermind. The CSS errors don't mean anything. I see the same exceptions from my 1.28.xxx server where the image is not stretched.
You spoony bard!
McFuzz
Posts: 181
Joined: Tue Aug 28, 2012 7:03 am

Re: A bug? 1.29.0 -- stretched image on rotated streams

Post by McFuzz »

Glad to know I ain't the only one! Thankfully it is the only camera behaving that way - but it is also my baby monitor camera XD
rayrayray
Posts: 16
Joined: Sun Apr 25, 2010 10:59 pm

Re: A bug? 1.29.0 -- stretched image on rotated streams

Post by rayrayray »

I just noticed that if I view the stream link to nph-zms directly there is no issue with the rotation. Actually just a few lines above the link to the script in the view-source of the page, I can clearly see an issue in the JavaScript.

Code: Select all

var monitorWidth = 640;
var monitorHeight = 400;
var monitorUrl = '';

var scale = 100;

var streamSrc = "/cgi-bin/nph-zms?mode=jpeg&scale=100&maxfps=30&buffer=1000&monitor=2&connkey=758473&rand=1455316479";
The monitorWidth and monitorHeight values are backward. I'm going to do some more digging.
You spoony bard!
rayrayray
Posts: 16
Joined: Sun Apr 25, 2010 10:59 pm

Re: A bug? 1.29.0 -- stretched image on rotated streams

Post by rayrayray »

I was able to fix this by modifying www/includes/Monitor.php (full path would be /usr/share/zoneminder/www/includes/Monitor.php on most ZM 1.29.x servers). Try this and let me know if it works for you too.

Comment out these lines near the bottom of the file. Use a /* and */ around them. Save the file and reload the monitor view.

Code: Select all

  
  public function Width() {
                if ( $this->Orientation() == '90' or $this->Orientation() == '270' ) {
                        return $this->{'Height'};
                }
                return $this->{'Width'};
        }
        public function Height() {
                if ( $this->Orientation() == '90' or $this->Orientation() == '270' ) {
                        return $this->{'Width'};
                }
                return $this->{'Height'};
        }
Disclaimer: I am not a ZoneMinder developer. I do not present this as anything other than a hack to get this one feature working again. It's possible that doing this breaks something somewhere else. :) I can tell that this code was added very recently ... my 1.28.xxx VM that I built a week ago didn't have these lines in this file.
You spoony bard!
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: A bug? 1.29.0 -- stretched image on rotated streams

Post by SteveGilvarry »

Thought you had dimensions wrong way round, but then saw that was testing it. Will have a look at that code.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: A bug? 1.29.0 -- stretched image on rotated streams

Post by SteveGilvarry »

Is the pic above your current configuration? If so swap Width 640 and Height 480 and leave orientation as is with that code left in.
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
rayrayray
Posts: 16
Joined: Sun Apr 25, 2010 10:59 pm

Re: A bug? 1.29.0 -- stretched image on rotated streams

Post by rayrayray »

Alright, reverted my code change and flipped the dimensions... now the feed is the right shape but shows up garbled. That could be something else with my camera, I suppose.
Screenshot_2016-02-13_00-48-09.png
Screenshot_2016-02-13_00-48-09.png (370.25 KiB) Viewed 6891 times
You spoony bard!
SteveGilvarry
Posts: 494
Joined: Sun Jun 29, 2014 1:12 pm
Location: Melbourne, AU

Re: A bug? 1.29.0 -- stretched image on rotated streams

Post by SteveGilvarry »

Do you have some image rotation setting in the camera?
Production Zoneminder 1.37.x (Living dangerously)
Random Selection of Cameras (Dahua and Hikvision)
Locked