0

I have a video file that is a QuickTime .mov (H.264) - if I open with QuickTime Player 10 and check with Movie Inspector I can see that the prescaled size is 1440x1080 and the display size is 1920x1080.

I open the video with QTKit and the following attributes: QTMovieOpenAsyncOKAttribute, QTMovieIsActiveAttribute, QTMovieResolveDataRefsAttribute, QTMovieDontInteractWithUserAttribute.

Both QTMovieCurrentSizeAttribute and QTMovieNaturalSizeAttribute give 1920x1080.

If I open the movie with QuickTime 7 I can use GetMovieBox() to find the size is 1920x1080 and frames can be accessed at 1440x1080. How can I get the 1440x1080 resolution information using QTKit ?

I already tried using the affine transform as given in this question: QTMovieCurrentSizeAttribute and QTMovieSizeDidChangeNotification replacements but it gave an identity transform.

Community
  • 1
  • 1
koan
  • 3,596
  • 2
  • 25
  • 35

1 Answers1

0

You need to get the dimensions of the actual video track, not the movie.

QTTrack* videoTrack = nil;

for (QTTrack* track in [movie tracks])
{
    if ([track attributeForKey:QTTrackMediaTypeAttribute] == QTMediaTypeVideo)
    {
        videoTrack = track;
        break;
    }
}

NSSize dimensions = [(NSValue*)[videoTrack attributeForKey:QTTrackDimensionsAttribute] sizeValue];

Usually there is no need to do it, because dimensions of the video track and QTMovieNaturalSizeAttribute are equal. However, with anamorphic videos movie natural size attribute tells us how the video should be displayed, when track dimensions represent size of the actual video frame (which is smaller).

QTMovieCurrentSizeAttribute is odd add deprecated, it is not related to the data at all.

Davyd Geyl
  • 4,578
  • 1
  • 28
  • 35
  • I just tried this and it gave me the display size, not the actual dimensions for the video frame. – koan May 17 '12 at 08:52