Search code examples
ffmpegvideo-encodinghevcnvenc

Grey squared artifacts after HEVC 10-bit encoding using FFmpeg's NVENC encoder


Recently I purchased a brand new GPU - AORUS GeForce GTX 1080 Ti. I found out that it supports HEVC 10-bit encoding, so I wanted to give that a try. Unfortunately, after encoding I noticed some artifacts, which occur in dark scenes and last one frame of the video. You can see them on these screenshots:

Screenshot of a still from an animated scene. There is an artifact near the bottom and slightly to the left. It is square shaped with white squiggles.

Screenshot of a still from another animated scene. The artifact looks the same as in the previous image but is in a different location, higher up and closer to the center.

I was wondering if someone could help me figure out what might be the cause of these artifacts and how I can get rid of them.

Here is the MI of the source video:

ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 2 h 2 min
Bit rate mode                            : Variable
Bit rate                                 : 29.5 Mb/s
Maximum bit rate                         : 37.0 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.593
Stream size                              : 25.2 GiB (66%)
Language                                 : English
Default                                  : Yes
Forced                                   : No

And here is the MI of the encoded video:

ID                                       : 1
Format                                   : HEVC
Format/Info                              : High Efficiency Video Coding
Format profile                           : Main 10@L4@Main
Codec ID                                 : V_MPEGH/ISO/HEVC
Duration                                 : 2 h 2 min
Bit rate                                 : 3 689 kb/s
Width                                    : 1 920 pixels
Height                                   : 800 pixels
Display aspect ratio                     : 2.40:1
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Standard                                 : Component
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 10 bits
Bits/(Pixel*Frame)                       : 0.100
Stream size                              : 3.15 GiB (95%)
Default                                  : Yes
Forced                                   : No
Color range                              : Limited

The command I'm using for encoding:

ffmpeg -hide_banner -i "<input_file>" -map 0:v:0 -map_chapters -1 -map_metadata -1 -vf "crop=1920:800:0:140" -vcodec hevc_nvenc -pix_fmt p010le -preset hq -profile:v main10 -rc constqp -global_quality 21 -rc-lookahead 32 -g 240 -f matroska Video_CQP21_LAF32_GOP240.mkv

Solution

  • Problem solved. It turns out that there is a problem with H.265 encoding done by NVENC on GPUs, based on GP102 core. If you overclock it past a certain point, these artifacts appear after encoding. Decreasing the core clock of the GPU should solve the problem.