I had a pretty good experience with the h265 codec.
The output videos were between 2-8x smaller in size, without any noticeable loss in quality.
ffmpeg -i input.mkv -c:v libx265 -vtag hvc1 -c:a copy output.mkv
If you want to further reduce the filesize, x265 supports CRF and two different target bitrate algorithms:
Similar to x264, the x265 encoder has multiple rate control
algorithms, including:
- 1-pass target bitrate (by setting -b:v)
- 2-pass target bitrate
- Constant Rate Factor (CRF)
CRF:
While the bitrate is variable with CRF, the quality is pretty much the same from frame to frame.
The CRF can be any value between 0 and 51, where lower values would result in higher quality. What you want to do would be to set a relatively high CRF. This of course makes the quality worse.
Choose a CRF. CRF affects the quality. The default is 28, and it
should visually correspond to libx264 video at CRF 23, but result in
about half the file size. CRF works just like in x264, so choose the
highest value that provides an acceptable quality.
Choose a preset. The default is medium. The preset determines
compression efficiency and therefore affects encoding speed. Valid
presets are ultrafast, superfast, veryfast, faster, fast, medium,
slow, slower, veryslow, and placebo. Use the slowest preset you have
patience for. Ignore placebo as it provides insignificant returns for
a significant increase in encoding time.
Choose a tune (optional). By default, this is disabled, and it is
generally not required to set a tune option. x265 supports the
following -tune options: psnr, ssim, grain, zerolatency, fastdecode.
They are explained in the H.264 guide.
CRF Example
ffmpeg -i input -c:v libx265 -crf 28 -preset slower -c:a copy output.mp4
Note that in the example we simply copy the audio stream. You could also transcode the audio stream to save an additional few MBs.
https://www.computerhope.com/issues/ch001724.htm
then open them with VLC to find the codecs used. AV1 https://evilmartians.com/chronicles/better-web-video-with-av1-codec is also a new codec which offers even greater compression than HEVC (h.265). – K7AAY Jul 23 '19 at 15:24ffmpeg -i input.mp4 -vcodec libx264 -s hd720 -crf 35 -vf output.mp4
as adjust the -crf __ value – KetZoomer Oct 05 '20 at 19:37