Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Video Encoding > High Efficiency Video Coding (HEVC)

Reply
 
Thread Tools Search this Thread Display Modes
Old 11th January 2021, 18:29   #1  |  Link
easy2Bcheesy
Moderator
 
easy2Bcheesy's Avatar
 
Join Date: Feb 2002
Posts: 641
NvEnc Intra Frame QCP HEVC encoding

Hi everyone,

I saw that Adobe introduced Nvidia hardware decode for HEVC and h.264 in Adobe Premiere, so I thought I would see how effective it is on the timeline. Not too bad, but still laggy - presumably because any given frame I access will have to access more than the current frame to re-constitute it.

With that in mind, I used Handbrake x265 with keyint=1 to encode some 4K60 footage and was surprised at how fast it was on the Premiere timeline. Faster than ProRes, CineForm, anything.

With that in mind, I'd like to archive my 4K footage in this format, and I'd like to do it in a speedy fashion, hence NvEnc. I can't seem to make Handbrake encode intra-only, but the encoder definitely supports it. Can anyone recommend a tool that can do it, and how to do it? ffmpeg should be able to do it in theory, but I couldn't get a working command line. A GUI would make things a lot simpler.
easy2Bcheesy is offline   Reply With Quote
Old 11th January 2021, 21:29   #2  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 3,596
Quote:
Originally Posted by easy2Bcheesy View Post
Hi everyone,

I saw that Adobe introduced Nvidia hardware decode for HEVC and h.264 in Adobe Premiere, so I thought I would see how effective it is on the timeline. Not too bad, but still laggy - presumably because any given frame I access will have to access more than the current frame to re-constitute it.

With that in mind, I used Handbrake x265 with keyint=1 to encode some 4K60 footage and was surprised at how fast it was on the Premiere timeline. Faster than ProRes, CineForm, anything.

With that in mind, I'd like to archive my 4K footage in this format, and I'd like to do it in a speedy fashion, hence NvEnc. I can't seem to make Handbrake encode intra-only, but the encoder definitely supports it. Can anyone recommend a tool that can do it, and how to do it? ffmpeg should be able to do it in theory, but I couldn't get a working command line. A GUI would make things a lot simpler.
You said you used Handbake with keyint=1 in the prior paragraph. This is exactly what that does. Do you mean NvEnc? I can't imagine it doesn't have the ability to do so. And IDR-only encoding is a lot faster as well without interframe encoding. Bitrates are generally way higher as well.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 11th January 2021, 21:41   #3  |  Link
easy2Bcheesy
Moderator
 
easy2Bcheesy's Avatar
 
Join Date: Feb 2002
Posts: 641
Yes, keyint=1 is what I used to test the concept with x265 in Handbrake. Unfortunately, even on an 18-core Intel i9, my encoding speed in Handbrake is, er, 5fps.

Yes, the filesize is large, but it's still a fraction of the size of ProRes and CineForm and it's much faster on the timeline. I mean, it's really fast, faster than any intermediate I've ever used in Premiere.

I guess if intra-only is not an option (which seems odd), what would be the recommendation for NvEnc encoding that could produce similar speed on the Premiere Pro timeline? I'm guessing it would need to follow the similar principle of trading filesize for speed but I'm cool with that.
easy2Bcheesy is offline   Reply With Quote
Old 11th January 2021, 22:17   #4  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,534
I've noticed the same odd thing.
x265 (in ffmpeg) + g=1 causes speed to drop to single fps (where long GOP is way faster). Why is this the case?
x264 is very fast in I frame only mode. Why is x265 (3.3 version if I remember well) so slow?

