How to improve video encoding quality?

I’m testing nvenc on orin dev kit. The PSNR Y value seems never to exceed 35, and the output image looks visually darker than original image. How should I tune the nvv4l2h265enc encoder to reach at least 42 for PSNR Y? Thanks.

gst-launch-1.0 filesrc location=input.mp4 ! qtdemux ! queue ! h264parse ! nvv4l2decoder ! nvv4l2h265enc iframeinterval=100 control-rate=0 bitrate=1900000 preset-level=2 num-B-Frames=2 ! h265parse ! qtmux ! filesink location=265_1900.mp4 -e

x264 faster crf 25 (1850 kbps)
PSNR y:44.485357 u:49.588281 v:50.170043 average:45.659234 min:36.834651

nvv4l2h265enc 1900 kbps
PSNR y:34.279240 u:47.157348 v:47.334667 average:35.931825 min:5.363743

nvv4l2h265enc 5000 kbps
PSNR y:34.444062 u:48.692727 v:48.677873 average:36.123958 min:5.364043

Nvidia T4 nvenc h264 crf 26 (1840 kbps)
PSNR y:45.329482 u:48.686343 v:49.135742 average:46.228648 min:40.103392

Hi,
Please set to CBR and tune virtual buffer size. Can refer to this post:
Random blockiness in the picture RTSP server-client -Jetson TX2 - #5 by DaneLLL

Thanks. I tested CBR and vbv, but PSNR Y still does not exceed 35.

gst-launch-1.0 filesrc location=input.mp4 ! qtdemux ! queue ! h264parse ! nvv4l2decoder ! nvv4l2h265enc iframeinterval=100 control-rate=1 bitrate=1900000 vbv-size=200000 preset-level=2 num-B-Frames=2 ! h265parse ! qtmux ! filesink location=265_1900.mp4 -e

control-rate=1 bitrate=1900000 vbv-size=200000, 1485 kbps
PSNR y:34.119530 u:46.444102 v:46.717196 average:35.758890 min:5.363976

control-rate=1 bitrate=1900000 vbv-size=400000, 1628 kbps
PSNR y:34.182262 u:46.749887 v:46.973624 average:35.827523 min:5.364093

control-rate=1 bitrate=1900000 no vbv, 1727 kbps
PSNR y:34.233959 u:46.967576 v:47.152350 average:35.883019 min:5.364029

control-rate=0 bitrate=1900000 no vbv, 1729 kbps
PSNR y:34.279240 u:47.157348 v:47.334667 average:35.931825 min:5.363743

Actually VBR’s quality is better than CBR. No vbv is better than vbv. The color looks washed out (low brightness).

Hi,
The bitrate is set to 1.9Mbps which is not high. What is the resolution?

Resolution is 1080p. I tried 5 Mbps as well, and it’s only marginally better. Nvidia T4 GPU can reach PSNR Y 45.33 at 1.9 Mbps, while Orin is 34.28 at 1.9 Mbps and 34.44 at 5 Mbps.

control-rate=0 bitrate=5000000 no vbv
PSNR y:34.444062 u:48.692727 v:48.677873 average:36.123958 min:5.364043

Hi,
There’s difference in hardware between desktop GPUs and Jetson platforms. It is possible to see deviation. For 1080p, please try 10Mbps. And please try the case without encoding B frames.

Thanks, I’ll check 10 Mbps without B frame, but 10 Mbps does not fit my use case of low bandwidth and high quality video encoding. Is it the hardware issue or software config issue that the output image looks visually darker? Only the Y channel has the anomaly (washed out, low brightness, seems never to exceed 35) and U and V channels are fine.

Here are the results for 10 Mbps:

control-rate=0 bitrate=10000000 preset-level=2
PSNR y:34.330782 u:49.183111 v:49.188691 average:36.021271 min:5.363668

control-rate=0 bitrate=10000000 preset-level=2 num-B-Frames=2
PSNR y:34.489819 u:49.344146 v:49.243465 average:36.179477 min:5.363834

Hi,
We will try to use this input file: https://media.xiph.org/video/derf/y4m/park_joy_1080p50.y4m

And compare encoding stream of x265enc and nvv4l2h265enc in 10Mbps. See if we can reproduce it first and then check with our teams.

Hi Dane, I can’t reproduce the low brightness issue on park joy or a few sequences in Xiph.org :: Derf's Test Media Collection. I’ll try to encode my source videos with x265enc to compare with nvv4l2h265enc.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.