Skip navigation
Adobe Agency Partner
Currently Being Moderated

webcam video looks stretched on Mac

Jun 22, 2012 8:58 AM

Tags: #video #as3 #webcam #stretched

Hi,

 

in some cases we found out that the image of a webcam looks stretched when using a webcam on a mac. In my case I used a Logitech C910 (which definitely supports 16:9 resolutions) on a Mac running Mac OS X 10.6.8.

 

In my project I want to show a webcam video in 16:9 but want to switch between different 16:9 camera resolutions (320 x 180, 480 x 270, 640 x 360). Under Windows every resolution of the camera looks fine - nothing is stretched. You can check whether the image is stretched or not best by holding a round cup in front of the webcam and check whether it is still round in the video. But when using a Mac, the webcam video looks sometimes stretched. The cup is not round anymore.

 

I have built a small test application running at http://interactive-pioneers.com/camTest/. It shows three different webcam displays: on the left hand side the video will always resize to the resolution, width and height set in the dropdown (4:3 and 16:9). The video in the middle will always stay 16:9 with a fixed size of 320 x 180. The video on the right hand side will always stay 4:3 with a fixed size of 320 x 240. Whenever you change the dropdown, the webcam size will be updated via camera.setMode.

 

Under Windows everything works as expected:

- left video: cup is always round, no stretching

- video in center: cup is always round whenever a 16:9 resolution is chosen. cup is stretched vertically whenever a 4:3 resolutions is chosen

- right video: cup is always round whenever a 4:3 resolution is chosen. cup is stretched horizontally whenever a 16:9 resolutions is chosen

 

This is what I totally expected. It makes sense.

 

But not on a Mac:

- left video: cup is round for 320x240 (4:3), 320x180 (16:9) and 640x480 (4:3). It is stretched vertically for 480x360 (4:3) and 480x270 (16:9). It is stretched horizontally for 640x360 (16:9). This doesn't make any sense for me. It should be round in all cases as it does under Windows.

- video in center: cup is round for 320x180 (16:9) and 480x360 (4:3). It is stretched vertically for 480x270 (16:9). It is stretched horizontally for all other resolutions. It would make sense if the cup is round for all 16:9 resolutions as under Windows.

- right video: cup is round for 320x240 (4:3),640x480 (4:3) and 640x360 (16:9). It is stretched vertically for all other resolutions. It would make sense if the cup is round for all 4:3 resolutions as under Windows.

 

Due to this test result I am not able to show a 16:9 webcam video on a Mac which is not stretched in some 16:9 resolutions.

 

Is there any chance to get around this issue?

 

Please find screenshots with the cup here: http://interactive-pioneers.com/camTest/cam_squeeze_images.zip

 

Thanks for your help.

 

Malte

 
Replies
  • Currently Being Moderated
    Jun 23, 2012 7:11 AM   in reply to Adobe Agency Partner

    I've recently been doing a lot with webcams and I do find it's a combination of hardware and OS that determines the capabilities. Windows will almost let you do anything (including make terrible resolution decisions). Each camera has a set of specific supported resolutions for best quality however.

     

    Thing is, the 910 uses software compression whereas the 920 uses hardware. OS X could easily read the list of available resolutions and due to having no hardware to handle odd resolutions, OS X punts your efforts to use something out of spec because it's responsible in the end for rendering it.

     

    Also check this link because of the driver differences:

     

    http://logitech-en-amr.custhelp.com/app/answers/detail/a_id/25726

     

    Check the link in additioal information as it goes over the features available using logitec drivers versus UVC on Windows vs MacOS (it's not pretty).

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 25, 2012 4:47 AM   in reply to Adobe Agency Partner

    The driver and the camera are definitely responsible. The drivers job is to validate the incoming resolution request against the cameras capabilities and hand a feed that's as close as possible to it. The camera is clearly sending back a feed. What we can't tell is if it's the driver or the camera. Installing the Logitech driver, even temporarily, may solve that question.

     

    If it's the driver then when you request a resolution, it checks the capabilities of the camera and most likely gets the next highest resolution, stretches it to your request and sends it back.

     

    If it's the camera then it's doing something very similar. The driver makes a request for a resolution, the camera knows it doesn't support that resolution and sends something higher expecting the driver to "fix" the issue, but the UVC driver blindly sends back the data at the requested resolution.

     

    Typically you always install the driver on windows and/or it already has one that's completely capable installed by default so you're always getting the best experience.

     

    Best of luck!

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 26, 2012 6:24 AM   in reply to Adobe Agency Partner

    It appears to be so. The 920 may support more resolution options on the Mac or have better compatability. You can always grab some cams at a local retailer and test them and take back any that don't work for you.

     

    You may simply need to branch the code for a Mac and do some "viewport" faking to fix the issue. Use a larger resolution than you need, then shrink it down and only show the portion of it you need at the correct aspect. It's a quick fix.

     

    If that's all you need please mark the thread complete and good luck!

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 26, 2012 7:17 AM   in reply to Adobe Agency Partner

    Ah so it's not a controlled setup like a kiosk or something. Yes you will not be able to tell if it's distorted. You'd need to put a special button on Mac to allow the user to indicate there's an aspect ratio issue and toggle it to try to fix it. If the distortion ratio is equal no matter what resolution you chose they could toggle that button and it would fix their video. It'd be um... a Mac "feature" .

     

    Good luck!

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 26, 2012 8:23 AM   in reply to Adobe Agency Partner

    You're welcome

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 27, 2012 4:31 AM   in reply to Adobe Agency Partner

    If you put a 3rd party between the driver and flash, such as an encoder, it could be doing the same thing we're talking about here, fixing it for you before it hands the feed off. It very well may be a bug, I'm not discounting that. At my agency almost everyone except myself runs macs and I've heard all sorts of interesting remarks while using flash, some of which I can't repeat here .

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 1, 2012 6:20 AM   in reply to Adobe Agency Partner

    Hello, I think this is a Flash Player's bug....... I try to write some code in Adobe cs 5.5 in Mac and TestMovie
    (Cs5.5's TestPlayer)IT Works prefect and no any stretched..... but I put the same swf to browser(11.4) or stand alone debugPlayer(11.2.202.228) or higher player it was broken(stretched);

     

     

    Code:

    var cam:Camera=Camera.getCamera();

    cam.setMode(640,360,30,true);

    var vid:Video=new Video();

    vid.width=cam.width;

    vid.height=cam.height;

    vid.attachCamera(cam);

    addChild(vid);

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 24, 2014 10:56 AM   in reply to Stand.Tsai

    Hi.

    We are currently still running into this issue.  With web cam image capture on mac the image width is squished.  This only happends on Safari and Firefox, not on Chrome.  Has anyone incountered this issue and afound a solution?

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 24, 2014 11:28 AM   in reply to paulsakebomb

    As reply #12 mentioned testing in Flash works fine, that's probably because it's testing on version 10.2 by default (just trace(flash.system.Capabilities.version); and it should say 10,2,x,x). You're supposed to replace the FlashPlayerDebugger when you update to a newer versions profile so the debugger will be the correct version and this issue should happen equally inside flash (CTRL/CMD+SHIFT+ENTER to debug).

     

    Has anyone simply hard coded some values to what they desire to unstretch the video? e.g. don't set vid.width = cam.width;, hardcode it to what you want for a temporary workaround.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points