Issues with pixel ratios in ofVideoPlayer


I’m trying to make a simple video player in OF but I’m having trouble with videos recorded in HDV. These videos appear the correct size however the image within the frame appears to be squashed to the left - i think because of the anamorphic pixel aspect ratios.

Do I have to do something to treat these types of videos differently? And if so, how would I detect the pixel aspect of a video in code?

Thanks loads for your help - I’ve been googling for the past couple of weeks and still haven’t managed to find a solution.


Is anyone able to help me with this? I’m still having the same problems when trying to play HDV videos




I don’t think there is a way to detect if the pixels are square or 1.33:1
But if you know that the videos you are loading needing compensation for the pixel ratio you could do something like this:

float pixelRatio = 1.333333;
vidPlayer.draw(0,0,vidPlayer.getWidth()*pixelRatio, vidPlayer.getHeight());

I’m assuming that is the pixel ratio.
Is the video coming in as 1440x1080 when loaded?

Hope that helps!

Hi Theo,

Thanks for your help. You are right, that is the pixel ratio… unfortunately the videos are being detected as 1920x1080 when it loads rather than 1440x1080.

Your post is helpful to sort out the issue of compensation however the issue I still have is how to detect if the compensation is needed as I want to be able to play multiple videos in any order and change according to the ratio on the fly.

Let me know if you have any thoughts for this second problem…

ps. for info I am using a mac for this, just in case that effects anything

no problem!

so all videos both the ones that need compensation and ones which don’t are showing 1920 x 1080 for getWidth() and getHeight()?

could you post a screenshot of how the videos look in your app ( both the ones which don’t need the compensation and the ones that do? )


Sorry for the delay. Yes they are both showing 1920x1080 unfortunately…

The top image is how the video should look and the bottom one is the one with 1.33:1 pixels.


Hi Theo (and everyone),

Did you have any time to think more about this? I still haven’t found a solution to this and I really need to complete something this week if possible.


Hello @SofieOdette ,

how are your video’s encoded, and with what program?

Which platform are you on (ofVideoPlayer relies on platform-specific implementations)?



Thanks for your response. The platform is Mac for the moment (although i want to try and put it on linux soon)

These test videos are encoded on premiere pro. Every encoding with 1.33 pixels seems to have the same results. Also, this is something i can’t change because the app is for an artist who cannot change the format of the videos because they are too long.

I think this problem is definitely in OF, I have had many problems with various versions of premier not tagging pixel aspect ratios correctly so I made a few HDV test movies with a few other apps to see what happened. These movies play as expected with all the players I have.

When I load the movie in OF with On OSX the console reports

video loaded at 1920 x 1080 @ 25.000000 fps

and when I call getWidth() it returns 1920, when I draw the movie with no parameters for width and height it does draw a 1920*1080 movie

Strangely HDV is actually 1888*1062 if you get info from quicktime (screen shot below)

This movie is, as you see HDV displayed on my screen at 1920*1080. The movie has a couple of lines of red pixels on the right hand edge. Here is a screenshot of what happens when I play it in OF with the following in the draw code (my screen is 1920 * 1200 so you can see what is drawn by the background and what is drawn by the movie player.

 ofSetBackgroundColor(0, 255, 0);
 player.draw(0, 0);

The movie plays as 14401080 and the rest of the texture (correctly allocated by OF as 19201080) is filled buy repeating the last line of pixels on the right hand side.

Strangely calling


results in no image at all being drawn

I am using the master branch of OF tag 0.9.2 on OSX 10.11.3

It would be great if someone can confirm on windows and linux if this is the behaviour and I will make a bug report.

I uploaded a test movie in HDV here (I’ll leave it for a week or so)


Hi Fred,

Thanks so much for adding more clarity to this thread. I’m going to try and do this on linux this week and see if i get the same issues.

Thanks for posting this @fresla - could you leave the video link up?
I opened an issue for this in Github - we’ll aim to have this fixed for the next non patch release.

@fresla - some updates here:

I have been able to figure out if a video has a non square pixel ratio and make it so instead of showing up as 1920x1080 with a bunch of unallocated pixels in the texture, it simply shows up as a 1440x1080 video which can be scaled to look correct. This is at least part of the way towards a solution.

Appreciate any thoughts on the matter ( see the Github comments )


Hi Theo,

Thanks for you work on this. It’s great! I hope i should be able to use this to achieve what I need at least.