[FFmpeg-devel] [PATCH] Extract rotation in MOV metadata

Michael Niedermayer michaelni at gmx.at
Tue May 3 05:19:01 CEST 2011


On Sat, Apr 30, 2011 at 01:22:32AM +0200, Stefano Sabatini wrote:
> On date Saturday 2011-04-30 01:09:15 +0200, Jean-Daniel Dupas encoded:
> > 
> > Le 30 avr. 2011 à 00:55, Stefano Sabatini a écrit :
> > 
> > > On date Tuesday 2011-04-05 16:53:32 -0700, Baptiste Coudurier encoded:
> > >> Hi Dave,
> > >> 
> > >> On 04/05/2011 04:49 PM, Dave Badia wrote:
> > > [...]
> > >>> Interrogate MOV metadata for orientation of video so that software can
> > >>> determine if the video needs to be rotated.
> > >>> ---
> > >>> libavformat/mov.c |    4 ++++
> > >>> 1 files changed, 4 insertions(+), 0 deletions(-)
> > >>> 
> > >>> diff --git a/libavformat/mov.c b/libavformat/mov.c
> > >>> index 23ba1d4..b12890f 100644
> > >>> --- a/libavformat/mov.c
> > >>> +++ b/libavformat/mov.c
> > >>> @@ -1907,6 +1907,10 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb,
> > >>> MOVAtom atom)
> > >>>     sc->width = width >> 16;
> > >>>     sc->height = height >> 16;
> > >>> 
> > >>> +    if (display_matrix[0][0] == -65536 && display_matrix[1][1] == -65536) {
> > >>> +         av_metadata_set2(&c->fc->metadata, "rotate", "180", 0);
> > >>> +    }
> > > 
> > > It was already said, but why such a specific check? IMO it would much
> > > more useful to export the rotation information (e.g. 90, 180,
> > > etc.). Which are the acceptable rotation values?
> > > 
> > > Also, how should we export this information to the application level
> > > (e.g. for auto-inserting a corresponding rotation filter at the begin
> > > of the filterchain)?
> > 
> > If your goal is to apply a filter based on the track matrix, I don't
> > understand what the point of extracting the rotation only.
> > It would be easier to extract the whole matrix, and write an 'affine
> > transform' filter to apply the matrix instead of bothering with
> > rotation, which is just a special case of affine transform.
> 
> > If the track matrix specifies a rotation, a translation, and a scaling, applying only one transform will be wrong anyway.
> 
> Yes, now the point is how to expose this MOV specific affine transform
> matrix to AVStream/to the application level.

either
AVStream int [3][3]
or metadata of 3x3 integers

Bikeshed time ...

[...]
--
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In fact, the RIAA has been known to suggest that students drop out
of college or go to community college in order to be able to afford
settlements. -- The RIAA
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110503/816a57ad/attachment.asc>


More information about the ffmpeg-devel mailing list