Video standards, Pixel Aspect Radio in ZM
Posted: Fri Mar 07, 2008 8:40 am
Okay guys, I opened this topic here, because I couldn't find any better place to do it. Hope it's not a problem.
The general situation:
Say you have a camera at 320x240. This gives a 4:3 aspect ratio image, ZM works beautifully, image can be seen, it's according to the reality, nothing is distorted.
Now you have another camera, grabbing at 352x288. This is not 4:3 aspect ratio, although it should be. ZM works beautifully, image can be seen, but it's not according to the reality: the picture is narrower than the reality, it looks squished.
The reason:
while at 320x240 the pixels are SQUARE, at 352x288 they are NOT. Actually 320x240 is 1/4 of 640×480, which is the "True" computer square-pixel format (1/1). 352x288 is the format for VCD, DVD, H.261 + H.263 (CIF), having a pixel aspect ratio of 128/117!!
In other words:
320x240 captured images show well, because pixels are square. 352x288 captured images show narrower, because pixels are not square, but wrongly displayed as square in Firefox, on the computer display.
The easiest way to fix this is actually to stretch the images in the viewer (the default case: Firefox), according to the correct aspect ratio of the pixels in that image.
This means:
ZM should know all the supported resolutions of the capturing devices (there aren't many, as the video resolutions are all standardized, and all devices, like capture cards, webcams or network cams conform to these, see below), and when displaying images with the resolutions selected, they must be re-scaled according to their correct pixel aspect ratio. It wouldn't add extra load on the ZM server itself, because everything would work in behind just like now, the viewer application, like the browser, must actually do the stretching of the image, and that can be intelligently achieved from php code. In reality, there's not much work to do: instead of the fields where now one can fill the desired resolution, there should be a drop-down list with the available standard resolutions, and from the resoultion selected, the php code knows how to display the image. No need to use the brand new 'Keep Aspect Ratio' option either, as it is used totally wrong in respect to the standards.
Here is a great documentation on this, that would help in understanding the issue:
A Quick Guide to Digital Video Resolution and Aspect Ratio Conversions
There are listed all the standard resolutions for PAL (named '625-line systems with a 50 Hz field rate') and NTSC (named '525-line systems with a 59.94¹ Hz field rate'). See the table in the document. The column 'pixel aspect ratio (x/y)' has the correction factor that needs to be applied when displaying the images.
Really easy to achieve. Any chances to implement? It would make ZM an application working according to the industry standards.
Square and nonsquare pixels:
A. Square pixels and 4:3 frame aspect ratio
B. Nonsquare pixels and 4:3 frame aspect ratio
C. Nonsquare pixels displayed on a square-pixel monitor
This example illustrates nonsquare pixels form an image with a 4:3 aspect ratio.
An image created with nonsquare pixels is distorted when displayed with square pixels.
Images above show pretty much what happens in ZM, and that is not quite correct.
Try to experiment and see this for yourself:
- place 2 cameras in the same location
- set one to 320x240
- set the other to 352x288 (make sure they don't share the same bt chip, otherwise you won't be able to)
- view them in the montage view, in the browser and see the difference: the second cam's picture is not cropped, but squished.
Other good links on this topic:
http://lurkertech.com/lg/pixelaspect/
http://livedocs.adobe.com/en_US/AfterEf ... -7f3a.html
http://www.microsoft.com/windows/window ... rames.aspx
The general situation:
Say you have a camera at 320x240. This gives a 4:3 aspect ratio image, ZM works beautifully, image can be seen, it's according to the reality, nothing is distorted.
Now you have another camera, grabbing at 352x288. This is not 4:3 aspect ratio, although it should be. ZM works beautifully, image can be seen, but it's not according to the reality: the picture is narrower than the reality, it looks squished.
The reason:
while at 320x240 the pixels are SQUARE, at 352x288 they are NOT. Actually 320x240 is 1/4 of 640×480, which is the "True" computer square-pixel format (1/1). 352x288 is the format for VCD, DVD, H.261 + H.263 (CIF), having a pixel aspect ratio of 128/117!!
In other words:
320x240 captured images show well, because pixels are square. 352x288 captured images show narrower, because pixels are not square, but wrongly displayed as square in Firefox, on the computer display.
The easiest way to fix this is actually to stretch the images in the viewer (the default case: Firefox), according to the correct aspect ratio of the pixels in that image.
This means:
ZM should know all the supported resolutions of the capturing devices (there aren't many, as the video resolutions are all standardized, and all devices, like capture cards, webcams or network cams conform to these, see below), and when displaying images with the resolutions selected, they must be re-scaled according to their correct pixel aspect ratio. It wouldn't add extra load on the ZM server itself, because everything would work in behind just like now, the viewer application, like the browser, must actually do the stretching of the image, and that can be intelligently achieved from php code. In reality, there's not much work to do: instead of the fields where now one can fill the desired resolution, there should be a drop-down list with the available standard resolutions, and from the resoultion selected, the php code knows how to display the image. No need to use the brand new 'Keep Aspect Ratio' option either, as it is used totally wrong in respect to the standards.
Here is a great documentation on this, that would help in understanding the issue:
A Quick Guide to Digital Video Resolution and Aspect Ratio Conversions
There are listed all the standard resolutions for PAL (named '625-line systems with a 50 Hz field rate') and NTSC (named '525-line systems with a 59.94¹ Hz field rate'). See the table in the document. The column 'pixel aspect ratio (x/y)' has the correction factor that needs to be applied when displaying the images.
Really easy to achieve. Any chances to implement? It would make ZM an application working according to the industry standards.
Square and nonsquare pixels:
A. Square pixels and 4:3 frame aspect ratio
B. Nonsquare pixels and 4:3 frame aspect ratio
C. Nonsquare pixels displayed on a square-pixel monitor
This example illustrates nonsquare pixels form an image with a 4:3 aspect ratio.
An image created with nonsquare pixels is distorted when displayed with square pixels.
Images above show pretty much what happens in ZM, and that is not quite correct.
Try to experiment and see this for yourself:
- place 2 cameras in the same location
- set one to 320x240
- set the other to 352x288 (make sure they don't share the same bt chip, otherwise you won't be able to)
- view them in the montage view, in the browser and see the difference: the second cam's picture is not cropped, but squished.
Other good links on this topic:
http://lurkertech.com/lg/pixelaspect/
http://livedocs.adobe.com/en_US/AfterEf ... -7f3a.html
http://www.microsoft.com/windows/window ... rames.aspx