Hi,
I am taking the source from GitHub - JetsonHacksNano/CSI-Camera: Simple example of using a CSI-Camera (like the Raspberry Pi Version 2 camera) with the NVIDIA Jetson Developer Kit and changing “videoconvert” to “nvjpegenc”. I can compiling successfully with this command:
g++ simple_camera.cpp -o simple_camera `pkg-config --cflags --libs opencv`
However, I get this result:
JPEG parameter struct mismatch: library thinks size is 584, caller expects 728
I found this thread: https://devtalk.nvidia.com/default/topic/1057461/jetson-nano/jetson-nano-gstreamer-opencv-using-nvjpegenc-to-encode-frames-from-opencv-as-appsrc/post/5362215/#5362215
which leads me to believe I am not linking against the nvjpeg lib, but I am unsure how to do that. I’ve tried the following with no luck:
g++ simple_camera.cpp -o simple_camera `pkg-config --cflags --libs opencv` -L/usr/src/nvidia/tegra_multimedia_api/include/libjpeg-8b -lnvjpeg
The result for the above command is:
/user/bin/ld: cannot find -lnvjpeg
Any ideas?
The path for link looks wrong. Try instead
-L/usr/lib/aarch64-linux-gnu/tegra
Thanks! That gets rid of any of the linking problem, but I am still getting the JPEG parameter struct mismatch error.
this is my build command:
g++ simple_camera.cpp -o simple_camera `pkg-config --cflags --libs opencv` -L/usr/lib/aarch64-linux-gnu/tegra -lnvjpeg
and this is the result:
Using pipeline:
nvarguscamerasrc ! video/x-raw(memory:NVMM), width=(int)3264, height=(int)2464, framerate=(fraction)12/1, format=(string)NV12 ! nvvidconv ! video/x-raw, width=(int)3264, height=(int)2464 ! nvjpegenc ! appsink
JPEG parameter struct mismatch: library thinks size is 584, caller expects 728
DaneLLL
November 22, 2019, 3:37am
4
Hi,
For running with OpenCV, we suggest use jpegenc instead of nvjpegenc. OpenCV links to libjpeg.so in many places and it is difficult to replace it with libnvjpeg.so.
Ah, that make sense. How difficult are we talking? We are looking at the nvjpegenc due to performance reasons
DaneLLL
November 25, 2019, 4:37am
6
Hi,
We are not not sure about the effort. Have not seen users successfully done this and shared the result( also possible some users have done it but do not share ).
jocover
November 26, 2019, 2:01am
7
please add this include directory
-I/usr/src/nvidia/tegra_multimedia_api/include/libjpeg-8b
example gcc -o jpeg_enc jpeg_enc.c -I/usr/src/nvidia/tegra_multimedia_api/include/libjpeg-8b -L/usr/lib/aarch64-linux-gnu/tegra -lnvjpeg -w -Wall
1 Like