ubuntu:video:rotate_videos_with_ffmpeg
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
ubuntu:video:rotate_videos_with_ffmpeg [2020/02/13 00:05] – peter | ubuntu:video:rotate_videos_with_ffmpeg [2023/06/06 18:30] (current) – peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Ubuntu - Video - Rotate Videos with FFmpeg ====== | ====== Ubuntu - Video - Rotate Videos with FFmpeg ====== | ||
+ | |||
+ | ===== Software Encoding ===== | ||
<code bash> | <code bash> | ||
ffmpeg -i in.mov -vf " | ffmpeg -i in.mov -vf " | ||
</ | </ | ||
+ | |||
+ | <WRAP info> | ||
+ | **NOTE: | ||
+ | |||
+ | * You can usually copy the audio without touching it, by using **-c:a copy**. | ||
+ | * To change the video quality, set the bitrate (for example with **-b:v 1M**) or have a look at the H.264 encoding guide if you want VBR options. | ||
+ | |||
For the transpose parameter you can pass: | For the transpose parameter you can pass: | ||
Line 14: | Line 23: | ||
Use **-vf " | Use **-vf " | ||
+ | </ | ||
- | <WRAP info> | + | ---- |
- | **NOTE: | + | |
- | You can usually | + | If you don't want to re-encode your video AND your player |
+ | |||
+ | <code bash> | ||
+ | ffmpeg -i input.m4v -metadata: | ||
+ | </ | ||
+ | |||
+ | Check the rotate metadata first with: | ||
+ | |||
+ | <code bash> | ||
+ | ffmpeg -i input.m4v 2>&1 | grep rotate | ||
+ | </ | ||
+ | |||
+ | ---- | ||
+ | |||
+ | To rotate the picture clockwise you can use the rotate filter, indicating a positive angle in radians. With 90 degrees equating with PI/2, you can do it like so: | ||
+ | |||
+ | <code bash> | ||
+ | ffmpeg -i in.mp4 -vf " | ||
+ | </ | ||
+ | |||
+ | for counter-clockwise the angle must be negative | ||
+ | |||
+ | <code bash> | ||
+ | ffmpeg -i in.mp4 -vf " | ||
+ | </ | ||
+ | |||
+ | |||
+ | It is possible to get finer-grained resolution of radians, because | ||
+ | |||
+ | <code bash> | ||
+ | ffmpeg -i in.avi -vf " | ||
+ | </ | ||
+ | |||
+ | (slightly less rotation than -PI/4 = -10*PI/40 | ||
- | To change the video quality, set the bitrate (for example with **-b:v 1M**) or have a look at the H.264 encoding guide if you want VBR options. | ||
- | </ | ||
---- | ---- |
ubuntu/video/rotate_videos_with_ffmpeg.1581552332.txt.gz · Last modified: 2020/07/15 09:30 (external edit)