Hardware-Encode Video in H.265 with Free Tools to Save Disk Space
Many web meeting services have a recording functionality. Most recordings are provided as MP4 files with the video encoded in H.264 because that offers the most universal compatibility. However, it also needs a lot of disk space. H.264 has a successor, H.265, which only requires half the space for the same visual quality. This post shows how to use StaxRip, a free tool, to re-encode H.264 video into H.265 quickly by making use of GPU hardware encoding.
Preparation
- Download and extract StaxRip. I used the current stable version 1.7 x64
- Start StaxRip
- When opening the first video file, StaxRip may ask you to install AviSynth. Do so by clicking Install AviSynth+.
Configuring the Conversion Settings
- Click x264 and choose one of the following depending on your GPU vendor: NVIDIA H.265, Intel H.265 or AMD H.265
- Click MKV and select MP4 (mp4box) instead
- Click the Opus entry next to the first audio stream field and select copy/mux
- Click the Opus entry next to the first audio stream field and select no audio
The result should look like this:
Performing the Conversion
- Right-click Source > Open > File Batch and select the files you want to convert
- Click Next to start the conversion
- The output files are placed in the same directory as the input files with the extension _new
Conversion Performance
The Nvidia GTX 1060 GPU in my desktop PC encoded H.265 at the impressive rate of approximately 420 frames per second (full HD, 1920×1080).
The Intel HD Graphics 620 (Core i7-7500U) in my laptop only reached about 113 frames per second for the same content. Still impressive, but a lot less fast.
An interesting difference between the two GPUs: while the Nvidia encode used the GPU’s dedicated video encoding engine, the Intel encode used the GPU’s generic 3D engine.
Another noteworthy difference: the file generated by the Intel encode was 38% smaller than the file generated by the Nvidia encode.
Space Savings
The original videos of a four-day training recorded with Skype had a size of 7.6 GB. Converted to H.265 the size was reduced to 2.4 GB, which amounts to 68% savings!
GPU Performance Monitoring
If you are interested in monitoring your GPU’s performance and find out how its various engines are used, take a look at our uberAgent product. During the Nvidia encoding, for example, the GPU’s video encoding engine was nearly at 100% load and its generic compute engine at approximately 20%:
3 Comments
Thanks for this …
But here’s my question … I want to run this with 100% no loss in quality. But the settings for this and handbrake seem to lack this as an option. I also understand that you can actually make a file larger when transcoding.
So what is the default setting to maintain 100% quality (audio & video).
Thanks in advance.
All video codecs (well, all that matter outside of video editing) are lossy codecs. What you are asking for does not exist.
That is technically not quite true. The h.265 standard allows for a lossless mode which is for example implemented in the x265 software encoder. It is less known and doesn’t make sense in most cases, but is very well usable.
If you take ffmpeg, you can run „ffmpeg […] -x265-params lossless=1 […]“ and will achieve exactly the same quality as in the input video. Of course you can’t achieve higher compression when transcoding from h.264 sources then. (See: https://trac.ffmpeg.org/wiki/Encode/H.265 )
The hardware encoders from Nvidia/AMD/Intel are a whole other thing. These are designed with streaming in mind and are generally not recomendable if quality matters. In serveral tests I conducted, it was easily possible to generate even h.264 compression via software with visual quality and filesize on par with above h.265 hardware encoders. For archival purposes there currently seems no alternative to x265 software encoding, which of course has significantly lower speeds (often far below real time), but produces better visual quality and at the same time smaller file size. I would not use above software for converting something like a movie library.