ffmpeg
is a versatile multimedia framework that can decode, encode, transcode, mux, demux, stream, filter, and play almost any media content. It’s widely used for various multimedia processing tasks, including video rotation.
๐ง Step 1: Install FFmpeg (if not already installed)
If you don’t have ffmpeg
installed on your Linux system, you can install it using your distribution’s package manager. For example, on Ubuntu, you can install it by running:
sudo apt install ffmpeg
๐ป Step 2: Open a Terminal
Once ffmpeg
is installed, open a terminal window. You’ll use the terminal to execute commands for rotating your video.
๐ Step 3: Run the FFmpeg Command
To rotate a video using ffmpeg
, you’ll use the following command:
ffmpeg -i input.mp4 -vf "transpose=1" output.mp4
Let’s break down this command:
-i input.mp4
: This specifies the input video file. Replaceinput.mp4
with the actual filename of your input video.-vf "transpose=1"
: This applies a transpose filter to rotate the video. The value1
corresponds to rotating the video 90 degrees clockwise. You can adjust this value for different rotations:0
for 90 degrees counterclockwise,2
for 90 degrees counterclockwise and flip horizontally,3
for 90 degrees clockwise and flip horizontally.output.mp4
: This is the name of the output video file. Replaceoutput.mp4
with your desired output filename.
โ๏ธ Step 4: Wait for the Process to Complete
After running the ffmpeg
command, wait for the process to complete. Depending on the size and length of your video, it may take some time to finish.
โ Step 5: Objective Complete
Once the process is complete, you’ll have a newly rotated video file ready to go.