[FFmpeg-devel] tkhd transformation matrix in mov is ignored except for width/height and scaling

Michael Niedermayer michaelni
Mon Nov 2 21:11:30 CET 2009

On Mon, Nov 02, 2009 at 09:09:16AM -0800, Samuel Gendler wrote:
> On Mon, Nov 2, 2009 at 3:28 AM, Daniel G. Taylor <dan at programmer-art.org>
>  wrote:
> >
> > I believe the issue is related to not having a rotation filter in FFmpeg
> > at the moment (correct me if I'm mistaken) so even if we have the data
> > stored in the mov context the best that can be done is writing the same
> > values to the final output.
> >
> > I take a slightly different approach here and use a little script I
> > wrote to try and guess the rotation angle using the inverse sin/cos and
> > a little Python. You aren't the first to have issues with this stuff so
> > today I released it here:
> >
> > http://github.com/danielgtaylor/qtrotate/
> >
> > It's the same script I use at work to automagically detect rotation and
> > then I insert the MPlayer rotate filter into our processing chain so
> > that we can process rotated videos from customers (and we get a few from
> > iPhones and digicams). It's far from perfect but so far it has worked
> > nicely.
> >
> ffmpeg shouldn't require a rotation filter to handle this corectly, I'd
> think.  It should render each pixels through the matrix, which will result
> in rotation without any filter in the chain.  It seems like performing the
> necessary math during the decode process shouldn't be too hard to add.  I

it will not be done during decoding. Its not more efficient there and it
is less flexible if the output can handle rotated input. Besides there are
hundreads of video decoders.

> assume that the scaling info is being used during decode, and it would seem
> a good bet that the full matrix transformation could be applied at the same
> place to get the correct result.  The one weirdness is the inversion of
> width and height in the outbound stream.

nothing of this matrix is used anywhere yet except possibly the aspect ratio
and that is just exportet. Similarly the rest of the matrix should be


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20091102/8426d2f8/attachment.pgp>

More information about the ffmpeg-devel mailing list