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.
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:
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
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.
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.
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
player.setUseTexture(false);
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)
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.
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 )