ffmpeg one liner to downscale all videos in a directory


This article assumes that you've already installed ffmpeg.


If you want to downscale your videos for sharing, this little one liner is a nice way to do so.

# Look through all files in the current directory
for file in ./*;
  ffmpeg -i "$file" -filter:v scale=960:-1 -c:a copy "$file.mp4";

You'll need to make sure that the first number for the scale ratio is a number that's the source video dimensions are divisible by. So for example the source video files were 1920 x 1080, 960 is half of 1920.

If you aren't sure what the dimensions of your videos are, you can also use this one liner for json output.

ffprobe -v quiet -print_format json -show_format -show_streams ~/your/path/yourvideo.format


Blake Dietz

Blake Dietz is a software engineer that lives in Boise, Idaho. He enjoys mountain biking in the Boise foothills and tinkering on side projects in his spare time.

Read More