Skip to content
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

nvmpi build fails in nvmpi_dec.c on release/6.0 #3

Open
ratsputin opened this issue Jul 11, 2023 · 5 comments
Open

nvmpi build fails in nvmpi_dec.c on release/6.0 #3

ratsputin opened this issue Jul 11, 2023 · 5 comments

Comments

@ratsputin
Copy link

libavcodec/nvmpi_dec.c: In function ‘nvmpi_init_decoder’:
libavcodec/nvmpi_dec.c:62:21: error: too few arguments to function ‘nvmpi_create_decoder’
   62 |  nvmpi_context->ctx=nvmpi_create_decoder(codectype,NV_PIX_YUV420);
      |                     ^~~~~~~~~~~~~~~~~~~~
In file included from libavcodec/nvmpi_dec.c:5:
/usr/local/include/nvmpi.h:80:12: note: declared here
   80 |  nvmpictx* nvmpi_create_decoder(nvCodingType codingType,nvPixFormat pixFormat, nvSize resized);
      |            ^~~~~~~~~~~~~~~~~~~~
make: *** [ffbuild/common.mak:81: libavcodec/nvmpi_dec.o] Error 1
@LinusCDE
Copy link
Owner

I think it compiled for me. But i had the issue of most of the encoders/decoders not properly registering. Seems ffmpeg changed how they get registered between 4.4 and 6.0 and I don't know how ffmpeg works and my attempts to migrating the registration failed somewhat.

This comment also explained a bit more i think: #1 (comment)

Rn I'm pretty busy irl and have no time and motivation to try to drive it forward. The release/6.0 branch is considered WIP as states in it's readme for now. Feel free to try to fix it though. That would be really great.

Otherwise try to build the 4.4 branch. Not sure if it works on the latest jetpack release, but chances are better than with release/6.0 currently.

@ratsputin
Copy link
Author

Thank you for the response. I've been working on getting 6.0 working on Jetpack to support Frigate. I was originally using nvmpi on 6.0 from Keylost's repo at https://github.com/Keylost/jetson-ffmpeg, and was building it successfully. I noticed there were significant code differences between that one and your implementation and was trying to get to the bottom of why. While Keylost's patch was forked from the original (https://github.com/jocover/jetson-ffmpeg), it wasn't obvious to me where yours came from--especially the 6.0 patches.

The two main reasons I was looking at yours was because there is a bug in both of the above implementations that prevents go2rtc from working and was hoping your nvmpi implementation fixed it. If you could shed some light on that, it would be helpful. The other is your integration of the nvv4l2dec patch into 6.0; it appears nobody else has done that.

In any case, I do have 6.0 built and working on a Jetson Orin NX in the following configuration:

--disable-debug --disable-libfdk-aac --disable-schannel --enable-avisynth --enable-cuda-llvm --enable-ffnvcodec --enable-fontconfig --enable-frei0r --enable-gmp --enable-gpl --enable-iconv --enable-libaom --enable-libaribb24 --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libjxl --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librist --enable-librubberband --enable-libshaderc --enable-libsoxr --enable-libsrt --enable-libsvtav1 --enable-libtheora --enable-libtwolame --enable-libuavs3d --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzvbi --enable-lv2 --enable-lzma --enable-mbedtls --enable-nvmpi --enable-sdl2 --enable-version3 --enable-vulkan --enable-zlib --extra-cflags=-DLIBTWOLAME_STATIC --extra-cxxflags= --extra-ldexeflags=-pie --extra-ldflags=-pthread --extra-libs='-ldl -lgomp' --extra-version=20220731 --pkg-config-flags=--static --pkg-config=pkg-config --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib

Let me tell you, getting all of those libraries into a single docker build was a long and painful process (60+ hours). I've not tested very many of them with actual video streams, but they all build successfully.

I certainly understand being busy; as I mentioned, if you could shed some light on where your nvmpi patch came from, that'd be helpful.

@LinusCDE
Copy link
Owner

Hi,

getting it to work here would be cool, but as said for me this is very low prio for me rn.

My patches are based on https://github.com/jocover/jetson-ffmpeg as well. I applied them semi-automatic and tried to adapt it to work on 6.0 due to the mentioned changes. For me it compiled but didn't show up when doing ffmpeg -help encoders afaik. Not sure what I did wrong there but I believe my thing did compile on the the branch.

The error seems to imply otherwise and not some dependency issue, so not sure what went wrong there. Maybe I changed some things in the (seperate afaik) libnvmpi lib which the ffmpeg-jetson ffmpeg patches call.

@LinusCDE
Copy link
Owner

Just looked and this seems to be the only change I did to the jetson-ffmpeg nvmpi lib (I think that was proposed in some issue related to not building on newer versions):

diff --git a/nvmpi.pc.in b/nvmpi.pc.in
index 417ffa2..c7e4e7a 100644
--- a/nvmpi.pc.in
+++ b/nvmpi.pc.in
@@ -8,5 +8,5 @@ Description: @PROJECT_DESCRIPTION@
 Version: @PROJECT_VERSION@

 Requires:
-Libs: -L${libdir} -lnvmpi
+Libs: -L${libdir} -lnvmpi -L/usr/lib/aarch64-linux-gnu/tegra -lnvbufsurface
 Cflags: -I${includedir}

@ratsputin
Copy link
Author

Ah, okay. Thank you for looking at that. Clearly, Keylost made a ton of changes for 6.0.

I guess I need to go back and take your 6.0 nvv4l2 patches and merge them with Keylost's nvmpi patches to get a fully functional ffmpeg. Right now, the only hardware acceleration that appears to work fully is Vulkan, but it doesn't perform as well as nvmpi. I did see some benchmarks that said that nvv4l2 does slightly better than nvmpi, hence my efforts there (as well as working around the nvmpi bug).

Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants