[FFmpeg-user] Rotating an mp4 video on Windows
Elie Grouchko
elie at grouchko.net
Mon Aug 8 21:08:27 EEST 2016
Thank you Peter and all the other contributors.
Here is some more information:
WMP doesn't respect the metadata rotate flag, I tried that.
Please see below the command line output.
The transposed video can be played back with VLC.
With WPM I can hear the sound, but no video.
I also tried the following:
-r 30
-r 2
-y
-b 300k
-codec:a
-pix_fmt yuv420p
I tried mencoder, but it wouldn't run complaining of missing stuff during compilation
I know nothing about video encoding, codecs, etc. and all I am looking for is easy way to rotate a video on Windows without having to change the default media player, or other system changes.
I hope it is possible to specify some options on the command line that will make the output file compatible with WMP...
Thank you for your help!
Elie
Command line output:
G:\DataContainer2\Misc\Rotate Video>"C:\Special Programs\ffmpeg\bin\ffmpeg" -i
source.mp4 -vf "transpose=1" target.mp4
ffmpeg version N-81291-g7387506 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.4.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-dx
va2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-lib
ebur128 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --ena
ble-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfree
type --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enab
le-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-lib
openjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-lib
snappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame
--enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx
--enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-
libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enab
le-zlib
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 51.100 / 57. 51.100
libavformat 57. 46.100 / 57. 46.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 49.100 / 6. 49.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'source.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.46.100
Duration: 00:00:20.65, start: 0.000000, bitrate: 17160 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080
, 17014 kb/s, 29.89 fps, 29.92 tbr, 90k tbn, 180k tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, flt
p, 256 kb/s (default)
Metadata:
handler_name : SoundHandler
[libx264 @ 00000000004dc3c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
AVX
[libx264 @ 00000000004dc3c0] profile High, level 4.0
[libx264 @ 00000000004dc3c0] 264 - core 148 r2705 3f5ed56 - H.264/MPEG-4 AVC cod
ec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 r
ef=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_pski
p=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 dec
imate=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
[mp4 @ 000000000062ee60] Using AVStream.codec to pass codec parameters to muxers
is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, mp4, to 'target.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.46.100
Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 1
080x1920, q=-1--1, 29.92 fps, 11488 tbn, 29.92 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.51.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
Stream #0:1(eng): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz, stereo
, fltp, 128 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc57.51.100 aac
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
frame= 41 fps=0.0 q=0.0 size= 0kB time=00:00:01.60 bitrate= 0.2kbits/s
frame= 48 fps= 47 q=0.0 size= 0kB time=00:00:01.83 bitrate= 0.2kbits/s
frame= 59 fps= 39 q=29.0 size= 155kB time=00:00:02.17 bitrate= 581.8kbits/
frame= 69 fps= 34 q=29.0 size= 364kB time=00:00:02.53 bitrate=1175.0kbits/
frame= 74 fps= 29 q=29.0 size= 493kB time=00:00:02.70 bitrate=1490.1kbits/
frame= 80 fps= 26 q=29.0 size= 635kB time=00:00:02.90 bitrate=1793.8kbits/
frame= 86 fps= 24 q=29.0 size= 809kB time=00:00:03.09 bitrate=2141.7kbits/
frame= 95 fps= 22 q=29.0 size= 1056kB time=00:00:03.39 bitrate=2550.2kbits/
frame= 103 fps= 21 q=29.0 size= 1257kB time=00:00:03.66 bitrate=2805.3kbits/
frame= 111 fps= 21 q=29.0 size= 1453kB time=00:00:03.94 bitrate=3015.1kbits/
frame= 112 fps= 18 q=29.0 size= 1469kB time=00:00:03.94 bitrate=3048.9kbits/
frame= 124 fps= 19 q=29.0 size= 1808kB time=00:00:04.37 bitrate=3387.5kbits/
frame= 128 fps= 18 q=29.0 size= 1948kB time=00:00:04.50 bitrate=3545.7kbits/
frame= 139 fps= 18 q=29.0 size= 2269kB time=00:00:04.86 bitrate=3822.2kbits/
frame= 146 fps= 17 q=29.0 size= 2487kB time=00:00:05.09 bitrate=3996.2kbits/
frame= 154 fps= 17 q=29.0 size= 2764kB time=00:00:05.37 bitrate=4212.1kbits/
frame= 160 fps= 17 q=29.0 size= 2985kB time=00:00:05.56 bitrate=4391.3kbits/
frame= 169 fps= 17 q=29.0 size= 3306kB time=00:00:05.86 bitrate=4615.9kbits/
frame= 169 fps= 16 q=29.0 size= 3306kB time=00:00:05.88 bitrate=4599.2kbits/
frame= 183 fps= 16 q=29.0 size= 3770kB time=00:00:06.33 bitrate=4874.4kbits/
frame= 190 fps= 16 q=29.0 size= 4104kB time=00:00:06.57 bitrate=5116.7kbits/
frame= 198 fps= 16 q=29.0 size= 4386kB time=00:00:06.84 bitrate=5246.7kbits/
frame= 205 fps= 16 q=29.0 size= 4626kB time=00:00:07.08 bitrate=5351.0kbits/
frame= 213 fps= 16 q=29.0 size= 4905kB time=00:00:07.33 bitrate=5475.6kbits/
frame= 220 fps= 16 q=29.0 size= 5141kB time=00:00:07.57 bitrate=5560.7kbits/
frame= 227 fps= 15 q=29.0 size= 5396kB time=00:00:07.80 bitrate=5660.9kbits/
frame= 237 fps= 15 q=29.0 size= 5752kB time=00:00:08.14 bitrate=5782.1kbits/
frame= 245 fps= 15 q=29.0 size= 6044kB time=00:00:08.42 bitrate=5876.2kbits/
frame= 254 fps= 15 q=29.0 size= 6426kB time=00:00:08.72 bitrate=6033.3kbits/
frame= 260 fps= 15 q=29.0 size= 6665kB time=00:00:08.91 bitrate=6122.6kbits/
frame= 263 fps= 15 q=29.0 size= 6812kB time=00:00:09.02 bitrate=6184.2kbits/
frame= 274 fps= 15 q=29.0 size= 7273kB time=00:00:09.38 bitrate=6347.8kbits/
frame= 279 fps= 15 q=29.0 size= 7456kB time=00:00:09.55 bitrate=6391.1kbits/
frame= 289 fps= 15 q=29.0 size= 7852kB time=00:00:09.89 bitrate=6498.1kbits/
frame= 301 fps= 15 q=29.0 size= 8328kB time=00:00:10.28 bitrate=6634.8kbits/
frame= 313 fps= 15 q=29.0 size= 8758kB time=00:00:10.68 bitrate=6712.6kbits/
frame= 325 fps= 15 q=29.0 size= 9172kB time=00:00:11.09 bitrate=6773.0kbits/
frame= 335 fps= 15 q=29.0 size= 9514kB time=00:00:11.43 bitrate=6816.2kbits/
frame= 341 fps= 15 q=29.0 size= 9735kB time=00:00:11.62 bitrate=6859.4kbits/
frame= 346 fps= 15 q=26.0 size= 9912kB time=00:00:11.79 bitrate=6882.9kbits/
frame= 355 fps= 15 q=29.0 size= 10180kB time=00:00:12.07 bitrate=6906.2kbits/
frame= 363 fps= 15 q=29.0 size= 10507kB time=00:00:12.37 bitrate=6956.1kbits/
frame= 369 fps= 15 q=29.0 size= 10707kB time=00:00:12.56 bitrate=6980.2kbits/
frame= 377 fps= 15 q=29.0 size= 10995kB time=00:00:12.84 bitrate=7013.4kbits/
frame= 383 fps= 14 q=29.0 size= 11243kB time=00:00:13.03 bitrate=7065.9kbits/
frame= 391 fps= 14 q=29.0 size= 11684kB time=00:00:13.31 bitrate=7189.9kbits/
frame= 396 fps= 14 q=29.0 size= 11897kB time=00:00:13.46 bitrate=7239.8kbits/
frame= 401 fps= 14 q=29.0 size= 12106kB time=00:00:13.65 bitrate=7263.4kbits/
frame= 406 fps= 14 q=29.0 size= 12301kB time=00:00:13.80 bitrate=7301.0kbits/
frame= 417 fps= 14 q=29.0 size= 12657kB time=00:00:14.16 bitrate=7319.7kbits/
frame= 423 fps= 14 q=29.0 size= 12805kB time=00:00:14.37 bitrate=7295.5kbits/
frame= 428 fps= 14 q=29.0 size= 12919kB time=00:00:14.54 bitrate=7274.1kbits/
frame= 437 fps= 14 q=29.0 size= 13349kB time=00:00:14.84 bitrate=7364.7kbits/
frame= 443 fps= 14 q=29.0 size= 13588kB time=00:00:15.03 bitrate=7401.1kbits/
frame= 452 fps= 14 q=29.0 size= 13911kB time=00:00:15.33 bitrate=7429.4kbits/
frame= 457 fps= 14 q=29.0 size= 14118kB time=00:00:15.50 bitrate=7457.1kbits/
frame= 468 fps= 14 q=29.0 size= 14596kB time=00:00:15.87 bitrate=7533.6kbits/
frame= 480 fps= 14 q=29.0 size= 15074kB time=00:00:16.27 bitrate=7586.2kbits/
frame= 488 fps= 14 q=29.0 size= 15384kB time=00:00:16.55 bitrate=7612.8kbits/
frame= 496 fps= 14 q=29.0 size= 15693kB time=00:00:16.81 bitrate=7647.2kbits/
frame= 500 fps= 14 q=29.0 size= 15836kB time=00:00:16.95 bitrate=7649.2kbits/
frame= 509 fps= 14 q=29.0 size= 16185kB time=00:00:17.25 bitrate=7682.4kbits/
frame= 512 fps= 14 q=29.0 size= 16294kB time=00:00:17.34 bitrate=7696.0kbits/
frame= 524 fps= 14 q=29.0 size= 16715kB time=00:00:17.72 bitrate=7723.7kbits/
frame= 530 fps= 14 q=29.0 size= 17043kB time=00:00:17.96 bitrate=7772.6kbits/
frame= 536 fps= 14 q=29.0 size= 17273kB time=00:00:18.15 bitrate=7794.2kbits/
frame= 547 fps= 14 q=29.0 size= 17674kB time=00:00:18.51 bitrate=7818.7kbits/
frame= 550 fps= 14 q=29.0 size= 17779kB time=00:00:18.62 bitrate=7820.2kbits/
frame= 559 fps= 14 q=29.0 size= 18119kB time=00:00:18.92 bitrate=7843.9kbits/
frame= 565 fps= 14 q=29.0 size= 18322kB time=00:00:19.11 bitrate=7852.3kbits/
frame= 574 fps= 14 q=29.0 size= 18665kB time=00:00:19.43 bitrate=7867.5kbits/
frame= 583 fps= 14 q=29.0 size= 18951kB time=00:00:19.73 bitrate=7867.3kbits/
frame= 590 fps= 14 q=29.0 size= 19192kB time=00:00:19.96 bitrate=7873.8kbits/
frame= 596 fps= 14 q=29.0 size= 19402kB time=00:00:20.15 bitrate=7883.9kbits/
frame= 604 fps= 14 q=29.0 size= 19676kB time=00:00:20.43 bitrate=7886.8kbits/
frame= 613 fps= 14 q=29.0 size= 20077kB time=00:00:20.60 bitrate=7980.8kbits/
frame= 613 fps= 13 q=-1.0 Lsize= 22399kB time=00:00:20.65 bitrate=8885.6kbits
/s speed=0.433x
video:22054kB audio:322kB subtitle:0kB other streams:0kB global headers:0kB muxi
ng overhead: 0.104637%
[libx264 @ 00000000004dc3c0] frame I:14 Avg QP:22.31 size: 86573
[libx264 @ 00000000004dc3c0] frame P:162 Avg QP:24.53 size: 50958
[libx264 @ 00000000004dc3c0] frame B:437 Avg QP:25.62 size: 30012
[libx264 @ 00000000004dc3c0] consecutive B-frames: 3.4% 3.3% 3.9% 89.4%
[libx264 @ 00000000004dc3c0] mb I I16..4: 14.3% 79.2% 6.5%
[libx264 @ 00000000004dc3c0] mb P I16..4: 11.3% 39.0% 2.8% P16..4: 30.8% 6.9
% 2.5% 0.0% 0.0% skip: 6.6%
[libx264 @ 00000000004dc3c0] mb B I16..4: 2.0% 6.5% 0.3% B16..8: 41.0% 6.3
% 1.0% direct: 9.3% skip:33.5% L0:48.3% L1:47.1% BI: 4.6%
[libx264 @ 00000000004dc3c0] 8x8 transform intra:74.1% inter:74.6%
[libx264 @ 00000000004dc3c0] coded y,uvDC,uvAC intra: 60.0% 40.6% 1.0% inter: 23
.2% 19.8% 0.0%
[libx264 @ 00000000004dc3c0] i16 v,h,dc,p: 15% 19% 23% 42%
[libx264 @ 00000000004dc3c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 16% 29% 6% 6%
6% 6% 6% 6%
[libx264 @ 00000000004dc3c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 20% 21% 6% 8%
7% 7% 6% 4%
[libx264 @ 00000000004dc3c0] i8c dc,h,v,p: 64% 19% 15% 2%
[libx264 @ 00000000004dc3c0] Weighted P-Frames: Y:1.2% UV:1.2%
[libx264 @ 00000000004dc3c0] ref P L0: 63.9% 13.1% 15.5% 7.6% 0.0%
[libx264 @ 00000000004dc3c0] ref B L0: 92.6% 5.8% 1.6%
[libx264 @ 00000000004dc3c0] ref B L1: 97.2% 2.8%
[libx264 @ 00000000004dc3c0] kb/s:8816.90
[aac @ 00000000004ff8a0] Qavg: 1576.559
G:\DataContainer2\Misc\Rotate Video>pause
Press any key to continue . . .
-----Original Message-----
From: ffmpeg-user [mailto:ffmpeg-user-bounces at ffmpeg.org] On Behalf Of Peter White
Sent: August-08-16 1:34 AM
To: FFmpeg user questions <ffmpeg-user at ffmpeg.org>
Subject: Re: [FFmpeg-user] Rotating an mp4 video on Windows
Elie Grouchko wrote:
> I have been trying to rotate an mp4 video file on Windows, without > affecting the quality, encoding, etc. ...
I believe that is not possible. At least I cannot think of a way of doing it without re-encoding.
> ... but the output file is not compatible with WMP.
Yikes! That program from the firm that invented "incompatibilities" to bind and oppress their customers?!
Maybe give some alternatives a go, generally, like VLC, MPC-HC etc.
I think to remember that at least one of these programs supports rotating at playback time by means of filters/effects.
> The command I have been using:
> ffmpeg -i source.mp4 -vf "transpose=2" target.mp4
More output would have been nice. But I don't need it to tell you that this command does affect quality. -vf implies re-encoding, hence quality loss, unless one uses a lossless codec for the target which this command does not. And lossless video is rather huge.
But for completeness' sake, a command that rotates and compresses the video losslessly:
$ ffmpeg -i input.mp4 -vf "transpose=2" -c:v libx264 -crf 0 target.mp4
Just don't come crying about the size of target.mp4. ;)
I think applying filters at playback is the better option. You might even be able to save a batch file that starts playback with the filter/effect applied to make it more transparent and less of a hassle.
> I tried all the options I have been able to find online, but nothing > worked.
If you have done so, why not tell us what you have already tried? ;) Makes things a whole lot easier.
And just out of pure curiosity and spite I would like to know what that unholy WMP complains about. :P
Best,
Peter
_______________________________________________
ffmpeg-user mailing list
ffmpeg-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-user
To unsubscribe, visit link above, or email ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
More information about the ffmpeg-user
mailing list