Everybody knows about the H.264 video format that is often used for encoding videos that you watch on online video streaming sits such as Youtube or Facebook. These H.264 videos have become popular for their fast encoding, small file size and better quality. But now there is a successor to H.264 video format available called H.265. Using the H.265 video format, you can encode the H.265 and MPEG-H HEVC streams. This new format provides even more compression and superior quality compared to H.264.
Because of the faster encoding and superior quality, H.265 is being readily adopted for many online video streaming sites. It is particularly useful for live broadcasting at a relatively higher resolution such as 2K or even 4K. Popular applications such as Avidemux, ELDER, ffdshow, ffmpeg, GordianKnot, StaxRip or VLC media player already provide support for the H.265 format videos.
If you want to encode videos to H.265 format, then you can use the open-source x265 encoder. This encoder supports 32×32, 16×16, 8×8 and 4×4 transformations, lossless encoding on multiple processors, adaptive encoding and contextual encoding. This encoder is available either as a library to be used by developers or as a command line tool x265 encoder.
However using the command line encoder is very easy. For example, if you want to encode a video names “input.mkv” having a frame-rate of 25 FPS and video resolution of 1920×1080, then you can give the following command:
x265 --input input.mkv --fps 25 --input-res 1920x1080 --output output.mkv
This will encode the video using x265 and save it as “output.mkv”. If you do not want to encode using x265 encoder, then you can also use FFmpeg which is also a command line encoder with x265 support. For FFmpeg, you have use a command in the following manner:
ffmpeg -i input.mkv -c:v libx265 -c:a aac output.mkv
According to the official website, the resulting files can be one-fourth of the original file size. In out experiments, we could compress the source videos to one-third of the source video file. But the encoding takes very long time compared to some other codecs.