nvImageCodec icon indicating copy to clipboard operation
nvImageCodec copied to clipboard

C++ API works wrong with decode dependencies although process of building from sources is full and successful

Open giapvn opened this issue 11 months ago • 9 comments

Version

v0.4.1

Describe the bug.

After I built successfully C++ API on Jetson AGX Orin (Jetpack 6.0) when I run the example by the command-line: ./example/nvimtrans/nvimtrans -i ../example/assets/images/tabby_tiger_cat.jpg -o /app/test.jpg -v 5 I have received the error message as below:

nvImageCodec version: 0.4.1
 - extension API version: 0.4.0
 - CUDA Runtime version: 12.2
Using GPU: Orin with Compute Capability 8.7
[INFO] [nvimgcodec] Registering extension nvimgcodec_builtin_parsers version:0.4.1
[INFO] [nvimgcodec] Framework is registering parser (id:bmp_parser codec:bmp)
[INFO] [nvimgcodec] Codec bmp not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:jpeg_parser codec:jpeg)
[INFO] [nvimgcodec] Codec jpeg not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:jpeg2k_parser codec:jpeg2k)
[INFO] [nvimgcodec] Codec jpeg2k not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:png_parser codec:png)
[INFO] [nvimgcodec] Codec png not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:pnm_parser codec:pnm)
[INFO] [nvimgcodec] Codec pnm not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:tiff_parser codec:tiff)
[INFO] [nvimgcodec] Codec tiff not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:webp_parser codec:webp)
[INFO] [nvimgcodec] Codec webp not yet registered, registering for first time
Loading /app/nvImageCodec/build/./example/nvimtrans/../example/assets/images/tabby_tiger_cat.jpg file
Error: Unsupported  file format
[INFO] [nvimgcodec] Unregistering extension nvimgcodec_builtin_parsers version:0.4.1
[INFO] [nvimgcodec] Framework is unregistering parser (id:bmp_parser codec:bmp)
[INFO] [nvimgcodec] Framework is unregistering parser (id:jpeg_parser codec:jpeg)
[INFO] [nvimgcodec] Framework is unregistering parser (id:jpeg2k_parser codec:jpeg2k)
[INFO] [nvimgcodec] Framework is unregistering parser (id:png_parser codec:png)
[INFO] [nvimgcodec] Framework is unregistering parser (id:pnm_parser codec:pnm)
[INFO] [nvimgcodec] Framework is unregistering parser (id:tiff_parser codec:tiff)
[INFO] [nvimgcodec] Framework is unregistering parser (id:webp_parser codec:webp)

While I checked extensions, it had fully all above dependencies. The following is a trace of my build and installation. Firstly, I built a docker image using Dockerfile below:

ARG BASE_IMAGE=nvcr.io/nvidia/deepstream:7.0-triton-multiarch
FROM ${BASE_IMAGE}

ENV DEBIAN_FRONTEND=noninteractive

ARG LIB_PREFIX=/usr/local/
ARG CMAKE_VERSION=3.24.3

ENV PATH="/usr/local/cuda-12.2/bin:${PATH}"
ENV LD_LIBRARY_PATH="${LIB_PREFIX}/lib/:/usr/lib/aarch64-linux-gnu/tegra/:${LD_LIBRARY_PATH}"

RUN rm /etc/apt/sources.list.d/cuda.list || true
RUN apt update && \
	apt install -y python3-clang python3-pip wget git && \
	apt install -y --no-install-recommends python3-pytest

WORKDIR /tmp 
RUN wget https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}.tar.gz && \
	tar xvf cmake-${CMAKE_VERSION}.tar.gz && \
	cd cmake-${CMAKE_VERSION} && \
	./bootstrap --parallel=4 && \
	make -j$(nproc) && make install && ldconfig && \
	cd .. && rm -f cmake-${CMAKE_VERSION}.tar.gz && rm -rf cmake-${CMAKE_VERSION}
RUN wget https://github.com/CVCUDA/CV-CUDA/releases/download/v0.13.0-beta/cvcuda-lib-0.13.0_beta-cuda12-aarch64-linux.tar.xz && \
	wget https://github.com/CVCUDA/CV-CUDA/releases/download/v0.13.0-beta/cvcuda-dev-0.13.0_beta-cuda12-aarch64-linux.tar.xz && \
	apt install -y ./cvcuda-lib-0.13.0_beta-cuda12-aarch64-linux.deb  ./cvcuda-dev-0.13.0_beta-cuda12-aarch64-linux.deb && \
	rm cvcuda-*
RUN wget https://github.com/NixOS/patchelf/releases/download/0.17.2/patchelf-0.17.2.tar.gz && \
	tar -xvzf patchelf-0.17.2.tar.gz && \
	cd patchelf-0.17.2 && \
	./configure --prefix=/usr/local/ --docdir=/usr/share/doc/patchelf-0.17.2 && \
	make -j$(nproc) && make install && ldconfig && \
	cd .. && rm -rf patchelf-0.17.2*
	
RUN python3 -m pip install sphinx==5.0.0 sphinx_rtd_theme breathe future setuptools wheel clang==14.0 flake8 && \
	python3 -m pip install libclang==14.0.1

ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES all
RUN apt --fix-broken install

WORKDIR /app

In the container based from the above image, I set up nvImageCodec C++ API as following:

git clone https://github.com/NVIDIA/nvImageCodec.git && \
cd nvImageCodec && \
git checkout v0.4.1 && git switch -c v0.4.1 && \
git submodule update --init --recursive --depth 1 && \
cd external/libtiff/build/ && \
cmake .. && make -j$(nproc) && make install

Because when I directly executed ./build_deps.sh to install libtiff that made error when I build the API:

