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

Baptiste Coudurier baptiste.coudurier at gmail.com
Fri Apr 8 01:27:43 CEST 2011


Hi Dave,

On 4/7/11 5:31 AM, Dave Badia wrote:
> Hi Baptiste -
> 
> On Tue, Apr 5, 2011 at 7:53 PM, Baptiste Coudurier
> <baptiste.coudurier at gmail.com> wrote:
>>
>> Set the metadata on AVStream, not AVFormatContext.
>>
>> Are you sure that the check is 100% correct for the rotation ?
>>
>> --
>> Baptiste COUDURIER
>> Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
>> FFmpeg maintainer                                  http://www.ffmpeg.org
>>
> 
> Ok, new patch with metadata set on AVStream.  I'm quite sure the logic
> is correct as I have a couple of different samples from my iphone 4.
> I used dumpster to look at the raw matrix then integrated the code
> into ffmpeg and tested it in mythtv.
> 
> Interrogate MOV metadata for orientation of video so that software can
> determine if the video needs to be rotated.
> 
> Thanks
> Dave
> 
> ---
>  libavformat/mov.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 23ba1d4..8745d60 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(&st->metadata, "rotate", "180", 0);
> +    }

Are you sure it's 180 ?

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org


More information about the ffmpeg-devel mailing list