HEVC Video Codec Issues

A151 wrote on 6/27/2019, 3:03 AM

Hi,

I just tried HEVC for the 1st time today. I took a low resolution stock clip I had downloaded from the web, and rendered it twice, once in MP4 h.264 and again in HEVC. I was expecting the HEVC to bea round 1/2 the size.

However, both clips came out at 122mb!

I've checked the video properties and both clips are 1080P @ 12kbs and 25fps.

Is there an issue with the HEVC encoder as I always understood it delivered video at around 1/2 the size for the same settings as h2.64?

Comments

j-v wrote on 6/27/2019, 4:10 AM

Try half the bitrate as the default and compare it with the former HEVC and the AVC results. I'm curious what your findings are.

met vriendelijke groet
Marten

Camera : Pan X900, GoPro Hero7 Hero Black, DJI Osmo Pocket, Samsung Galaxy A8
Desktop :MB Gigabyte Z390M, W11 home version 24H2, i7 9700 4.7Ghz,16 DDR4 GB RAM, Gef. GTX 1660 Ti with driver
566.14 Studiodriver and Intel HD graphics 630 with driver 31.0.101.2130
Laptop  :Asus ROG Str G712L, W11 home version 23H2, CPU i7-10875H, 16 GB RAM, NVIDIA GeForce RTX 2070 with Studiodriver 576.02 and Intel UHD Graphics 630 with driver 31.0.101.2130
Vegas software: VP 10 to 22 and VMS(pl) 10,12 to 17.
TV      :LG 4K 55EG960V

My slogan is: BE OR BECOME A STEM CELL DONOR!!! (because it saved my life in 2016)

 

Former user wrote on 6/27/2019, 4:55 AM

Theres a hevc clip in the above, HO and ffmpeg quality comparison tables, ~ same size and data rate as h264.

Former user wrote on 6/27/2019, 7:08 AM

Two things determine file size, length of program and bitrate. If the fixed bitrate was the same in both tests, then the file size will be around the same.

j-v wrote on 6/27/2019, 7:42 AM

Yess and therefore I suggested half of the bitrate of the default template to try and compare to the other renders.
I render 4K sources to FHD HEVC with less than a quarter of that default and have never seen any pixelation or lesser picture quality.
Result for me is faster render with Magix HEV NVenc and more than a quarter less filesize.👍

met vriendelijke groet
Marten

Camera : Pan X900, GoPro Hero7 Hero Black, DJI Osmo Pocket, Samsung Galaxy A8
Desktop :MB Gigabyte Z390M, W11 home version 24H2, i7 9700 4.7Ghz,16 DDR4 GB RAM, Gef. GTX 1660 Ti with driver
566.14 Studiodriver and Intel HD graphics 630 with driver 31.0.101.2130
Laptop  :Asus ROG Str G712L, W11 home version 23H2, CPU i7-10875H, 16 GB RAM, NVIDIA GeForce RTX 2070 with Studiodriver 576.02 and Intel UHD Graphics 630 with driver 31.0.101.2130
Vegas software: VP 10 to 22 and VMS(pl) 10,12 to 17.
TV      :LG 4K 55EG960V

My slogan is: BE OR BECOME A STEM CELL DONOR!!! (because it saved my life in 2016)

 

Former user wrote on 6/27/2019, 8:42 AM

I've added a 2nd. Nvenc Hevc test, a little over half the file size and data rate of the 1st. Hevc test.

Musicvid wrote on 6/27/2019, 9:45 AM

 I took a low resolution stock clip.
I've checked the video properties and both clips are 1080P @ 12kbs and 25fps.

Your source bitrate is suboptimal. Is it a still? There has to be something to encode to see the difference. These encoders will not "add" bits when they're not necessary because they use interframe compression technology, not intraframe.

Start with 40-60 Mbps original video and the encoder differences will be seen right away, I promise.

Former user wrote on 6/27/2019, 11:24 AM

I also did another test using only ffmpeg (different source to above) with ffmpeg using Nvidia Nvenc hardware encoding, i.e. .mp4 source to .mp4 output files.

Using ffmpeg's quality PSNR and SSIM test capability I compared one h264 and one hevc output file to the source file.

The quality of the output hevc file only matched the quality of the h264 output file when the file sizes and data rates of both output files were near identical.

The source was 27s duration, 306 mb size and 95,112 kbps

 

Output files and ffmpeg command lines.

