Compression ratio of H264 versus H265

deboopi

New Member
I had some problems recording a video in H265.
That got solved, it had something to do with my work laptop.
Now I'm trying this out on my private laptop and I can even see HEVC in the simple output options.
First of all I was puzzled by the fact that when I select HEVC in simple output setting this is not reflected in advanced output recording options.
I've tried some things out and I can definitively see that the output results are different given the selections I do in Simple and in Advanced settings.
I can't find a lot about this in the faq, so If somebody can explain this?

Then I wanted to know what the best options are when recording a video I play in my browser (24 or 25 fps, that's not the problem) for the compression ratio.
I included an excel sheet with the data for different recordings from a 32 minute video an also for a 2:30 video.
In the shorter video it seems OK to me that when I select HEVC in simple and advanced mode gives me the best results.

But for the larger video I have the best result when I select Software H264 in simple settings and HEVC in advanced setting.
The video codec is H264 according to VLC but I do not know in what format the recording is effectively done.
So what's the reason.

And the video share the same subject but the best results for the shorter video are about 10MB and while the greater video is less than 16 times longer the best recording file its size is a factor 23. I do know I cannot compare only duration of the video to compare filesize but since the videos are lookalikes I think 23 versus <16 is out of sync.
Anybody with an explanation?

Since I have a Nvidia GPU the hardware H264 and H265 are from Nvidia.
Is this someon e in this forum can answer or should I et in cntact with Nvidia support?
kind regards
 

Attachments

  • codecs-advanced.png
    codecs-advanced.png
    72 KB · Views: 181
  • codecs-simple.png
    codecs-simple.png
    112.1 KB · Views: 179

koala

Active Member
If you compare x264 (h.264 codec), nvenc h.264 and nvenc hevc, they are all able to produce the same quality, up to "cannot see any difference between video and original". The actual quality you produce depends on the quality parameter. In advanced mode, this parameter is directly visible, it's crf for x264 and if you use CQP rate control with the nvenc encoders, it's CQ. Higher value means more detail removed, so the lower the crf/cq value, the higher the quality. 0 is lossless, 50 is bloody mess. Unfortunately, the scaling isn't the same between the encoders. crf 23 isn't the same quality as cq 23 for nvenc h.264 and even different to cq 23 for nvenc hevc. Better quality comes with higher file sizes: the lower the values, the higher the quality and the file size.

What's different between the encoders is the file size. If you managed to work out all the crf/cq values to create videos with the same visual quality, you will see the nvenc hevc video is smallest, the x264 video is larger, and the nvenc h.264 video is largest. It is said that if you have 2 videos with the same visual quality, one encoded with hevc and the other with h.264, the hevc encoded video is 40-50% smaller than the h.264 encoded video. This isn't relevant for recording (actually, you have infinite disk space), but relevant for streaming, because you can get more detail within the same bandwidth with hevc, and bandwidth is limited.

Simple mode is nothing more than a wrapper around advanced mode with a textual description of the crf/cq value. The "high quality, medium file size" is translated internally to a crf or cq value of about 23, as far as I remember. It's not exactly hardcoded, the value is made slightly higher the higher the resolution of the video is. The different cq/crf scaling is what makes the visual quality of videos created in simple mode slightly different across encoders.
 

deboopi

New Member
Hello,
Thanks for the explanation of what the differences between simple and advanced mode are.
But when I do another selection in simple mode this is still not followed by a change in advanced.
When I read
high quality, medium file size" is translated internally to a crf or cq value of about 2
and switch to advanced mode I still see CBR (constant bit rate?). so what about that?
 

koala

Active Member
The GUIs are not connected. If you want in advanced mode the same value that are used in simple mode, you need to do some recording in simple mode, look in the log file what settings were used, then enter these values in advanced mode.
 

deboopi

New Member
Hello,
In my first post I also attached an excel sheet but I had overlooked the fact that this sheet isn't visible.
So now I attach a jpeg file with a screendump of the excel sheet.
In the first two boxes I might have made the mistake to set for instance cettings in simple mode and then switch to advanced mode before recording. I wasn't aware of the fact that the settings from the selected mode are taken.
In the bottom box I made sure I did no t repeat this mistake.
Ans now you can see that a 32 minute video compresses better in h264 than in HEVC.
So what's the reason for this?
Even with possible misakes this did not happen with 2:30 minute video.
 

Attachments

  • overview recording results.jpg
    overview recording results.jpg
    782.1 KB · Views: 135

koala

Active Member
If you want to compare file sizes, you need to make sure all compared videos have the same visual quality. This is what I told in my first post. The 32 minute h.264 video is probably much smaller, because it was recorded with less quality than the same hevc encoded video.

It's difficult to judge visual quality with the human eye. To make valid comparisons, you need to make sure you're recording exactly the same raw material, and you need a machine generated measurement for judging how different an encoded video is to the corresponding raw source. Visual comparison with your eyes is not accurate enough.

Computing the psnr is a measure for encoding quality, but the state of the art method seems the vmaf method, because it takes human perception into account. You can use ffmpeg to compute and determine these values. Don't use OBS for creating videos to compare. Use ffmpeg.exe with the same encoder settings, so you can automate creating test sequences.
 

deboopi

New Member
Hello,
I finally got your point.
I did some sample recordings with HEVC and various CQP setting and I found the correct balance for quality and file size.
Thanks for all the help.
 
Top