iPhone MP4: wrong width reported

Locked
hmfireball
User
Posts: 3
Joined: Fri Mar 15, 2013 4:34 pm
Are you a spambot?: no

iPhone MP4: wrong width reported

Post by hmfireball » Fri Mar 15, 2013 4:43 pm

568.88888549805 is reported as width instead of 480.
Reported height is correct.
See below.

Code: Select all

Array
(
    [GETID3_VERSION] => 1.9.5-20130220
    [filesize] => 62091236
    [filename] => myfile.mp4
    [filepath] => E:/xxx/files
    [filenamepath] => E:/xxx/files/myfile.mp4
    [avdataoffset] => 48
    [avdataend] => 62091236
    [fileformat] => mp4
    [audio] => Array
        (
            [dataformat] => mp4
            [codec] => ISO/IEC 14496-3 AAC
            [sample_rate] => 48000
            [channels] => 2
            [bits_per_sample] => 16
            [lossless] => 
            [channelmode] => stereo
            [streams] => Array
                (
                    [0] => Array
                        (
                            [dataformat] => mp4
                            [codec] => ISO/IEC 14496-3 AAC
                            [sample_rate] => 48000
                            [channels] => 2
                            [bits_per_sample] => 16
                            [lossless] => 
                            [channelmode] => stereo
                        )

                )

        )

    [video] => Array
        (
            [dataformat] => quicktime
            [resolution_x] => 568.88888549805
            [resolution_y] => 320
            [fourcc] => avc1
            [frame_rate] => 1000
        )

    [tags] => Array
        (
            [quicktime] => Array
                (
                    [track_number] => Array
                        (
                            [0] => 1
                        )

                    [comment] => Array
                        (
                            [0] => www.dvdvideosoft.com
                        )

                    [creation_date] => Array
                        (
                            [0] => 2013
                        )

                    [encoder] => Array
                        (
                            [0] => Lavf54.29.105
                        )

                )

        )

    [warning] => Array
        (
            [0] => Unknown QuickTime atom type: "chpl" (63 68 70 6c) at offset 62091105
        )

James Heinrich
getID3() v1 developer
Posts: 1475
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: iPhone MP4: wrong width reported

Post by James Heinrich » Fri Mar 15, 2013 4:52 pm

Can you post or email me a link to the sample file so I can trace the problem, please?

hmfireball
User
Posts: 3
Joined: Fri Mar 15, 2013 4:34 pm
Are you a spambot?: no

Re: iPhone MP4: wrong width reported

Post by hmfireball » Fri Mar 15, 2013 5:49 pm

Hi James,

You may download video here (it is a different version from the one I posted data above):
http://www.mt-environnement.com/sites/d ... ck-qtp.mp4

James Heinrich
getID3() v1 developer
Posts: 1475
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: iPhone MP4: wrong width reported

Post by James Heinrich » Fri Mar 15, 2013 10:56 pm

The width value is stored as

Code: Select all

02 38 e3 8e
which translates (using QuickTime's "Fixed" encoding, as implemented in getid3_lib::FixedPoint16_16) to

Code: Select all

0x0238 = 568
plus
0xE38E / 0xFFFF = 58254 / 65536 = 0.88888549805
so a total width value of 568.88888549805 as returned by getID3.

I thought perhaps the width value is being modified by the Transformation Matrix, but the associated matrix is simply the standard identity matrix (ie no transformation).

I'm investigating further...

James Heinrich
getID3() v1 developer
Posts: 1475
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: iPhone MP4: wrong width reported

Post by James Heinrich » Fri Mar 15, 2013 11:50 pm

So, I have discovered that I was incompletely/incorrectly parsing (for video tracks) the Video Sample Description section of the moov:trak:mdia:minf:stbl:stsd atom. This does contain the correct image dimensions.

The problem illustrated here, and what I really hate about Quicktime files, is that there's many places that the same information can be stored, and it's not uncommon to find conflicting data, so how to decide which of multiple presented values are "most correct".

The attached patched version should return correct dimensions for your sample file. Please let me know if the changes broke anything else.
Attachments
module.audio-video.quicktime.php
(110.83 KiB) Downloaded 657 times

hmfireball
User
Posts: 3
Joined: Fri Mar 15, 2013 4:34 pm
Are you a spambot?: no

Re: iPhone MP4: wrong width reported

Post by hmfireball » Tue Mar 19, 2013 2:23 pm

Sorry for this late answer James.

I confirm that your patched version works as expected.
Thank you very much for fixing this so quickly and for your great work!

Locked