H264 ….. ffmpeg -y -benchmark -hwaccel cuvid -c:v h264_cuvid -i Source.mp4 -rc constqp -qp 21 -c:v h264_nvenc -b:a 192000 f-H264.mp4

H264 file size 345 mb … 107,034 kbps data rate

 

HEVC …. ffmpeg -y -benchmark -hwaccel cuvid -c:v h264_cuvid -i Source.mp4 -rc constqp -qp 20 -c:v hevc_nvenc -b:a 192000 f-Hevc.mp4

H265 file size 343 mb … 106,563 kbps data rate

 

Changing HEVC "-qp 20" to 21 gives better quality than H264 output but slightly bigger file and data rate.

Former user wrote on 6/27/2019, 2:17 PM

 

Matching the size/data rate (approximately) gives a quality benefit.

I matched the files size/data rates closely.


Quality .. Higher is better for PSNR and SSIM ...

H264 ... Data rate 1,676 kbps  Size 6.01 mb
H264 ... SSIM 0.775364 (6.485211)   PSNR 27.352312

HEVC ... Data rate 1,689 kbps  Size 6.05 mb
HEVC ... SSIM 0.834664 (7.816319)   PSNR 29.224370

Source file Data rate 95,112 kbps  Size 306 mb.

 

Matching the quality (approximately) gives a size and data saving ...

I matched the files quality closely.

Quality .. Higher is better for PSNR and SSIM ...

H264 ... Data rate 3,464 kbps       Size 11.7 mb
H264 ... SSIM 0.842653 (8.031420)   PSNR 29.877943

HEVC ... Data rate 1,973 kbps       Size 6.96 mb
HEVC ... SSIM 0.846229 (8.131255)   PSNR 29.698707

Source file Data rate 95,112 kbps  Size 306 mb.

A151 wrote on 6/27/2019, 2:28 PM

Thanks for the comments.

I wonder if it has something to do with the original video not being HD in size.

I recoded a HD video clip after this again without altering the settings and the results were as expected 14.8mb vs 8.3mb.

 

Former user wrote on 6/27/2019, 2:48 PM

A151 all my clips are 4K UHD 25fps.

There is a good size saving for relatively low data rates, not for the higher data rates that I tested originally.

See update to my previous post.

The ratio of space saving is close with both our tests … mine 11.7 div 6.96 = 1.68

Yours 14.8 div 8.3 = 1.78.

j-v wrote on 6/27/2019, 3:05 PM

I wonder if it has something to do with the original video not being HD in size.

Not at all.
File size depends on the bitrate and that bitrate can be constant or variable.
Variable is needed for parts of not to much movements and/or small details that are very different.
AVC is a modern and good encoder that depends less size than the old encoders mpeg2, dv avi a.s.o.
Hevc is the newest encoder that needs for the same pictures less ( most half) of the bitrate than AVC.
So you must figure out the needed bitrate if you encode to HEVC. The defaults in Vegas Pro are very high chosen to be certain no problem will arise and it is no problem when you have and spend enough room for those files. In my case with my FHD output I can go lower than a quarter of the bitrates of the default templates.

met vriendelijke groet
Marten

Camera : Pan X900, GoPro Hero7 Hero Black, DJI Osmo Pocket, Samsung Galaxy A8
Desktop :MB Gigabyte Z390M, W11 home version 24H2, i7 9700 4.7Ghz,16 DDR4 GB RAM, Gef. GTX 1660 Ti with driver
566.14 Studiodriver and Intel HD graphics 630 with driver 31.0.101.2130
Laptop  :Asus ROG Str G712L, W11 home version 23H2, CPU i7-10875H, 16 GB RAM, NVIDIA GeForce RTX 2070 with Studiodriver 576.02 and Intel UHD Graphics 630 with driver 31.0.101.2130
Vegas software: VP 10 to 22 and VMS(pl) 10,12 to 17.
TV      :LG 4K 55EG960V

My slogan is: BE OR BECOME A STEM CELL DONOR!!! (because it saved my life in 2016)

 

Former user wrote on 6/27/2019, 6:34 PM

FWIW testing at several increasing file sizes, I found the benefit of Hevc vs H264 for saving disc space was diminishing (for equal quality) as file size/data rate increased.

All a small bit approximate 🤪

I took 3 sample file sizes ...

The percentage file size saving was ...

At file size of 105 mb, Data rate 32,503 kbps ...15%

At file size of 116 mb, Data rate 36,093 kbps.. 5%

