[FFmpeg-devel] [PATCH]Reset rotation information when using the transpose filter

Clément Bœsch ubitux at gmail.com
Thu Nov 15 10:02:35 CET 2012


On Thu, Nov 15, 2012 at 09:36:59AM +0100, Carl Eugen Hoyos wrote:
> Hi!
> 
> A user report indicates that reencoding rotated QuickTime movies with the 
> transpose filter (to fix the rotation) leads to videos that QuickTime shows 
> incorrectly rotated.
> 
> The patch is completely untested;-(
> 
> Please comment, Carl Eugen

> diff --git a/libavfilter/vf_transpose.c b/libavfilter/vf_transpose.c
> index dc2ee21..050c109 100644
> --- a/libavfilter/vf_transpose.c
> +++ b/libavfilter/vf_transpose.c
> @@ -32,6 +32,7 @@
>  #include "libavutil/pixdesc.h"
>  #include "libavutil/imgutils.h"
>  #include "libavutil/internal.h"
> +#include "libavutil/dict.h"
>  #include "avfilter.h"
>  #include "formats.h"
>  #include "internal.h"
> @@ -179,6 +180,8 @@ static int start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
>      if (!outlink->out_buf)
>          return AVERROR(ENOMEM);
>  
> +    av_dict_set(&picref->metadata, "rotate", NULL, 0);
> +
>      outlink->out_buf->pts = picref->pts;
>  

I can think of several problems with this:
 - the metadata is per frame while AFAIK the rotate metadata is at stream
   level in the MOV
 - transpose is a filter to physically change the video: the correct way
   is likely to kept the metadata after the transcode (isn't it the case?)

   This is IMO what is expected in a transcode:
       input:  meta: rotate=90
               phys: 0°
                 => player honoring meta → 90° rotated playback
       output: meta: rotate=90
               phys: 90°
                 => player honoring meta → 180° rotated playback

   IIRC in the user post, it was just ffplay ignoring the rotate metadata,
   and thus the fix IMO belongs to ffplay (something like if rotate
   metadata found, auto inject a transpose filter).

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20121115/f0dd5b2b/attachment.asc>


More information about the ffmpeg-devel mailing list