Ffmpeg video encode add artefacts on very dark scenes (near to black)


I have many videos ripped from blu ray (h.264).

I don’t have sufficient space to store all videos and I like to re-encode all video with hevc codec (h.265) and keep similar quality (not exactly the some) but with a good compromise.

I have tried this command:

ffmpeg.exe -hide_banner -hwaccel nvdec -hwaccel_device 0 -vsync 0 -i "title00.mkv" -c:s copy -an -c copy -c:v:0 hevc_nvenc -profile:v main10 -pix_fmt p010le -rc-lookahead 32 -spatial-aq 1 -aq-strength 12 -cq 30 -qmin 1 -qmax 30 -b:v:0 10M -maxrate:v:0 20M -gpu 0 title00_nvidia_no_audio.mkv

the quality is excellent and is very close to original, but on the very dark scenes (near to black) there are visible artefacts.

To solve the problem I have tried this changes without get any improvement:

-cq 25 -qmin 1 -qmax 25

-spatial-aq 1 -aq-strength 4
For some strange reason seem that if I decrease the -cq from 30 to 25 the artefacts are more visible.

I general I’am satasfied about the quality result but before start the encoding I like to understand if there is a way to reduce/remove these artefacts on very dark scenes.

Any tips ?

Thanks !