I have 360° video and I want to fine tune its orientation with ffmpeg. I need to rotate it by 90° clockwise horizontally (turn it left). I found some helpful resources stating that the rotate
filter would do the trick. So I tried:
ffmpeg -i Petr_doskok.mp4 -vf "scale=2048x1024,rotate=-PI/2" -r 30 -c:v libx265 -b:v 15M -pix_fmt yuv420p -c:a aac -b:a 192K Petr_doskok_rotated.mp4
ffmpeg version 4.1.3 Copyright (c) 2000-2019 the FFmpeg developers
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Petr_doskok.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Duration: 00:00:29.06, start: 0.000000, bitrate: 58095 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 4096x2048, 57948 kb/s, SAR 1:1 DAR 2:1, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 184 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> hevc (libx265))
Stream #0:1 -> #0:1 (aac (native) -> aac (native))
x265 [info]: Slices : 1
x265 [info]: Residual QT: max TU size, max depth : 32 / 1 inter / 1 intra
x265 [info]: ME / range / subpel / merge : hex / 57 / 2 / 2
x265 [info]: Keyframe min / max / scenecut / bias: 25 / 250 / 40 / 5.00
x265 [info]: Lookahead / bframes / badapt : 20 / 4 / 2
x265 [info]: b-pyramid / weightp / weightb : 1 / 1 / 0
x265 [info]: References / ref-limit cu / depth : 3 / on / on
x265 [info]: AQ: mode / str / qg-size / cu-tree : 2 / 1.0 / 32 / 1
x265 [info]: Rate Control / qCompress : ABR-15000 kbps / 0.60
x265 [info]: tools: rd=3 psy-rd=2.00 rskip signhide tmvp strong-intra-smoothing
x265 [info]: tools: lslices=6 deblock sao
Output #0, mp4, to 'Petr_doskok_rotated.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.20.100
Stream #0:0(und): Video: hevc (libx265) (hev1 / 0x31766568), yuv420p, 2048x1024 [SAR 1:1 DAR 2:1], q=2-31, 15000 kb/s, 30 fps, 15360 tbn, 30 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.35.100 libx265
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
Metadata:
handler_name : SoundHandler
encoder : Lavc58.35.100 aac
frame= 841 fps=9.8 q=-0.0 Lsize= 54721kB time=00:00:28.03 bitrate=15991.5kbits/s speed=0.326x
video:54028kB audio:659kB subtitle:0kB other streams:0kB global headers:2kB muxing overhead: 0.062856%
x265 [info]: frame I: 4, Avg QP:15.99 kb/s: 39026.34
x265 [info]: frame P: 214, Avg QP:16.15 kb/s: 30083.41
x265 [info]: frame B: 623, Avg QP:19.72 kb/s: 10727.28
x265 [info]: Weighted P-Frames: Y:0.0% UV:0.0%
x265 [info]: consecutive B-frames: 0.5% 0.9% 17.9% 73.9% 6.9%
encoded 841 frames in 86.02s (9.78 fps), 15787.22 kb/s, Avg QP:18.80
[aac @ 000001faa3ead7c0] Qavg: 289.921
Well, the video was really rotated - vertically! The documentation does not reference the 360° video production: http://ffmpeg.org/ffmpeg-filters.html#rotate. What is the correct parameter value for my case?