Convert Video Files using ffmpeg


This is a command I use to reduce the size of the video lessons we make available on the Computational Logic website.

for file in *.mp4; do ffmpeg -i $file -vf "scale=iw/2:ih/2" $(basename $file ".mp4")-small.mp4; done

The command converts all mp4 files in the current folder reducing their video size by half.

Further reduce with:

ffmpeg -i input.mp4 -vcodec libx264 -crf 20 output.mp4

Both solutions (and others not listed here) taken from How can I reduce a video’s size with ffmpeg?

Author: Adolfo Villafiorita

Last modified: 2020-10-12 Mon 12:06 (created on: 2020-09-28 Mon 00:00)

Published: 2021-02-28 Sun 20:00