/usr/bin/ld: /usr/local/lib/libtiff.a(tif_lzma.c.o): in function `LZMASetupEncode':
tif_lzma.c:(.text+0xb4): undefined reference to `lzma_end'
/usr/bin/ld: /usr/local/lib/libtiff.a(tif_lzma.c.o): in function `LZMASetupDecode':
tif_lzma.c:(.text+0x104): undefined reference to `lzma_end'
/usr/bin/ld: /usr/local/lib/libtiff.a(tif_lzma.c.o): in function `LZMACleanup':
tif_lzma.c:(.text+0x170): undefined reference to `lzma_end'
/usr/bin/ld: /usr/local/lib/libtiff.a(tif_lzma.c.o): in function `LZMAVSetField':
tif_lzma.c:(.text+0x1fc): undefined reference to `lzma_lzma_preset'
/usr/bin/ld: tif_lzma.c:(.text+0x238): undefined reference to `lzma_stream_encoder'
/usr/bin/ld: /usr/local/lib/libtiff.a(tif_lzma.c.o): in function `LZMAEncode':
tif_lzma.c:(.text+0x384): undefined reference to `lzma_code'
/usr/bin/ld: /usr/local/lib/libtiff.a(tif_lzma.c.o): in function `LZMAPostEncode':
tif_lzma.c:(.text+0x564): undefined reference to `lzma_code'
/usr/bin/ld: /usr/local/lib/libtiff.a(tif_lzma.c.o): in function `LZMAPreDecode':
tif_lzma.c:(.text+0x6e0): undefined reference to `lzma_stream_decoder'
/usr/bin/ld: /usr/local/lib/libtiff.a(tif_lzma.c.o): in function `LZMAPreEncode':
tif_lzma.c:(.text+0x864): undefined reference to `lzma_stream_encoder'
/usr/bin/ld: /usr/local/lib/libtiff.a(tif_lzma.c.o): in function `LZMADecode':
tif_lzma.c:(.text+0x9ec): undefined reference to `lzma_code'
/usr/bin/ld: tif_lzma.c:(.text+0xa04): undefined reference to `lzma_memusage'
/usr/bin/ld: tif_lzma.c:(.text+0xa14): undefined reference to `lzma_stream_decoder'
/usr/bin/ld: /usr/local/lib/libtiff.a(tif_lzma.c.o): in function `TIFFInitLZMA':
tif_lzma.c:(.text+0xd98): undefined reference to `lzma_lzma_preset'
collect2: error: ld returned 1 exit status
make[2]: *** [test/CMakeFiles/nvimgcodec_tests.dir/build.make:693: test/nvimgcodec_tests] Error 1
make[1]: *** [CMakeFiles/Makefile2:1002: test/CMakeFiles/nvimgcodec_tests.dir/all] Error 2
make: *** [Makefile:166: all] Error 2

This issue will be fixed if I build it from source in the repo and then comment line 39 in the build_deps.sh file.

cd ../../../ && ./external/build_deps.sh && \
mkdir build && cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Release && \
make -j$(nproc) && \
cmake --install . --config Release --prefix /opt/nvidia/nvimgcodec_cuda12

Please help me correct my processing if it is wrong, or help me debug this issue. Thanks all in advance.

Minimum reproducible example


Environment details


Relevant log output


Other/Misc.

No response

Check for duplicates

  • [x] I have searched the open bugs/issues and have found no duplicates for this bug report

giapvn avatar Feb 21 '25 10:02 giapvn

Thank you for reaching out with this issue.

From the log you provided, it looks like nvImageCodec registered only built-in parsers but does not load extensions for codecs. There is logic to automatically find the extensions folder based on the relative path to libnvimgcodec.so as follows: "go up one directory (or two levels when there is a lib64 directory) and add extensions to the path." For example:

/opt/nvidia/nvimgcodec_cuda<major_cuda_ver>/lib64/libnvimgcodec.so -> /opt/nvidia/nvimgcodec_cuda<major_cuda_ver>/extensions

or more for installation in Python site-packages directory

~/.local/lib/python3.8/site-packages/nvidia/nvimgcodec/libnvimgcodec.so -> ~/.local/lib/python3.8/site-packages/nvidia/nvimgcodec/extensions

You can also force it to look in specific folders by setting the path in the user API. There is a field const char* extension_modules_path in nvimgcodecInstanceCreateInfo_t where you can specify several paths separated by : on Linux or ; on Windows.

Additionally, you can use the environment variable NVIMGCODEC_EXTENSIONS_PATH to point to the extensions folder. I would suggest trying this first.

Please let us know if it helped

smatysik-nv avatar Feb 21 '25 10:02 smatysik-nv

You probably running example from build folder (as in log I see /app/nvImageCodec/build/./example/nvimtrans/../example/assets/images/tabby_tiger_cat.jpg) and it can cause problems with finding extension folder with all so extensions files like libnvjpeg_ext.so). After build please try install for example using cmake --install . --config Release --prefix /opt/nvidia/nvimgcodec_<major_cuda_ver> and run nvimtrans example from installation folder.

You should expect to see in logs messages about finding and loading particular extensions something like below (in this case it is from python installation)

[INFO] [nvimgcodec] Loading extension module: /home/smatysik/.local/lib/python3.11/site-packages/nvidia/nvimgcodec/extensions/libnvbmp_ext.so.0.5.0
[INFO] [nvimgcodec] Registering extension nvbmp_extension version:0.5.0
[INFO] [nvimgcodec] Framework is registering encoder (id:nvbmp_encoder codec:bmp)
[INFO] [nvimgcodec] Framework is registering decoder (id:nvbmp_decoder codec:bmp)
[INFO] [nvimgcodec] Loading extension module: /home/smatysik/.local/lib/python3.11/site-packages/nvidia/nvimgcodec/extensions/libnvpnm_ext.so.0.5.0
[INFO] [nvimgcodec] Registering extension nvpnm_extension version:0.5.0
[INFO] [nvimgcodec] Framework is registering encoder (id:nvpnm_encoder codec:pnm)
[INFO] [nvimgcodec] Loading extension module: /home/smatysik/.local/lib/python3.11/site-packages/nvidia/nvimgcodec/extensions/libjpeg_turbo_ext.so.0.5.0
[INFO] [nvimgcodec] Registering extension libjpeg_turbo_extension version:0.5.0
[INFO] [nvimgcodec] Framework is registering decoder (id:libjpeg_turbo_decoder codec:jpeg)
[INFO] [nvimgcodec] Loading extension module: /home/smatysik/.local/lib/python3.11/site-packages/nvidia/nvimgcodec/extensions/libnvjpeg2k_ext.so.0.5.0
[INFO] [nvimgcodec] Registering extension nvjpeg2k_extension version:0.5.0
[INFO] [nvimgcodec] Framework is registering encoder (id:nvjpeg2k_encoder codec:jpeg2k)
[INFO] [nvimgcodec] Framework is registering decoder (id:nvjpeg2k_decoder codec:jpeg2k)
[INFO] [nvimgcodec] Loading extension module: /home/smatysik/.local/lib/python3.11/site-packages/nvidia/nvimgcodec/extensions/libtiff_ext.so.0.5.0
[INFO] [nvimgcodec] Registering extension libtiff_extension version:0.5.0
[INFO] [nvimgcodec] Framework is registering decoder (id:libtiff_decoder codec:tiff)
[INFO] [nvimgcodec] Loading extension module: /home/smatysik/.local/lib/python3.11/site-packages/nvidia/nvimgcodec/extensions/libnvtiff_ext.so.0.5.0
[INFO] [nvimgcodec] Registering extension nvtiff_extension version:0.5.0
[INFO] [nvimgcodec] Framework is registering decoder (id:nvtiff_cuda_decoder codec:tiff)
[INFO] [nvimgcodec] Loading extension module: /home/smatysik/.local/lib/python3.11/site-packages/nvidia/nvimgcodec/extensions/libopencv_ext.so.0.5.0
[INFO] [nvimgcodec] Registering extension opencv_extension version:0.5.0
[INFO] [nvimgcodec] Framework is registering decoder (id:opencv_jpeg_decoder codec:jpeg)
[INFO] [nvimgcodec] Framework is registering decoder (id:opencv_jpeg2k_decoder codec:jpeg2k)
[INFO] [nvimgcodec] Framework is registering decoder (id:opencv_png_decoder codec:png)
[INFO] [nvimgcodec] Framework is registering decoder (id:opencv_bmp_decoder codec:bmp)
[INFO] [nvimgcodec] Framework is registering decoder (id:opencv_pnm_decoder codec:pnm)
[INFO] [nvimgcodec] Framework is registering decoder (id:opencv_tiff_decoder codec:tiff)
[INFO] [nvimgcodec] Framework is registering decoder (id:opencv_webp_decoder codec:webp)
[INFO] [nvimgcodec] Framework is registering encoder (id:opencv_jpeg_encoder codec:jpeg)
[INFO] [nvimgcodec] Framework is registering encoder (id:opencv_jpeg2k_encoder codec:jpeg2k)
[INFO] [nvimgcodec] Framework is registering encoder (id:opencv_png_encoder codec:png)
[INFO] [nvimgcodec] Framework is registering encoder (id:opencv_bmp_encoder codec:bmp)
[INFO] [nvimgcodec] Framework is registering encoder (id:opencv_pnm_encoder codec:pnm)
[INFO] [nvimgcodec] Framework is registering encoder (id:opencv_tiff_encoder codec:tiff)
[INFO] [nvimgcodec] Framework is registering encoder (id:opencv_webp_encoder codec:webp)
[INFO] [nvimgcodec] Loading extension module: /home/smatysik/.local/lib/python3.11/site-packages/nvidia/nvimgcodec/extensions/libnvjpeg_ext.so.0.5.0
[INFO] [nvimgcodec] Registering extension nvjpeg_extension version:0.5.0
[INFO] [nvimgcodec] Framework is registering encoder (id:nvjpeg_cuda_encoder codec:jpeg)
[INFO] [nvimgcodec] Framework is registering decoder (id:nvjpeg_cuda_decoder codec:jpeg)
[INFO] [nvimgcodec] Framework is registering decoder (id:nvjpeg_lossless_decoder codec:jpeg)

smatysik-nv avatar Feb 21 '25 10:02 smatysik-nv

@smatysik-nv

/opt/nvidia/nvimgcodec_cuda<major_cuda_ver>/lib64/libnvimgcodec.so -> /opt/nvidia/nvimgcodec_cuda<major_cuda_ver>/extensions

I have full decoders as you mentioned. This is inside my extensions/ folder:

root@8be1ad9369e7:/opt/nvidia/nvimgcodec_cuda12/extensions# ls -la
total 41924
drwxr-xr-x  2 root root     4096 Feb 21 04:47 .
drwxr-xr-x 11 root root     4096 Feb 21 04:47 ..
-rw-r--r--  1 root root   530952 Feb 21 04:40 libjpeg_turbo_ext.so.0.4.1
-rw-r--r--  1 root root    77216 Feb 21 04:40 libnvbmp_ext.so.0.4.1
-rw-r--r--  1 root root 12045248 Feb 21 04:42 libnvjpeg2k_ext.so.0.4.1
-rw-r--r--  1 root root 12160848 Feb 21 04:42 libnvjpeg_ext.so.0.4.1
-rw-r--r--  1 root root    30944 Feb 21 04:40 libnvpnm_ext.so.0.4.1
-rw-r--r--  1 root root 11996392 Feb 21 04:42 libnvtiff_ext.so.0.4.1
-rw-r--r--  1 root root  5797768 Feb 21 04:42 libopencv_ext.so.0.4.1
-rw-r--r--  1 root root   274304 Feb 21 04:40 libtiff_ext.so.0.4.1

giapvn avatar Feb 21 '25 10:02 giapvn

Additionally, you can use the environment variable NVIMGCODEC_EXTENSIONS_PATH to point to the extensions folder. I would suggest trying this first.

I have just tried to do this. It still did not operate right. It returned the same error message:

root@8be1ad9369e7:/opt/nvidia/nvimgcodec_cuda12# export NVIMGCODEC_EXTENSIONS_PATH=/opt/nvidia/nvimgcodec_cuda12/extensions/lib/
root@8be1ad9369e7:/opt/nvidia/nvimgcodec_cuda12# ./bin/nvimtrans -i /app/nvImageCodec/example/assets/images/tabby_tiger_cat.jpg -o /app/test.jpg -v 5
nvImageCodec version: 0.4.1
 - extension API version: 0.4.0
 - CUDA Runtime version: 12.2
Using GPU: Orin with Compute Capability 8.7
[INFO] [nvimgcodec] Registering extension nvimgcodec_builtin_parsers version:0.4.1
[INFO] [nvimgcodec] Framework is registering parser (id:bmp_parser codec:bmp)
[INFO] [nvimgcodec] Codec bmp not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:jpeg_parser codec:jpeg)
[INFO] [nvimgcodec] Codec jpeg not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:jpeg2k_parser codec:jpeg2k)
[INFO] [nvimgcodec] Codec jpeg2k not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:png_parser codec:png)
[INFO] [nvimgcodec] Codec png not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:pnm_parser codec:pnm)
[INFO] [nvimgcodec] Codec pnm not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:tiff_parser codec:tiff)
[INFO] [nvimgcodec] Codec tiff not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:webp_parser codec:webp)
[INFO] [nvimgcodec] Codec webp not yet registered, registering for first time
Loading /app/nvImageCodec/example/assets/images/tabby_tiger_cat.jpg file
Error: Unsupported  file format
[INFO] [nvimgcodec] Unregistering extension nvimgcodec_builtin_parsers version:0.4.1
[INFO] [nvimgcodec] Framework is unregistering parser (id:bmp_parser codec:bmp)
[INFO] [nvimgcodec] Framework is unregistering parser (id:jpeg_parser codec:jpeg)
[INFO] [nvimgcodec] Framework is unregistering parser (id:jpeg2k_parser codec:jpeg2k)
[INFO] [nvimgcodec] Framework is unregistering parser (id:png_parser codec:png)
[INFO] [nvimgcodec] Framework is unregistering parser (id:pnm_parser codec:pnm)
[INFO] [nvimgcodec] Framework is unregistering parser (id:tiff_parser codec:tiff)
[INFO] [nvimgcodec] Framework is unregistering parser (id:webp_parser codec:webp)

giapvn avatar Feb 21 '25 10:02 giapvn

Do you have so files in lib folder not directly in extensions? It should not matter but I would expect directly in extensions folder so /opt/nvidia/nvimgcodec_cuda12/extensions not in /opt/nvidia/nvimgcodec_cuda12/extensions/lib - you listed above that they are directly in extensions but you set the env variable under lib export NVIMGCODEC_EXTENSIONS_PATH=/opt/nvidia/nvimgcodec_cuda12/extensions/lib/ ?

Can you please try to run example from /opt/nvidia/nvimgcodec_cuda12/bin so for example:

/opt/nvidia/nvimgcodec_cuda12/bin$ LD_LIBRARY_PATH=../lib64:$LD_LIBRARY_PATH ./nvimtrans -i ../resources/bmp/cat-111793_640.bmp -o ~/test.jpg -v 5

if it does not help please run it with LD_DEBUG=libs and provide logs so we can see from what paths it tries to load libs

LD_DEBUG=libs LD_LIBRARY_PATH=../lib64:$LD_LIBRARY_PATH ./nvimtrans -i ../resources/bmp/cat-111793_640.bmp -o ~/test.jpg -v 5

Assuming you earlier installed it with cmake --install . --config Release --prefix /opt/nvidia/nvimgcodec_cuda12 from build folder.

smatysik-nv avatar Feb 21 '25 18:02 smatysik-nv

@smatysik-nv

but you set the env variable under lib export NVIMGCODEC_EXTENSIONS_PATH=/opt/nvidia/nvimgcodec_cuda12/extensions/lib/?

I exported it by /opt/nvidia/nvimgcodec_cuda12/extensions/

Can you please try to run example from /opt/nvidia/nvimgcodec_cuda12/bin so for example: /opt/nvidia/nvimgcodec_cuda12/bin$ LD_LIBRARY_PATH=../lib64:$LD_LIBRARY_PATH ./nvimtrans -i ../resources/bmp/cat-111793_640.bmp -o ~/test.jpg -v 5

I did it.

Assuming you earlier installed it with cmake --install . --config Release --prefix /opt/nvidia/nvimgcodec_cuda12 from build folder.

I did it too.

if it does not help please run it with LD_DEBUG=libs and provide logs so we can see from what paths it tries to load libs

The below file is all information logged on terminal screen. log_ld_debug_libs.txt Please help me check it together and point to me abnormal logs. Thanks.

giapvn avatar Feb 25 '25 03:02 giapvn

@giapvn It looks that now nvImageCodec is loading extensions properly as in log you shared we can see :

[INFO] [nvimgcodec] Loading extension module: /opt/nvidia/nvimgcodec_cuda12/extensions/libnvjpeg_ext.so.0.4.1
    247750:	
    247750:	calling init: /opt/nvidia/nvimgcodec_cuda12/extensions/libnvjpeg_ext.so.0.4.1

and later

[INFO] [nvimgcodec] Framework is registering decoder (id:nvjpeg_cuda_decoder codec:jpeg)
[INFO] [nvimgcodec] Framework is registering decoder (id:nvjpeg_lossless_decoder codec:jpeg)

I would suggest:

  • doublecheck if everything is ok with files you are trying to load - maybe try load them with opencv for example: python3.13 -c "import cv2; img=cv2.imread('padlock-406986_640_444.jpg'); cv2.imshow('Image', img);cv2.waitKey(0)"
  • try to install released versions and check if it works so we can more or less know if problem is general or with build - please see https://docs.nvidia.com/cuda/nvimagecodec/installation.html for more info
  • you can also try build debug version and collect logs - there should be more trace logs which hopefully can say us more and if not you still can debug it

smatysik-nv avatar Mar 04 '25 10:03 smatysik-nv

Hi @smatysik-nv I am coming back with your new version (0.5.0). It seems that some errors was be fixed but some are still standing there. The following is my structure tree of directory /opt/nvidia/nvimgcodec_cuda12: . |-- bin | |-- nvimtrans |-- etc | |-- ld.so.conf.d |-- extensions | |-- libjpeg_turbo_ext.so.0.5.0 | |-- libnvbmp_ext.so.0.5.0 | |-- libnvjpeg2k_ext.so.0.5.0 | |-- libnvjpeg_ext.so.0.5.0 | |-- libnvpnm_ext.so.0.5.0 | |-- libnvtiff_ext.so.0.5.0 | |-- libopencv_ext.so.0.5.0 | |-- libtiff_ext.so.0.5.0 |-- lib64 | |-- libjpeg_turbo_ext_static.a | |-- libnvbmp_ext_static.a | |-- libnvimgcodec.so -> libnvimgcodec.so.0 | |-- libnvimgcodec.so.0 -> libnvimgcodec.so.0.5.0 | |-- libnvimgcodec.so.0.5.0 | |-- libnvimgcodec_static.a | |-- libnvjpeg2k_ext_static.a | |-- libnvjpeg_ext_static.a | |-- libnvpnm_ext_static.a | |-- libnvtiff_ext_static.a | |-- libopencv_ext_static.a | |-- libtiff_ext_static.a |-- resources | |-- bmp | |-- jpeg | |-- jpeg2k | |-- jpegxr | |-- png | |-- pnm | |-- ref | |-- tiff | |-- webp

I ran the command-line LD_LIBRARY_PATH=../lib64:$LD_LIBRARY_PATH ./nvimtrans -i ../resources/<image_path> -o /app/test.jpg -v 5 It is successful with all images of folders ref, webp, and pnm but is wrong when executing with images of folder bmp, jpeg, jpeg2k, jpegxr. png, and tiff. The error message is as same as mentioned above.

root@242811ad5eba:/opt/nvidia/nvimgcodec_cuda12/bin# LD_LIBRARY_PATH=../lib64:$LD_LIBRARY_PATH ./nvimtrans -i ../resources/png
/cat-1245673_640.png -o /app/test.jpg -v 5
nvImageCodec version: 0.5.0
 - extension API version: 0.5.0
 - CUDA Runtime version: 12.6
Using GPU: Orin with Compute Capability 8.7
[INFO] [nvimgcodec] Registering extension nvimgcodec_builtin_parsers version:0.5.0
[INFO] [nvimgcodec] Framework is registering parser (id:bmp_parser codec:bmp)
[INFO] [nvimgcodec] Codec bmp not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:jpeg_parser codec:jpeg)
[INFO] [nvimgcodec] Codec jpeg not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:jpeg2k_parser codec:jpeg2k)
[INFO] [nvimgcodec] Codec jpeg2k not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:png_parser codec:png)
[INFO] [nvimgcodec] Codec png not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:pnm_parser codec:pnm)
[INFO] [nvimgcodec] Codec pnm not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:tiff_parser codec:tiff)
[INFO] [nvimgcodec] Codec tiff not yet registered, registering for first time
[INFO] [nvimgcodec] Framework is registering parser (id:webp_parser codec:webp)
[INFO] [nvimgcodec] Codec webp not yet registered, registering for first time
Loading /opt/nvidia/nvimgcodec_cuda12/bin/./../resources/png/cat-1245673_640.png file
Input image info: 
	 - width:0
	 - height:0
	 - components:0
	 - codec:
terminate called after throwing an instance of 'std::runtime_error'
  what():  nvImageCodec failure: '#2'
Aborted (core dumped)

giapvn avatar Apr 25 '25 09:04 giapvn

Hi @giapvn,

Could you please verify that the image you are testing with exists and can be decoded with another library? From your log, it looks like nvImageCodec couldn't parse that file. In the 0.5 release, we were missing a check in nvimtrans to verify if parsing was correct. This should be fixed with the just-released 0.6 (the source code should be published soon).

mkepa-nv avatar Aug 12 '25 10:08 mkepa-nv