Search code examples
ffmpegh.264obsnvenc

How to set H264 NVENC encoding parameters to output high-quality video stream?


  • I use NVENC (nvEncodeAPI) interface hardware encoding H264, and then RTMP to stream out, when using ffplay to pull the stream to watch, I found that the picture is obviously distorted: the green lines become sharper? the text color becomes lighter and blurred, it is not improved even if I increase the video bitrate to 3Mbps(720P). I also know that H264 encoding is lossy, and some information will be discarded.
  • Then I try to adjust the NV_ENC_CONFIG_H264_VUI_PARAMETERS parameter: when set color-space to "pc, bt709", there are some minor improvements. Maybe the color-space setting has more potential for improvement? For NVENC encoding, is there a higher video clarity setting scheme? I don't know how much space for technical improvement is here? enter image description here based on the code: https://github.com/obsproject/obs-studio/blob/master/plugins/obs-ffmpeg/obs-ffmpeg-nvenc.c

Solution

    • .\ffmpeg.exe -probesize 32768 -i "{rtmp_url}" -acodec copy -vcodec copy -f flv {local_file_path}
    • Save the live stream as a local file and then play, the picture effect is in line with expectations, which means that the picture may be blurred due to the player's own factors.