jocover / jetson-ffmpeg

ffmpeg support on jetson nano
Other
624 stars 200 forks source link

nvmpi not enabled in ffmpeg when using --enable-shared #106

Open G4GUO opened 2 years ago

G4GUO commented 2 years ago

I am trying to use hardware decoding with https://github.com/robagar/h264decoder It seems as is if this library requires avcodec to be built as a shared object. If I try to build ffmpeg with --enable-nvmpi --enable-shared, the version of ffmpeg I get does not have the nvmpi codecs included, and I get a message telling me there is a clash between the two options. This only seems to apply to libavcodec.so all the other libraries build fine as shared. If I build it as static there is no problem but it is not what I need. jetson-ffmpeg builds both static and shared libraries so it should be possible. I have got a bit stuck on this, so suggestions would be welcomed

eusoubrasileiro commented 2 years ago

I just did it. You need to export to the LD_LIBRARY_PATH where you installed the library.

For example, if you installed using ./configure ... --prefix=/usr/local

LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH
G4GUO commented 2 years ago

I just did it. You need to export to the LD_LIBRARY_PATH where you installed the library.

For example, if you installed using ./configure ... --prefix=/usr/local

LD_LIBRARY_PATH=/usr/local/lib
export LD_LIBRARY_PATH

Do you need to set the library path when you are building https://github.com/robagar/h264decoder ? or when you are building ffmpeg? I get the incompatibility warning when I build ffmpeg as shared.

eusoubrasileiro commented 2 years ago

@G4GUO I am not sure what you are trying to do? Or if you are confused about where to open issues. This is a issue for a ffmpeg project targeting jetson nano nvidia. From the link you mention that's something for raspberry pi. I am not getting what you are trying to do...

G4GUO commented 2 years ago

I am trying to build libavcodec.so with nvmpi support.

I didn't want to open an issue here, but as this is not an NVIDIA supported project where else could I ask for help?

The issue seems to be the combination of using --enable-nvmpi --enable-shared when building the patched version of ffmpeg.

It builds ok but when I try to use it I get a message saying --enable-nvmpi --enable-shared are incompatible options and when I list the codecs the nvidia hardware ones are missing.

(The linked project is simply a Python callable h.264 decoder based on libavcodec, it works fine on my nano/XavierNX hardware but of course doesn't support NVIDIA hw decoding at present)

eusoubrasileiro commented 2 years ago

hum... TLDR you are missing something on your build of this ffmpeg. you are not making sudo make install or exporting the built libraries.

G4GUO commented 2 years ago

It does build a new shared version but when I run the ffmpeg it creates I get told the option of --enable-nvmpi and --enable-shared are inconsistent. All the required input .so files exist. I suspect something in the make/cmake process is not right. I was hoping someone else had seen this and knew of a quick fix. Thanks for taking the time to look at it.

eusoubrasileiro commented 2 years ago

If you read calmly what I wrote and research about it you will find the answer to your problem. As I said your are not (installing properly...) exporting the built libraries. Linux doesn't know where they are .... Unfortunately I don't have time to walk you through.

G4GUO commented 2 years ago

To the best of my knowledge I am exporting the built libraries correctly, on my first attempt I wasn't, but I corrected that weeks ago. Let's simply agree to disagree. I need to re-exam the patch file, as while it works perfectly with a static build, it does not seem to work correctly with a shared build of ffmpeg.