I try to learn about the basics of video encoding/decoding so I played around with ffmpeg a little to get my hands on it and not just read about the topic.
Accodring to the ffmpeg documentation there are two options to configure the compression of a h265 encoded video file. The first is the -crf option and the second is the -preset option.
https://trac.ffmpeg.org/wiki/Encode/H.264 https://trac.ffmpeg.org/wiki/Encode/H.265
The crf option does what I expect that it does, the lower the value, the better the quality, the brigger the file size. So far so good. But what I don't understand is the -preset option.
The documentation says:
A preset is a collection of options that will provide a certain encoding speed to compression ratio. A slower preset will provide better compression (compression is quality per file size). This means that, for example, if you target a certain file size or constant bit rate, you will achieve better quality with a slower preset. Similarly, for constant quality encoding, you will simply save bitrate by choosing a slower preset. Use the slowest preset that you have patience for. The available presets in descending order of speed are:
ultrafast
superfast
veryfast
faster
fast
medium – default preset
slow
slower
veryslow
placebo – ignore this as it is not useful (see FAQ)
So I encoded my input file once with ultrafast and once with veryslow:
ffmpeg -i Input.mkv -c:a aac -c:v libx265 -preset ultrafast -crf 15 output_crf-15_preset_ultrafast.mp4
ffmpeg -i Input.mkv -c:a aac -c:v libx265 -preset veryslow -crf 15 output_crf-15_preset_veryslow.mp4
The results are very confusing for me:
33M Dez 24 16:43 Input.mkv
90M Dez 24 16:48 output_crf-15_preset_ultrafast.mp4
116M Dez 24 19:34 output_crf-15_preset_veryslow.mp4
first of all, the copressed videos have a bigger filesize then the input file? Then the veryslow-version which should compress better has a bigger filesize then the ultrafast-version? That does not make any sense to me.
In addition I also did a lossless encoding
ffmpeg -i Input.mkv -c:a aac -c:v libx265 -x265-params lossless=1 output_crf-15_lossless.mp4
And the resulting file is about 1.2GB in size? Why does that happen? Shouldn't it be as big as the original?
The testfile and results: https://mega.nz/folder/Ok8UhCRB#DDblMnGgSoJ0LeE_DtVmGg