-
Notifications
You must be signed in to change notification settings - Fork 205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrating from nvbuf_utils to NvUtils. #125
base: master
Are you sure you want to change the base?
Conversation
It's not backwards compatible. I will keep the branch separate for Jetpack 5.x only. |
I discovered some performance issue on jetpack 5.1. devices(MAXN jetson_clocks):
Command:
sample_3840x2160.hevc:
sample_4k.h264:
sample_720.h264:
|
Could you try adding setMaxPerfMode ret=ctx->dec->setMaxPerfMode(1);
TEST_ERROR(ret < 0, "Error in setting decoder maximum performance mode", ret); Right after lines in your code ret=ctx->dec->setCapturePlaneFormat(format.fmt.pix_mp.pixelformat,format.fmt.pix_mp.width,format.fmt.pix_mp.height);
TEST_ERROR(ret < 0, "Error in setting decoder capture plane format", ret); ContextI am using AGX Orin. Setting performance mode brings decoding roughly to GStreamer level. dpkg-query --show nvidia-l4t-core
nvidia-l4t-core 34.1.1-20220516211757 apt-cache show nvidia-jetpack
Package: nvidia-jetpack
Version: 5.0.1-b118 TestGStreamerinput=~/Downloads/iphone6s_4k.mov
gst-launch-1.0 filesrc location=$input ! qtdemux ! h264parse ! nvv4l2decoder enable-max-performance=1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 -v
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 542, dropped: 0, current: 119,99, average: 119,32 your fork./ffmpeg -y -benchmark -c:v h264_nvmpi -i ~/Downloads/iphone6s_4k.mov -f null -
frame= 549 fps= 78 q=-0.0 Lsize=N/A time=00:00:18.55 bitrate=N/A speed=2.65x your fork + change mentioned by me./ffmpeg$ ./ffmpeg -y -benchmark -c:v h264_nvmpi -i ~/Downloads/iphone6s_4k.mov -f null -
frame= 551 fps=111 q=-0.0 Lsize=N/A time=00:00:18.55 bitrate=N/A speed=3.75x |
Here is also some inspection what GStreamer I did it for encoder, but decoder ends up in same function call. |
Great. The fps has significantly improved, but there is still a considerable gap compared to gstreamer in AGX Xavier.
|
After flashing AGX Jetpack 5.1 L4T 35.2.1 (on AGX Orin 32 GB) cat /etc/nv_tegra_release
# R35 (release), REVISION: 2.1, GCID: 32413640, BOARD: t186ref, EABI: aarch64, DATE: Tue Jan 24 23:38:33 UTC 2023 apt-cache show nvidia-l4t-core
Package: nvidia-l4t-core
Version: 35.2.1-20230124153320 I can confirm performance loss in H.264 decoding ./ffmpeg -y -benchmark -c:v h264_nvmpi -i ~/Downloads/iphone6s_4k.mov -f null -
frame= 551 fps= 39 q=-0.0 Lsize=N/A time=00:00:18.55 bitrate=N/A speed=1.32x Citing my result with 34.1.1 (jetpack 5.0.1) ./ffmpeg -y -benchmark -c:v h264_nvmpi -i ~/Downloads/iphone6s_4k.mov -f null -
frame= 551 fps=111 q=-0.0 Lsize=N/A time=00:00:18.55 bitrate=N/A speed=3.75x So dropped from 111 to 39 fps (both with max-perf-enable) |
U can try my repo |
Awesome!./ffmpeg -y -benchmark -c:v h264_nvmpi -i ~/Downloads/iphone6s_4k.mov -f null -
# ...
frame= 551 fps=115 q=-0.0 Lsize=N/A time=00:00:18.55 bitrate=N/A speed=3.88x Quick test confirms performance restored on AGX Orin
I haven't checked correctness of decoded video
I guess it's more about
But it looks like you pinpointed the performance loss cause. |
I'm glad to hear that the decoder performance restored on AGX Orin as well :) Please note: in order to use the variant from my repository, you need to build ffmpeg with a patch from my repository. |
jetson-ffmpeg to ffmpeg version 6.0 Upgrade motion to version 4.5 Replace jetson-ffmpeg by @Keylost repository. Altough, @douo and @bmegli have a good too look at. Here jocover/jetson-ffmpeg#125 references.
This PR migrates the decoder to NvUtils. Is there another PR which also migrates the encoder? I get an error during cmake trying to find nvbuf_utils in the encoder. |
Refactor the code to migrate from nvbuf_utils to NvUtils, and it also includes fixes for issues #120 #123 and #115 . The changes have been tested in Jetpack 5.1.