Rotate videos in bulk using FFMPEG

As I said in the previous post about updating and installing FFMPEG I absolutely love the program especially in combination with PowerShell for me to use as a tool. I am required to use FFMPEG sometimes for users that need assistance in various video compression or editing. Today I would like to share my script to rotate a video or a bulk of videos. There are numerous reasons that I can think off that you would want to rotate the video. In my case it can mostly be maybe a simple user error but it could of course just as well be something else.

Let’s dive into what the script does and how you do use it. The first example is the big one and for me the most useful. The example below takes all mp4 files for the location you are in and rotate them 90 degrees. The Rotation parameter is used from the script to be user-friendly to read and to use and it has options for 90, 180 or 270 degrees.

Get-ChildItem -Filter *.mp4 | ./Rotate-Video -Rotation 90

It is an example that uses the output of Get-ChildItem with the filter parameter and puts it straight into the script. Which is very handy but could just as well be used for a single video if you would like of course. For the second example I will use a single file as the one that I would like to rotate. Let’s say that my video file is placed on the desktop and convert it but this time 180 degrees.

Get-ChildItem C:\users\username\Desktop\Video.mp4 | ./Rotate-Video -Rotation 180

Keep in mind that this will use the default path that I use for my FFMPEG installation needs which is C:\ffmpeg. However it could just as well be another path that you are using to manage your FFMPEG installation. In this case I included a parameter for you to use named FFMPEGPath. This parameter needs to be pointed to the exe of FFMPEG.

If you are interested you can of course download the script under here. At this moment I am not releasing it on GitHub as I would like to make a full FFMPEG powershell module that can rotate or compress or any other action you might to use FFMPEG for.

Download the script here

Leave a Comment