Batch-resize videos on Ubuntu Linux with ffmpeg

So, the case is as follows:

I have about 15 videos files that were recorded at 4K and are very large in size. I wanted to keep everything as is, but just reduce the resolution to HD (720p).

ffmpeg would be great to achieve this, so I created the following script:

for i in *.MP4;
 do name=`echo $i | cut -d'.' -f1`;
 echo $name;
 ffmpeg -i $i -s 1280x720 -c:a copy $name.mp4.mp4;

This loops them one-by-one and calls ffmpeg to process them and create an output file with the same name, but with extension .mp4.mp4 (just to distinguish them, nothing more).

That’s it! Enjoy!


About SoCRaT

Systems Engineer, OSS & Linux Geek
This entry was posted in Linux, Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s