audio icon indicating copy to clipboard operation
audio copied to clipboard

NVENC encoder video quality issue

Open JerryZhang19 opened this issue 7 months ago • 0 comments

🐛 Describe the bug

Using hardware accelerated video encoding(NVENC) will result in low quality, blocky video. Setting ffmpeg encoder option to 'slow' or 'lossless' does not help

Here is a configuration that is expected to produce a high quality video:

self.writer.add_video_stream(frame_rate= 60.0, height=1080, width=3648, format='yuv444p' , encoder="h264_nvenc", encoder_option= {"preset":"slow", "profile":"high444p"}, encoder_format='yuv444p' , hw_accel="cuda")

However, the generated video is very low quality and its size is very small


In the tutorial, https://pytorch.org/audio/main/tutorials/nvenc_tutorial.html

It was menteioned that higher resolution videos will have artifacts and tuning encoder_options may help. What would be the correct way to tune the encoder_option if "preset"="lossless" won't help

Versions

4090d, driver 12.2 pytorch 2.6.0, CUDA 12.4.127 ffmpeg 6.1.2 compiled with nv-codec-headers 11.1.5.3

JerryZhang19 avatar Mar 26 '25 08:03 JerryZhang19