Hello, I would like to know if someone managed to build a C++ project that uses NvJpegEncoder and NvJpegDecoder classes or other Jetson Multimedia API functions with cmake.
I was trying to do the OpenCV’s Videowriter with nvjpeg and the LD_PRELOAD=/usr/lib/aarch64-linux-gnu/tegra/libnvjpeg.so trick worked for me but it breaks some functions like imdecoder or imwrite. I am still undecided how to implement it. As far as I know there is the gstreamer or the Multimedia API way but I didn’t find any successful story and any insights on this would be welcomed.
Thanks in advance.
Yes, that worked. However, I was wondering if that could be added on Cmake somehow without fiddling with the .bashrc file and potentially breaking something. If not, I was considering learning the Gstreamer API.
For a single use case I’d advise to just use a shell alias that wouldn’t mess with anything else than your application:
alias your_app='LD_PRELOAD=/usr/lib/aarch64-linux-gnu/tegra/libnvjpeg.so /absolute/path/to/your_app'
For a more generic case, may be you may try rt-link paths for cmake install, but I can’t help for this.
Please share if you succeed, this may be helpful.
Also be aware that using opencv for other backends using jpeg than NVIDIA may no longer work, as there is a discrepancy with jpeg struct with nvidia lib’s as compared to standard jpeg lib.
I tried using the Gstreamer API and passing the Mat pointer to
gst_buffer_new_wrapped_full(). However, it also returns JPEG mismatch error when I use
cv::videocapture function and
GstElement *nvjpeg = gst_element_factory_make ("nvjpegenc", "jpegencoding"); on the same file so I ended doing what you advised me.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.