At file size of 232 mb Data rate 72,000 kbps ... none

Obviously at much lower file sizes as mentioned in previous post there is a more substantial file size saving.

A151 wrote on 6/28/2019, 2:31 AM

I wonder if it has something to do with the original video not being HD in size.

Not at all.
File size depends on the bitrate and that bitrate can be constant or variable.
Variable is needed for parts of not to much movements and/or small details that are very different.
AVC is a modern and good encoder that depends less size than the old encoders mpeg2, dv avi a.s.o.
Hevc is the newest encoder that needs for the same pictures less ( most half) of the bitrate than AVC.
So you must figure out the needed bitrate if you encode to HEVC. The defaults in Vegas Pro are very high chosen to be certain no problem will arise and it is no problem when you have and spend enough room for those files. In my case with my FHD output I can go lower than a quarter of the bitrates of the default templates.


I'm aware it depends on the bit rates. However, the 1st clip was low resolution 640 x 320 I think. It was the 1st clip I could find. I pulled it in and rendered it out without touching the settings apart from h.264 > HEVC. Both clips rendered out at exactly at 122mb (suggesting as said above, the same bit rate).

The 2nd clip was 1080P. I followed the same process. I pulled it in then rendered out without changing any render settings. The h264 render was 14.8mb, the HEVC render was 8.3mb.

I know HEVC was designed for HD / 4K use so wonder if Vegas sets it up different by default for non HD ie for HD / 4K it 1/2's the bit rate and for lower than HD resolution just leaves it at default (presumably because the developers don't expect you to be using HEVC for SD clips).

j-v wrote on 6/28/2019, 3:47 AM

Sorry, but I don't and cannot know what the developpers presumable think.

met vriendelijke groet
Marten

Camera : Pan X900, GoPro Hero7 Hero Black, DJI Osmo Pocket, Samsung Galaxy A8
Desktop :MB Gigabyte Z390M, W11 home version 24H2, i7 9700 4.7Ghz,16 DDR4 GB RAM, Gef. GTX 1660 Ti with driver
566.14 Studiodriver and Intel HD graphics 630 with driver 31.0.101.2130
Laptop  :Asus ROG Str G712L, W11 home version 23H2, CPU i7-10875H, 16 GB RAM, NVIDIA GeForce RTX 2070 with Studiodriver 576.02 and Intel UHD Graphics 630 with driver 31.0.101.2130
Vegas software: VP 10 to 22 and VMS(pl) 10,12 to 17.
TV      :LG 4K 55EG960V

My slogan is: BE OR BECOME A STEM CELL DONOR!!! (because it saved my life in 2016)

 

Former user wrote on 6/28/2019, 9:20 AM

@A151 I'm not exactly certain if this what you’re bringing up. If rendering out SD in hevc, say 720 x 576, 25fps, I noticed a long time ago ( I mentioned it way back ) that no matter what you increase the render template data rate to it will only give a max output of about ~ 7,389 kbps.

1) Maybe this is a pragmatic approach by Magix, that they believe SD doesn’t need it higher using hevc.

2) They simply overlooked it in a hurry to get it implemented with other higher resolutions.

3) That the Nvidia software/hardware doesn’t support higher data rates for SD HW hevc and avc encode.

Realistically perhaps SD doesn’t need a higher data rate?

If you use Magix non HW hevc encoding (Mainconcept Hevc) you can render SD at a higher data rate.

 

The above also applies to SD HW encoding for non hevc avc, and to go beyond the < 8000 kbps data rate just don’t use HW encoding.

 

I tested an SD clip for hevc file size saving at a data rate of ~ 3000 kbps yet no benefit. When I matched the quality of the avc and hevc clips there was no space saving.

Musicvid wrote on 6/28/2019, 2:10 PM


I'm aware it depends on the bit rates. However, the 1st clip was low resolution 640 x 320 I think. It was the 1st clip I could find. I pulled it in and rendered it out without touching the settings apart from h.264 > HEVC. Both clips rendered out at exactly at 122mb (suggesting as said above, the same bit rate).

Yes! That is exactly what is expected!

Your source bitrate is already hopelessly inadequate. You cannot make a silk purse from a pig's ear.

No need to belabor this, we understand. Nothing can be added nor can it be compressed any more Not even a little bit! HEVC does have some issues, but what you imagine isn't one of them.

PLEASE post back when you have some 4k 40-100 Megabits per Second video to work with and test. HEVC was not designed to be very effective on SD source, or even HD.