ffmpeg - Transcoding

Introduction

This is a super basic usage of ffmpeg for changing video quality. Very useful for home media servers, or just people who own devices that record 4k in x264 or worse…

ffmpeg basics

Make video smaller (but still good quality) ffmpeg -i input.mkv -vcodec libx264 -crf 24 output.mkv

CRF values: x264: 0 (lossless) - 23 (default) - 51 (worst) x265: 0 (lossless) - 28 (default) - 51 (worst)

Multiple files

Change the file extension, and CRF value to whatever you need

mkdir ffmpeg_output
for file in *.mkv; 
	do ffmpeg -i "\$file" -vcodec libx264 -crf 20 "ffmpeg_output/${file%.mkv}".mkv
done