Last edited by kolak; 11th January 2021 at 22:24.
kolak is online now   Reply With Quote
Old 12th January 2021, 15:17   #5  |  Link
excellentswordfight
Lost my old account :(
 
Join Date: Jul 2017
Posts: 172
Quote:
Originally Posted by kolak View Post
I've noticed the same odd thing.
x265 (in ffmpeg) + g=1 causes speed to drop to single fps (where long GOP is way faster). Why is this the case?
x264 is very fast in I frame only mode. Why is x265 (3.3 version if I remember well) so slow?
Did you check thread utilization? Maybe the multithreading is not optimized for that scenario, and its working on one frame at a time.

Quote:
Originally Posted by easy2Bcheesy View Post
Yes, agreed. It's brilliant. The question is how I can actually integrate this into workflow. To begin with, I'm looking for a quick transcode using NvEnc that will have a tiny GOP (I guess) to ensure fast scrubbing. But this could be the basis of a much faster workflow generally.

Something else I've discovered - with Nvidia at least, HEVC decode is a ton faster than h.264 - and that's comparing keyint=1, x264 vs x265. Interestingly the file sizes are basically the same with the same CRF factor.
Not sure what settings that are possible to set with ffmpeg, have you tried https://github.com/rigaya/NVEnc ?

Sounds like it should be possible with -strict-gop & --gop-len

edit. What bitrate are you roughly using for this scenario with 2160p60? 100Mbps? 4:2:0 or 4:2:2? 8bit or 10bit?

And I wondered what happened to Sonys pro HEVC codec, weren't they working on an XEVC format? I would assume that there would be an all intra profile of that.

Last edited by excellentswordfight; 12th January 2021 at 16:47.
excellentswordfight is offline   Reply With Quote
Old 12th January 2021, 19:51   #6  |  Link
easy2Bcheesy
Moderator
 
easy2Bcheesy's Avatar
 
Join Date: Feb 2002
Posts: 641
Quote:
Originally Posted by excellentswordfight View Post
Sounds like it should be possible with -strict-gop & --gop-len

edit. What bitrate are you roughly using for this scenario with 2160p60? 100Mbps? 4:2:0 or 4:2:2? 8bit or 10bit?

And I wondered what happened to Sonys pro HEVC codec, weren't they working on an XEVC format? I would assume that there would be an all intra profile of that.
To begin with, I'm using straight 8-bit 4:2:0 at 2160p60 with CQP 16.

The NvEncC command line is baffling to me but it looks like you can run those switches in StaxRip which does integrate NvEncC.

Files pop out that don't read particularly quickly on the Premiere timeline. The issue is the 'seek time' when accessing a new frame - it takes several seconds. With keyint=1 it's instant and that's what makes this better than any intermediate I've used. So I suspect the switches in StaxRip aren't working :/
easy2Bcheesy is offline   Reply With Quote
Old 11th January 2021, 22:19   #7  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,534
Quote:
Originally Posted by easy2Bcheesy View Post
...

With that in mind, I used Handbrake x265 with keyint=1 to encode some 4K60 footage and was surprised at how fast it was on the Premiere timeline. Faster than ProRes, CineForm, anything.
Was it 4:2:0 (or maybe 4:4:4). Most likely it was GPU decoded, so you felt it very responsive as frames are in GPU already.
No way h264 will be faster on CPU than Cineform or ProRes.
Remember that with Cineform you can drop resolution to 1/2 or 1/4 and then it needs to decode just HD or half HD in case of UHD (not only that- it even reads proportionally less data from the disk).

Last edited by kolak; 11th January 2021 at 22:24.
kolak is online now   Reply With Quote
Old 12th January 2021, 11:31   #8  |  Link
easy2Bcheesy
Moderator
 
easy2Bcheesy's Avatar
 
Join Date: Feb 2002
Posts: 641
Quote:
Originally Posted by kolak View Post
Was it 4:2:0 (or maybe 4:4:4). Most likely it was GPU decoded, so you felt it very responsive as frames are in GPU already.
No way h264 will be faster on CPU than Cineform or ProRes.
Remember that with Cineform you can drop resolution to 1/2 or 1/4 and then it needs to decode just HD or half HD in case of UHD (not only that- it even reads proportionally less data from the disk).
Yes, as mentioned in the OP, it's all done in hardware.

How do you drop the resolution in CineForm on the timeline while maintaining full resolution export?
easy2Bcheesy is offline   Reply With Quote
Old 12th January 2021, 17:55   #9  |  Link
kolak
Registered User
 
Join Date: Nov 2004
Location: Poland
Posts: 2,534
Quote:
Originally Posted by easy2Bcheesy View Post
Yes, as mentioned in the OP, it's all done in hardware.

How do you drop the resolution in CineForm on the timeline while maintaining full resolution export?

By changing preview resolution.


Take UHD file and play at full resolution. Check CPU load. Drop to 1/2 and 1/4 and watch then. For 1/4 CPU load is <5% on my machine (you can watch disk read as well). Even crapy old laptop will do it. This is a beauty of Cineform. ProRes official decoder also offers it, but no NLE (except FCP) has this functionality implemented. In case of ProRes disk read doesn't scale down.
Cineform partial resolution decoding works in Premiere, Resolve, Assimilate Scratch and possibly Vegas (at least I know about those).

Last edited by kolak; 12th January 2021 at 21:57.
kolak is online now   Reply With Quote
Old 12th January 2021, 00:31   #10  |  Link
Blue_MiSfit
Derek Prestegard IRL
 
Blue_MiSfit's Avatar
 
Join Date: Nov 2003
Location: Los Angeles
Posts: 5,812
Hardware decoded HEVC in Premiere and Resolve works fabulously well for me on an RTX 2070, including multiple layers of 4K HDR and trick play.
Blue_MiSfit is offline   Reply With Quote
Old 12th January 2021, 11:33   #11  |  Link
easy2Bcheesy
Moderator
 
easy2Bcheesy's Avatar
 
Join Date: Feb 2002
Posts: 641
Quote:
Originally Posted by Blue_MiSfit View Post
Hardware decoded HEVC in Premiere and Resolve works fabulously well for me on an RTX 2070, including multiple layers of 4K HDR and trick play.
Yes, agreed. It's brilliant. The question is how I can actually integrate this into workflow. To begin with, I'm looking for a quick transcode using NvEnc that will have a tiny GOP (I guess) to ensure fast scrubbing. But this could be the basis of a much faster workflow generally.

Something else I've discovered - with Nvidia at least, HEVC decode is a ton faster than h.264 - and that's comparing keyint=1, x264 vs x265. Interestingly the file sizes are basically the same with the same CRF factor.

Last edited by easy2Bcheesy; 12th January 2021 at 11:36.
easy2Bcheesy is offline   Reply With Quote
Old 13th January 2021, 00:02   #12  |  Link
benwaggoner
Moderator
 
Join Date: Jan 2006
Location: Portland, OR
Posts: 3,596
I did a bunch of testing with HEVC mezz stuff a few years back. A 1 second max GOP duration did pretty well. A half second would seek even better and still have a lot of savings relative to IDR-only. Of course, that's presuming a good random access decoder which traverses the reference hierarchy and only encodes the frames it needs to.

Reducing --ref and turning off --b-pyramid would probably improve worst-case decode time, at the loss of some compression efficiency.
__________________
Ben Waggoner
Principal Video Specialist, Amazon Prime Video

My Compression Book
benwaggoner is offline   Reply With Quote
Old 19th January 2021, 09:55   #13  |  Link
excellentswordfight
Lost my old account :(
 
Join Date: Jul 2017
Posts: 172
I find the topic of using HEVC as an rather highly compressed DI/mezz format quite intresting as most AVC HW-decoders doesnt support 4:2:2 10bit, making the AVC formats (xavc, AVC-I) rather slow compared to prores/cineform. And it looks like the new generation of HEVC decoders (Xe, Turing/Ampere) does support hw-decoding for hevc with higher bitdepth and chroma sampling.

I also see that there are intra profiles added to the HEVC-standard, anyone know if nvenc & x265 support those? Or are they "activated" automatically when doing i-frames only? And does anyone know if AMD (VCN) support hw-decode for these formats as well? And is any company is working on an standardized format based on 4:2:2 10bit HEVC (both intra only and 1s GOP)? As mentioned above, I thought Sony was working on it, but I havnt heard anything about it in quite some time.

edit.
Hmm it looks like Sony branded it as XAVC 2.0/XAVC-HS. Anyone got any more info/whitepaper/specification? Any mxf/pro implementation?

https://www.xavc-info.org/xavc/share...e_20200728.pdf

Last edited by excellentswordfight; 19th January 2021 at 13:44.
excellentswordfight is offline   Reply With Quote
Old 19th January 2021, 21:05   #14  |  Link
easy2Bcheesy
Moderator
 
easy2Bcheesy's Avatar
 
Join Date: Feb 2002
Posts: 641
So I've got all intra encoding working in OBS via NvEnc and it's pretty simple! Just use the 'Custom Output (ffmpeg)' option and, er, set keyframe interval to 1, per the attachment.

However, default encoding is CBR. Selecting the 'Standard' type encoding opens the door to CQP but the only option there is keyframes spaced by seconds. A one second keyframe interval is still very quick in Premiere, but not really what I want - ini tweaks to set it to 0.1666666 don't help either

So I guess the question I have is this: on the video encoding settings on the Custom Output (ffmpeg) type, can I specify CQP encoding? And is it possible to get full 10-bit 4:4:4? Mediainfo suggests my captures are 8-bit 4:2:0 which is fine for my needs, but going for broke on fidelity would be a nice option.
Attached Images
 
easy2Bcheesy is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 21:45.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.