I’m having a bit of trouble with figuring out the playback size of anamorphic videos. I have a movie, for example, that the QuickTime Player application reports to be 720 x 480 (640 x 480). XOJO reports the movie size as 720 x 480. It appears that to play it back properly, the video should be sized to 640 x 480. How can I programmatically determine the playback dimensions from with XOJO?
Anamorphic NTSC SD is normally 720 x 480 (or 486) and will have wide non-square pixels. Nominally playback would “stretch” it to 854 x 480 (or 486)(16x9). Normally 720 x 480 is a 4x3 aspect ratio (still non-square pixels). 640x480 is true 4x3 though!
Anamorphic PAL SD is 720x576. :), again playback “stretches” it to 854 pixels wide.
There is usually a flag set in the video file that would tell playback if anamorphic and needs to be stretched. If not you will need to manually force it playback.
Now a way lot easier in HD land
The thing is, Xojo reports 720 x 480 as the size of the video. I need to size the movieplayer to the correct size for my application. So what size should I make the movieplayer? If I make the player 720 x 480, the movie stretches wrongly. The answer is 640 x 480 to make it look correct, but how do I know that, given an arbitrary video file? I only know this because I inspected it with QuickTime Player. Seems like there should be some way to inspect the video for this information, like QuickTime Player does.
All full size Anamorphic SD (Standard Def) files should report back 720x480 (or 486) unless PAL (Europe etc), however there is normally a flag set in the Quicktime headers to tell the player that it should scale the video to 16x9 aspect ratio. My suspicions is if 640x480 shows correct then it’s not anamorphic. Try forcing the movieplayer to 854x480 if you can.
16x9 would look correct on 640x360 though to0.
It’s been sometime since I dealt with SD files, I’m totally in the HD MXF realms now. Unfortunately I spent many years dealing with aspect ratio disasters etc.
I probably didn’t make my issue clear; let me start again. I’m loading lots of video files and occasionally I get one that looks stretched. One of them, for example, reports its size as 720 x 640. To look right, the movieplayer needs to be 640 x 480. Is the video a standard anamorphic video? I don’t know and I really don’t care much. I just need to know how to size the movieplayer to play whatever video file is opened in it.
So the question is, IN XOJO, how can I know what size to set the movieplayer to in order to make it look right? I can’t force the movieplayer to any one particular size, because the movieplayer plays other movies as well, that display at other sizes. I need to be able to inspect the video IN XOJO somehow and determine what size to make the movieplayer. So the question is how to do that.
If the source video file does not set the aspect ratio details then I think it’s next to impossible. I did a quick google.
FYI, in the broadcasting world we had to manually change settings on video clips, not uncommon to get files with incorrect or no widescreen/aspect ratio flags set. Even seen DVD’s coded incorrectly.
When I open the moves in the QuickTime Player app, they appear correct. The Movie Inspector window gives the size in pixels followed by another set of sizes in parentheses. So QuickTime knows how to deal with this. Perhaps the flags are set correctly in the files. Now, how to read these flags in Xojo?
I’ll dig through the MBS plugin documentation to see if there’s anything there that may help with reading the headers for this info.
Still not getting anywhere with this. I’ve tried this code:
Dim f As FolderItem
Dim m As Movie
Dim theSizeW As Integer
Dim theSizeH As Integer
Dim theBSizeW As Integer
Dim theBSizeH As Integer
Dim theNSizeW As Integer
Dim theNSizeH As Integer
Dim theCSizeW As Integer
Dim theCSizeH As Integer
if f=nil then Return
Dim mMBS as new QTKitMovieMBS(f)
theSizeW = theMovie.MovieWidth
theSizeH = theMovie.MovieHeight
theBSizeW = theMovie.BaseMovieWidth
theBSizeH = theMovie.BaseMovieHeight
theNSizeW = mMBS.NaturalSizeWidth
theNSizeH = mMBS.NaturalSizeHeight
theCSizeW = mMBS.CurrentSizeWidth
theCSizeH = mMBS.CurrentSizeHeight
This basically opens a file as both a standard movie and also as a QTKitMovieMBS, then shows four different size measurements of the movie. All report the movie to be 720 x 480.
QuickTime Player shows the movie’s size as “720 x 480 (640 x480)”
The movie needs to be shown at 640 x 480 to be correct. QuickTime Player does this correctly. In my app, I load in the movie, read its size, then scale the player according to the size that I read in. But my app always shows the size as 720 x 480, so the scaling is performed wrongly. Where can I get this 640 width number from? QuickTime Player knows about it, so there must be a way.