I have a video that shows fine in media player, but when uploaded on youtube it shows rotated.
Metadata shown in ffmpeg -i thefile.mp4 shows a rotation of 270 degrees.
I read here
Strip metadata from all formats with FFmpeg
That
this command,
ffmpeg -i in.mov -map_metadata -1 -c:v copy -c:a copy out.mov
would get rid of the metadata.
But for me it doesn't.
Here's my file
C:\blah>dir first.mp4
...
21/12/2019 21:51 21,487,116 first.mp4
Notice ffmpeg -i shows the rotate in this file that I am starting with, first.mp4
C:\Users\User\aa\sdf>ffmpeg -i first.mp4
ffmpeg version N-94664-g0821bc4eee Copyright (c) 2000-2019 the FFmpeg developers
....
libpostproc 55. 6.100 / 55. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'first.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.31.104
Duration: 00:00:10.03, start: 0.000000, bitrate: 17138 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/smpte170m), 1920x1080, 17003 kb/s, SAR 1:1 DAR 16:9, 28.61
30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 270
handler_name : VideoHandle
Side data:
displaymatrix: rotation of 90.00 degrees
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : SoundHandle
At least one output file must be specified
--
And mediainfo shows the rotation in the file i'm starting with, first.mp4
C:\Users\User\aa\sdf>mediainfo first.mp4
General
Complete name : first.mp4
...
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
....
Rotation : 270°
Frame rate mode : Variable
...
Audio
ID : 2
Format : AAC LC
....
--
Now I apply the command in that solution I linked to, but notice it doesn't work for me
C:\Users\User\aa\sdf>ffmpeg -i first.mp4 -map_metadata -1 -c:v copy -c:a copy zzz.mp4
ffmpeg version N-94664-g0821bc4eee Copyright (c) 2000-2019 the FFmpeg developers
....
libpostproc 55. 6.100 / 55. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'first.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.31.104
Duration: 00:00:10.03, start: 0.000000, bitrate: 17138 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/smpte170m), 1920x1080, 17003 kb/s, SAR 1:1 DAR 16:9, 28.61
30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 270
handler_name : VideoHandle
Side data:
displaymatrix: rotation of 90.00 degrees
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : SoundHandle
Output #0, mp4, to 'zzz.mp4':
Metadata:
encoder : Lavf58.31.104
Stream #0:0: Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/smpte170m), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 17003 kb/s, 28
ps, 30 tbr, 90k tbn, 90k tbc (default)
Side data:
displaymatrix: rotation of 90.00 degrees
Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 287 fps=0.0 q=-1.0 Lsize= 20984kB time=00:00:09.99 bitrate=17192.4kbits/s speed= 323x
video:20818kB audio:156kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.044614%
see the rotate data is still there
C:\Users\User\aa\sdf>ffmpeg -i zzz.mp4
ffmpeg version N-94664-g0821bc4eee Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 9.1.1 (GCC) 20190807
...
libpostproc 55. 6.100 / 55. 6.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'zzz.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.31.104
Duration: 00:00:10.03, start: 0.000000, bitrate: 17138 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709/bt709/smpte170m), 1920x1080, 17003 kb/s, SAR 1:1 DAR 16:9, 28.61
30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 270
handler_name : VideoHandler
Side data:
displaymatrix: rotation of 90.00 degrees
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : SoundHandler
At least one output file must be specified
--
C:\Users\User\aa\sdf>mediainfo zzz.mp4
General
Complete name : zzz.mp4
Format : MPEG-4
...
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Rotation : 270°
...
Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
...
C:\Users\User\aa\sdf>