Which is the max compression settings for hevc_nvenc lossless (NVIDIA H.265 HEVC LOSSLESS)? Can anubody write ffmpeg comand for that?
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 30 of 31
Thread
-
-
Lossless compression is the opposite of "max. compression"; efficient compression is achieved by allowing a certain degree of loss.
The compression ratio of lossless algorithms can't be tuned for a great range of speed vs. efficiency; if there are at all any options to change the behaviour, variation in results will be small.
Depending on the video material (complexity and similarity), lossless compression ratios may typically be between 2:1 and 5:1 in relation to uncompressed YUV; lossy HEVC compression can achieve about 1000:1.Last edited by LigH.de; 16th Jan 2018 at 01:30.
-
Enabling SAP can emprove lossless compression. Do you know ffmpeg command for that?
-
-
This paper proposed an improved SAP (Sample-based Angular Prediction) algorithm based on adaptive directional prediction (ADSAP).
-
May be you are right. But I still can't find any information about using nvenc hevc through ffmpeg. Can you suggest anything to read about that?
Last edited by qo4on; 16th Jan 2018 at 13:46.
-
The best information (the latest & usually most accurate) is from ffmpeg itself.
Open a command prompt and enter the following command:Code:ffmpeg -h encoder=hevc_nvenc
To save the information to a file (which is what I prefer), enter this command instead:Code:ffmpeg -h encoder=hevc_nvenc >ffmpeg-help-hevc_nvenc.txt
Here is the result. The way I read this, the only option for lossless NVENC that makes any difference is choosing between -preset lossless and -preset losslesshp.Code:Encoder hevc_nvenc [NVIDIA NVENC hevc encoder]: General capabilities: delay Threading capabilities: none Supported pixel formats: yuv420p nv12 p010le yuv444p yuv444p16le bgr0 rgb0 hevc_nvenc AVOptions: -preset <int> E..V.... Set the encoding preset (from 0 to 11) (default medium) default E..V.... slow E..V.... hq 2 passes medium E..V.... hq 1 pass fast E..V.... hp 1 pass hp E..V.... hq E..V.... bd E..V.... ll E..V.... low latency llhq E..V.... low latency hq llhp E..V.... low latency hp lossless E..V.... lossless losslesshp E..V.... lossless hp -profile <int> E..V.... Set the encoding profile (from 0 to 4) (default main) main E..V.... main10 E..V.... rext E..V.... -level <int> E..V.... Set the encoding level restriction (from 0 to 186) (default auto) auto E..V.... 1 E..V.... 1.0 E..V.... 2 E..V.... 2.0 E..V.... 2.1 E..V.... 3 E..V.... 3.0 E..V.... 3.1 E..V.... 4 E..V.... 4.0 E..V.... 4.1 E..V.... 5 E..V.... 5.0 E..V.... 5.1 E..V.... 5.2 E..V.... 6 E..V.... 6.0 E..V.... 6.1 E..V.... 6.2 E..V.... -tier <int> E..V.... Set the encoding tier (from 0 to 1) (default main) main E..V.... high E..V.... -rc <int> E..V.... Override the preset rate-control (from -1 to INT_MAX) (default -1) constqp E..V.... Constant QP mode vbr E..V.... Variable bitrate mode cbr E..V.... Constant bitrate mode vbr_minqp E..V.... Variable bitrate mode with MinQP ll_2pass_quality E..V.... Multi-pass optimized for image quality (only for low-latency presets) ll_2pass_size E..V.... Multi-pass optimized for constant frame size (only for low-latency presets) vbr_2pass E..V.... Multi-pass variable bitrate mode -rc-lookahead <int> E..V.... Number of frames to look ahead for rate-control (from -1 to INT_MAX) (default -1) -surfaces <int> E..V.... Number of concurrent surfaces (from 0 to INT_MAX) (default 32) -cbr <boolean> E..V.... Use cbr encoding mode (default false) -2pass <boolean> E..V.... Use 2pass encoding mode (default auto) -gpu <int> E..V.... Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on. (from -2 to INT_MAX) (default any) any E..V.... Pick the first device available list E..V.... List the available devices -delay <int> E..V.... Delay frame output by the given amount of frames (from 0 to INT_MAX) (default INT_MAX) -no-scenecut <boolean> E..V.... When lookahead is enabled, set this to 1 to disable adaptive I-frame insertion at scene cuts (default false) -forced-idr <boolean> E..V.... If forcing keyframes, force them as IDR frames. (default auto) -spatial_aq <boolean> E..V.... set to 1 to enable Spatial AQ (default false) -temporal_aq <boolean> E..V.... set to 1 to enable Temporal AQ (default false) -zerolatency <boolean> E..V.... Set 1 to indicate zero latency operation (no reordering delay) (default false) -nonref_p <boolean> E..V.... Set this to 1 to enable automatic insertion of non-reference P-frames (default false) -strict_gop <boolean> E..V.... Set 1 to minimize GOP-to-GOP rate fluctuations (default false) -aq-strength <int> E..V.... When Spatial AQ is enabled, this field is used to specify AQ strength. AQ strength scale is from 1 (low) - 15 (aggressive) (from 1 to 15) (default 8) -cq <int> E..V.... Set target quality level (0 to 51, 0 means automatic) for constant quality mode in VBR rate control (from 0 to 51) (default 0)
Last edited by raffriff42; 16th Jan 2018 at 22:57.
-
Thank you! But I've already read this list. It doesn't answer to a lot of questions: what is the difference between lossless and lossleshp, which other options I can use with lossless, how to setup rec709 full and limited range?
-
According to a thread in the phoronix forum (especially post 30), "hp" means "high performance", which must mean that speed is preferred over quality, so it's probably using only simple prediction algorithms.
Rather looking from the opposite angle: If it is supposed to limit the quantization or elements only used in lossy compression (DCT/IT, CU/CTU, partitions), then it will probably not affect lossless compression. But going into details would require some insight in HEVC as a whole.
Wikipedia about Nvidia NVEnc mentions a "HP444" profile, means, there are specifications about complexity limits to ensure fast decoding on supporting hardware.
If a technique is valid for several encoders, it is often exposed as general ffmpeg option instead of encoder-specific parameters. Check the ffmpeg "full help" too. -
-
Generic ffmpeg options valid for more or less all encoders:
Code:AVCodecContext AVOptions: ... -color_primaries <int> ED.V.... color primaries (from 1 to INT_MAX) (default unknown) bt709 ED.V.... BT.709 unknown ED.V.... Unspecified bt470m ED.V.... BT.470 M bt470bg ED.V.... BT.470 BG smpte170m ED.V.... SMPTE 170 M smpte240m ED.V.... SMPTE 240 M film ED.V.... Film bt2020 ED.V.... BT.2020 smpte428 ED.V.... SMPTE 428-1 smpte428_1 ED.V.... SMPTE 428-1 smpte431 ED.V.... SMPTE 431-2 smpte432 ED.V.... SMPTE 422-1 jedec-p22 ED.V.... JEDEC P22 unspecified ED.V.... Unspecified -color_trc <int> ED.V.... color transfer characteristics (from 1 to INT_MAX) (default unknown) bt709 ED.V.... BT.709 unknown ED.V.... Unspecified gamma22 ED.V.... BT.470 M gamma28 ED.V.... BT.470 BG smpte170m ED.V.... SMPTE 170 M smpte240m ED.V.... SMPTE 240 M linear ED.V.... Linear log100 ED.V.... Log log316 ED.V.... Log square root iec61966-2-4 ED.V.... IEC 61966-2-4 bt1361e ED.V.... BT.1361 iec61966-2-1 ED.V.... IEC 61966-2-1 bt2020-10 ED.V.... BT.2020 - 10 bit bt2020-12 ED.V.... BT.2020 - 12 bit smpte2084 ED.V.... SMPTE 2084 smpte428 ED.V.... SMPTE 428-1 arib-std-b67 ED.V.... ARIB STD-B67 unspecified ED.V.... Unspecified log ED.V.... Log log_sqrt ED.V.... Log square root iec61966_2_4 ED.V.... IEC 61966-2-4 bt1361 ED.V.... BT.1361 iec61966_2_1 ED.V.... IEC 61966-2-1 bt2020_10bit ED.V.... BT.2020 - 10 bit bt2020_12bit ED.V.... BT.2020 - 12 bit smpte428_1 ED.V.... SMPTE 428-1 -colorspace <int> ED.V.... color space (from 0 to INT_MAX) (default unknown) rgb ED.V.... RGB bt709 ED.V.... BT.709 unknown ED.V.... Unspecified fcc ED.V.... FCC bt470bg ED.V.... BT.470 BG smpte170m ED.V.... SMPTE 170 M smpte240m ED.V.... SMPTE 240 M ycgco ED.V.... YCGCO bt2020nc ED.V.... BT.2020 NCL bt2020c ED.V.... BT.2020 CL smpte2085 ED.V.... SMPTE 2085 unspecified ED.V.... Unspecified ycocg ED.V.... YCGCO bt2020_ncl ED.V.... BT.2020 NCL bt2020_cl ED.V.... BT.2020 CL -color_range <int> ED.V.... color range (from 0 to INT_MAX) (default unknown) unknown ED.V.... Unspecified tv ED.V.... MPEG (219*2^(n-8)) pc ED.V.... JPEG (2^n-1) unspecified ED.V.... Unspecified mpeg ED.V.... MPEG (219*2^(n-8)) jpeg ED.V.... JPEG (2^n-1)
-
If only someone, somewhere, had done an NVENC Lossless test, using ffmpeg, and posted the results:
https://forum.videohelp.com/threads/382367-X265-Lossless-not-really-lossless-and-I-can-prove-it -
Thank you.
But I still can't get a real lossless. I took an 8-bit clip 4:2:0 mp4, encoded it to h.265:
ffmpeg -vsync 0 -r 60 -c:v h264_cuvid -i "in.mp4" -c:v hevc_nvenc -preset lossless "out.mp4"
In PP I see the same colors, but there is an outline at the bright colored edges in layer difference mode. Any idea why does this happen?
[Attachment 44433 - Click to enlarge]Last edited by qo4on; 18th Jan 2018 at 11:38.
-
It seems to me similar to some subsampling conversion difference. Don't know why, but when tested 4:4:4 and 4:2:2 or 4:2:0 I get similar difference. So probably some internal conversion, probably made by colorspace conversion. Problem can be also software playback settings you are using. But most probably your source is BT601 and Hevc is most probably BT709
Edit: Can you post text form of mediainfo for both files?
BernixLast edited by Bernix; 20th Jan 2018 at 05:33. Reason: Edit
-
It's a premiere decoding bug. It doesn't support lossless hevc profile decoding. It's lossless in other programs/decoders
But AVC lossless is decoding correctly in newer PP versions -
-
Yes , but only for that sample test .
But this is not definitive proof that something else is lossless with the same workflow without additional testing . For example, what if the workflow (not necessarily the encoder) clipped "superbright" data? But your test source didn't include that data to test in the first place. -
I also found out that all tested lossless files were strongly different by compression. The same clip was encoded to various lossless formats:
libx264 - 150 KB (very good, but encoding was 100 times longer than nvenc)
libx265 - 757 KB
nvenc_h264 - 2 472 KB
nvenc_hevc lossless - 634 KB
nvenc_hevc lossless_hp - 634 KB
Is there anything I can tweak to improve compression in nvenc lossless? -
Seems to me be weird lossless 265 is bigger, probably something is wrong, or it is not already tuned (doubt). libx265 is also bigger than any NVENC Hevc lossless, something must be wrong definitely.
Bernix -
You can tweak the settings for libx265 and libx264 to make it more compressed /less compressed, or encode faster/slower (--preset ultrafast will still be slower than NVEnc), or decode faster/slower by using the presets and/or adjusting GOP length . Often the issue is decoding speed, if it's meant to be used in an editor (--tune fastdecode --keyint 1). Very sluggish for usage, almost unusable it "feels" so slow. Often you want I-frame or at least short GOPs and faster decoding (so it's faster to edit on the timeline) . Or if it's meant for storage , then you can tweak it for higher compression
For NVEnc, not sure I haven't used it much for lossless but you might be able to influence the compression slightly by adjusting GOP length . In NVEncC, there is a --preset quality mode separate from the --lossless switch , but I haven't tested it. It's slightly different than ffmpeg NVEnc -
You should also test longer duration input files. A large part of these codecs compression ability (especially over traditional I-frame lossless codecs) is based on temporal compression. That is not tested here much based on those filesizes . For example if your max GOP length was say 60 , you would not see any effect of increasing the value if your test video was already shorter than 60 frames. I don't know what the defaults are for NVEnc HEVC, but in ffmpeg -g is the switch for max GOP length -
O.k. so x265 is less effective in lossless, why then they do not use x264 for lossless when it is faster and more effective?
Bernix -
A ratio 1:5 for lossless x264 vs. x265 is rather confusing than impressive. This may be a failure as well as heavily depending on the material, yet. Until confirmed by someone else with the same original material or a completely different one.
-
I found on internet This:
[Attachment 44480 - Click to enlarge]
It seems to me done properly, but I can only guess. Check speed and size... In this case (lossless) encoding, x265 can benefit from x264 codec as special case
I know it is hardly possible.
BernixLast edited by Bernix; 23rd Jan 2018 at 12:26. Reason: picture instead of text
-
Some quick tests for x264/x264/ff nvenc h264
1920x1080 4:2:0 2582frames , outdoor scene, low motion, several crossfades, high quality src
default settings for lossless
x264 2.06GB
x265 2.11GB
ffmpeg nvenc h264 2.62GB
x264 lossless doesn't use b-frames, but x265 does. NVEnc hevc doesn't use b-frames at all for lossy or lossless mode, but I can't test it here on this GPU -
Hi poisondeathray,
time is also very important, and I belive x264 was 5 times faster. Just guess.
Edit: so conclusion?
a) using b-frames in lossless mode is bad idea (b-frames are smallest) but it doesn't results in smallest filesize. And time is several times longer then x264 lossless (same output results pixel by pixel)
b) using b-frames are worth of bigger filesize and slower speed (for some to me unknown reason)
I know x265 is more aggressive during encoding, so probably harder to achieve lossless, probably using only P-frames will not help (for almost sure)
So not use x265 don't know how other codecs of h265 format, probably all h265 codecs for lossless compression.
But on I-frames only lossless compression x265 must win in smallest file from them all. And lossless I-frames only is also best for editing.
Correct me if I'm wrong. I will correct this post with pleasure.
BernixLast edited by Bernix; 24th Jan 2018 at 02:48. Reason: Edit
Similar Threads
-
Zond 265, the first professional HEVC / H.265 Analyzer from SolveigMM
By DmitryV in forum Latest Video NewsReplies: 5Last Post: 13th May 2024, 09:02 -
HEVC x.265 conversion ?
By joecass in forum Newbie / General discussionsReplies: 13Last Post: 31st Dec 2016, 07:09 -
how to download hevc or h.265?
By maria kalatha in forum Video Streaming DownloadingReplies: 1Last Post: 3rd Oct 2013, 16:59 -
theX.265 (a free HEVC) codec. Have you ever tried that HEVC encoder? (HELP)
By Stears555 in forum Video ConversionReplies: 41Last Post: 16th Sep 2013, 11:15 -
H.265 HEVC Is Approved
By FulciLives in forum Latest Video NewsReplies: 1Last Post: 26th Jan 2013, 04:14