FFmpeg is a free and open-source set of programs and libraries. It is specially created for processing multimedia files. It has many applications, and one of them is rotating a video. You can rotate any video using FFmpeg irrespective of the size and format. In this article, we will have a look at FFmpeg rotate video feature. We will discuss the step-by-step procedure to rotate a video using FFmpeg. We will also introduce some better alternatives.
Part 1. Rotate Videos Using FFmpeg From Command Line
FFmpeg can be used to rotate your videos. You only need a single command for it. You can follow the given steps to rotate any video using FFmpeg.
Step 1: First, you need to download FFmpeg. You can search on Google and download it for your computer. Then, set it up and make sure it is working fine. Open the command line and type "ffmpeg", if it works, you can go to the next step.
Step 2: Now, you need to go to the directory/folder where you have stored the video file. You can use the following command.
You need to copy the path of the file and replace it in the above command. Enter the command and hit Enter.
Step 3: You can rotate the video using the following command,
ffmpeg -i input.mp4 -vf "transpose=1" output.mp4
In the above command, you need to replace "input" with the original file name and "output" with the name that you want for the output file. Make sure to enter the right extension of the input file. If it is MOV, then you need to write it instead of MP4. You don't need to match the extension of the output file; it can be the same or anything else. It means you can also convert the file at the same time.
Another important thing is the value of "transpose". The rotation of the video depends on its value.
0 = 90° rotation anti-clockwise and vertical flip
1 = 90° rotation clockwise
2 = 90° rotation anti-clockwise
3 = 90° rotation clockwise and vertical flip
There is no command for 180° or 270° rotation, but you can do it. You can use the transpose command multiple times. You can use the followings,
For 180° = =transpose=1,transpose=1"
For 270° = =transpose=1,transpose=1,transpose=1"
Thus, the command for 270° would be like,
ffmpeg -i input.mp4 -vf " transpose=1,transpose=1,transpose=1" output.mp4
Step 4: After writing the command, hit enter. Wait for a few minutes, and your file will be ready. Check the file location and see the video.
Part 2. FFmpeg Can't Rotate Video? Solved
Problem 1: Can't get rotation metadata removed from video file in FFmpeg
Sometimes the rotation information is stored in the metadata. Thus, after the rotation of the video, it can easily be detected that the video was rotated. If you use such a video on YouTube, any software program, or any other platform, it will detect the rotation and show it. The metadata depends on the command you have used. The command that we have discussed does not retain the rotation in metadata, so you can use it without any hassle. It works perfectly well.
ffmpeg -i input.mp4 -vf "transpose=1" output.mp4
Problem 2: FFmpeg rotate 90 degree on Windows not working
There can be issues with some commands on Windows. So, you might not get the desired or expected results. However, the following command works perfectly well on Windows.
ffmpeg -i input.mp4 -vf "transpose=1" output.mp4
The command will rotate the video by 90° in the clockwise direction. For anti-clockwise, you need to set transpose=2.
Problem 3: The rotated file audio does not sync with video in FFmpeg?
If the audio is not synced, you need to use "setpts". It is a filter that changes the presentation timestamp of input frames. It could help you match the audio with the video. You can use the following line of command.
The above command will apply an offset of 10 seconds to input the presentation timestep. You can change the value "10" to any value you want.
Problem 4: FFmpeg is not recognized
You might get an error that FFmpeg is not recognized as an internal or external command. This usually happens when you forget to add the path of the exe files in the environment variables. Go to Control Panel>System>Advanced System Settings. Click on Environment Variables. You will see the Path variable. Select it and click on Edit. Click on New and paste the location of the bin folder of FFmpeg that contains all the exe files. You are ready to use FFmpeg on the command line.
Part 3. Pros and Cons of Using FFmpeg to Rotate Video
There are several pros and cons of using FFmpeg to rotate a video. Let's have a look at them.
Single Line of Command:
You only need a single line of code to rotate the video. Thus, if you know the code, you can rotate the video in no time. The command only requires the input and output file name, and the rest will be done by the program. It hardly takes a few seconds to rotate the video and create the final file.
You can also change the video format while rotating the video. Whatever video format you need, just enter it after the name of the output file. The video conversion will be done while rotating the video. The best thing about it is that it supports all formats.
Video editors are mostly paid, and if there is a free one, you will have the watermark in the video. In contrast, FFmpeg is completely free, and there won't be any watermark.
There is no limit on the duration or file size. You can convert any video without any hassle.
Difficult to Set Up
FFmpeg is not easy to set up. You need to understand everything first and make everything ready before you start using it. Most of the time, it does not work because of small issues. Beginners usually find these things difficult, and understanding the nitty-gritty of commands is not easy. Thus, beginners avoid using it, and they prefer easy and simple video editors.
Takes Time to Rotate the Video
FFmpeg takes time to rotate the video. Everything depends on the size of the video file, and then it converts everything frame by frame. It can take a lot of time for large video files.
The video quality can also be affected while processing the file using FFmpeg. Some commands affect the quality.
Part 4. Best Alternative to FFmpeg for Rotating Video
iMyFone Filme is a very simple video editing application. You can do anything within a few clicks. It does not require any command on the command line, and it is perfect for beginners. The user interface is quite simple, and anyone can use it without any hassle. You can quickly do any type of video editing from basic to advanced.
Step to Rotate a Video Using Filme
Step 1: Open Filme on your computer (it is available for both Mac and Windows). Click on the File menu and move the cursor to New Project. You will have different options for the aspect ratio. Click on the aspect ratio you want for the video.
Step 2: Now, you need to import the video file to rotate it. In the Media menu, you will see four options for import. You can import files and folders from your PC or any Android phone. Filme also supports wireless transfers via QR code. Import the video clip, and you will see it in My Media after importing. Drag the video to the timeline.
Step 3: Double-click on the video in the timeline. You will see some video editing options on the right of the canvas. There will be a Rotate option. You can rotate the video as you like. You can rotate it to any angel with a precision of 0.01°. You can either move the pointer on the bar to adjust the angle or type in the box. After adjusting the rotation, click on OK.
Another option is to rotate the video using the mouse pointer. You will see a rectangle over the video. You can adjust the position, size, and rotation of the video through it. First, move the video a little lower to see the rotating point. You will see the rotating point at the top center. Now, you can click on it and rotate the video as you like. After rotation, you can adjust the position of the video.
Step 4: Go to the Export menu and click on Export Video. Enter the name of the video and select the location. You can select the desired video format and quality. Go to Settings to adjust frame rate, bit rate, and everything you like. When you are done, click on Export.
Filme is an all-in-one video editor that has everything you need. You can edit your videos like a professional. It does not need any experience.
You can add effects, transitions, text, stickers, or anything else to the video. You can make the video more engaging and attractive.
There are tools for splitting, cropping, rotation, color adjustment, etc. Moreover, every tool has excellent accuracy.
The Fast Video allows you to create an awesome slideshow in one click.
You can export the file in any format you like. You can select the advanced settings, including frame rate, bitrate, codec, file format, and audio settings.
HandbBrarke is an open-source video transcoder. It is a free application available for Windows, Linux, and Mac. It is primarily created to convert the video file to the desired format, but you can use the application to make various changes in the video. You can rotate the video, apply some filters, adjust audio settings, add subtitles, change resolution, and do various changes.
There are two methods to rotate the video using HandBrake. You can use any of the methods that work in your case.
Method 1: Using the Rotate Filter
Step 1: Open HandBrake on your computer. You need to drag and drop the video file to it. You can also open a file or batch of files using the options on the left.
Step 2: The video will be imported in a few seconds. You will see everything like the image below.
Now, you need to go to the Filters tab. You will see the Rotate option in the filters. Click on the down arrowhead. You will have four options. You can choose 0°, 90°, 180°, and 270°. Choose the desired angle.
Step 3: At this stage, you can also make other changes to the video, such as dimensions, audio, subtitles, or anything. You will see the Save As option at the bottom. You can select the file location here. Finally, click on Start Encode. This will start encoding the file, and the file will be saved at the selected location. You can now play the video.
Method 2: Using Advanced Option
Step 1: Open HandBrake on your computer. Click on File to upload the video click. You can also drag the video clip to HandBrake.
Step 2: Once the file is imported, you need to go to the Video tab. At the bottom, you will see Advanced Options. This is where you need to write a piece of code to rotate the video.
For clockwise 90° rotation =, --rotate=4
For anti-clockwise 90° rotation =, --rotate=7
You can type the code in the Advanced Options according to the rotation you need. Keep in mind that the code must be correct. You need to add the comma, space, and hyphens, as shown above.
Step 3: Click on Start Encode. It will take a few minutes/seconds, and your file will be ready.
HandBrake is an open-source tool, so it is free, and there won't be a watermark.
It can help you convert the video file to any desired format. You can also select the desired video codec.
You can change the audio code, bitrate, and other settings. You can also remove the noise from the video.
The framerate of the video can also be changed. It ranges from 5 FPS to 120 FPS.
FFmpeg is a powerful tool, especially for those who love to play with commands and codes. Even if you don't know much about it, you can easily rotate a video through it. If you want to rotate video during playback, you can try VLC to rotate video which can satisfy your rotating demand. We have explained how you can use the FFmpeg rotate video feature using a single line of command. If you don't want to use FFmpeg, we have also introduced some alternatives. We recommend Filme as it is a simple video editor that can rotate a video and make basic to advanced changes without any hassle. It is a perfect video editor for beginners, and anyone can create a stunning video by using it.