[FFmpeg-devel] Fixing rotation metadata override

Gilles trolldev at gmail.com
Mon Oct 15 11:29:05 EEST 2018


Hi,

it looks like to me that the issue is still present.

source.mp4 is a vertical video from an iphone, with a 90degres rotation.

mediainfo source.mp4 | grep -i rot
Rotation                                 : 90?

I run:

/usr/local/bin/ffmpeg -autorotate 0 -i ./source.mp4  -metadata:s:v:0
rotate=0 -an -vcodec libx264 -f mp4  out.mp4
ffmpeg version N-92179-gc27c7b49dc Copyright (c) 2000-2018 the FFmpeg
developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
  configuration: --enable-libx264 --enable-gpl
  libavutil      56. 19.101 / 56. 19.101
  libavcodec     58. 33.100 / 58. 33.100
  libavformat    58. 19.100 / 58. 19.100
  libavdevice    58.  4.105 / 58.  4.105
  libavfilter     7. 33.101 /  7. 33.101
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './source.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone XS Max
    com.apple.quicktime.software: 12.0.1
    com.apple.quicktime.creationdate: 2018-10-12T15:32:47+0200
  Duration: 00:00:03.04, start: 0.000000, bitrate: 23697 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv,
bt709), 1920x1080, 23504 kb/s, 59.93 fps, 59.94 tbr, 600 tbn, 1200 tbc
(default)
    Metadata:
      rotate          : 90
      creation_time   : 2018-10-12T13:32:47.000000Z
      handler_name    : Core Media Video
      encoder         : H.264
    Side data:
      displaymatrix: rotation of -90.00 degrees
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
stereo, fltp, 170 kb/s (default)
    Metadata:
      creation_time   : 2018-10-12T13:32:47.000000Z
      handler_name    : Core Media Audio
    Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2018-10-12T13:32:47.000000Z
      handler_name    : Core Media Metadata
    Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2018-10-12T13:32:47.000000Z
      handler_name    : Core Media Metadata
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x3cbea80] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX AVX2 FMA3 LZCNT BMI2
[libx264 @ 0x3cbea80] profile High, level 4.2
[libx264 @ 0x3cbea80] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC codec
- Copyleft 2003-2014 - http://www.videolan.org/x264.html - options: cabac=1
ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11
fast_pskip=1 chroma_qp_offset=-2 threads=72 lookahead_threads=8
sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0
constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1
weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40
intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0
qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'out.mp4':
  Metadata:
    major_brand     : qt
    minor_version   : 0
    compatible_brands: qt
    com.apple.quicktime.creationdate: 2018-10-12T15:32:47+0200
    com.apple.quicktime.location.ISO6709: +48.8848+002.3087+040.257/
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone XS Max
    com.apple.quicktime.software: 12.0.1
    encoder         : Lavf58.19.100
    Stream #0:0(und): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p,
1920x1080, q=-1--1, 59.94 fps, 60k tbn, 59.94 tbc (default)
    Metadata:
      encoder         : Lavc58.33.100 libx264
      creation_time   : 2018-10-12T13:32:47.000000Z
      handler_name    : Core Media Video
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
      displaymatrix: rotation of -90.00 degrees
frame=   66 fps=0.0 q=0.0 size=       0kB time=00:00:00.00 bitrate=N/A
speed=   0x    ^Mframe=  118 fps=115 q=31.0 size=       0kB
time=-00:00:00.01 bitrate=N/A speed=N/A    ^Mframe=  160 fps=105 q=31.0
size=     256kB time=00:00:00.68 bitrate=3066.4kbits/s speed=0.447x
^Mframe=  182 fps= 76 q=-1.0 Lsize=    2130kB time=00:00:02.98
bitrate=5843.8kbits/s speed=1.25x
video:2128kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.115240%
[libx264 @ 0x3cbea80] frame I:1     Avg QP:25.69  size: 74747
[libx264 @ 0x3cbea80] frame P:130   Avg QP:26.60  size: 14220
[libx264 @ 0x3cbea80] frame B:51    Avg QP:27.71  size:  4998
[libx264 @ 0x3cbea80] consecutive B-frames: 44.0% 56.0%  0.0%  0.0%
[libx264 @ 0x3cbea80] mb I  I16..4: 25.9% 49.8% 24.3%
[libx264 @ 0x3cbea80] mb P  I16..4:  6.4%  7.8%  0.3%  P16..4: 34.9%  5.1%
2.5%  0.0%  0.0%    skip:42.8%
[libx264 @ 0x3cbea80] mb B  I16..4:  0.3%  0.5%  0.0%  B16..8: 37.1%  1.1%
0.1%  direct: 0.7%  skip:60.1%  L0:48.1% L1:50.6% BI: 1.2%
[libx264 @ 0x3cbea80] 8x8 transform intra:53.6% inter:86.2%
[libx264 @ 0x3cbea80] coded y,uvDC,uvAC intra: 11.6% 21.3% 1.3% inter: 7.6%
11.0% 0.2%
[libx264 @ 0x3cbea80] i16 v,h,dc,p: 41% 24% 11% 23%
[libx264 @ 0x3cbea80] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 24% 12% 56%  1%  1%
2%  1%  1%  1%
[libx264 @ 0x3cbea80] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 38% 20% 18%  3%  4%
6%  4%  5%  3%
[libx264 @ 0x3cbea80] i8c dc,h,v,p: 64% 17% 18%  1%
[libx264 @ 0x3cbea80] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x3cbea80] ref P L0: 69.8% 13.2% 13.8%  3.2%
[libx264 @ 0x3cbea80] ref B L0: 91.0%  9.0%
[libx264 @ 0x3cbea80] kb/s:5739.08

----------

The resulting file still has a 90degres rotation:
mediainfo out.mp4 | grep -i rot
Rotation                                 : 90?


Le sam. 13 oct. 2018 à 13:41, Carl Eugen Hoyos <ceffmpeg at gmail.com> a
écrit :

> 2018-10-13 8:31 GMT+02:00, Gilles <trolldev at gmail.com>:
>
> > here is a fix for issue: https://trac.ffmpeg.org/ticket/4560
>
> This ticket was fixed years ago and the issue is not
> reproducible with current FFmpeg git head.
>
> > Background: since FFmpeg 3.3, it is not possible to force
> > the rotation metadata to 0, when video is being converted.
> > It only work in -c:v copy mode.
>
> Sounds like ticket #6370.
>
> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list