According to documentation offered by NVIDIA regarding nvjpegdec, we can show an image calling the following command:
gst-launch-1.0 filesrc location=<filename.jpg> ! nvjpegdec ! imagefreeze ! xvimagesink -e
Also, the same command will work if replacing nvjpegdec for the generic jpegdec.
What is the problem? The problem is that if I have a PNG file, I need to replace the decoder and use pngdec. This is not convenient, so because of that there exist decodebin, that will choose the correct decoder based on image type. In my computer, decodebin works as expected (choose jpegdec for jpeg or pngdec for png). In my jetson nano I can use pngdec, jpegdec and nvjpegdec, but if I try to use decodebin as a generic replacement, it will fail.
$ startx /usr/bin/gst-launch-1.0 -vvv filesrc location=/home/ubuntu/resources/1920x1080/red.jpg ! decodebin ! imagefreeze ! xvimagesink
X.Org X Server 1.19.6
Release Date: 2017-12-20
X Protocol Version 11, Revision 0
Build Operating System: Linux 4.4.0-168-generic aarch64 Ubuntu
Current Operating System: Linux jetson-nano 4.9.140-tegra #1 SMP PREEMPT Wed Apr 8 18:10:49 PDT 2020 aarch64
Kernel command line: tegraid=21.1.2.0.0 ddr_die=4096M@2048M section=512M memtype=0 vpr_resize usb_port_owner_info=0 lane_owner_info=0 emc_max_dvfs=0 touch_id=0@63 video=tegrafb no_console_suspend=1 console=ttyS0,115200n8 debug_uartport=lsport,0 earlyprintk=uart8250-32bit,0x70006000 maxcpus=4 usbcore.old_scheme_first=1 lp0_vec=0x1000@0xff780000 core_edp_mv=1075 core_edp_ma=4000 tegra_fbmem=0x800000@0x92cb4000 is_hdmi_initialised=1 root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 root=/dev/mmcblk0p1 rw rootwait rootfstype=ext4 console=ttyS0,115200n8 console=tty0 fbcon=map:0 net.ifnames=0 quiet
Build Date: 14 November 2019 06:20:13PM
xorg-server 2:1.19.6-1ubuntu4.4 (For technical support please see http://www.ubuntu.com/support)
Current version of pixman: 0.34.0
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.0.log", Time: Fri May 29 21:52:04 2020
(==) Using config file: "/etc/X11/xorg.conf"
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind.GstPad:src: caps = image/jpeg, width=(int)1920, height=(int)1080, sof-marker=(int)2
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstNvJpegDec:nvjpegdec0.GstPad:sink: caps = image/jpeg, width=(int)1920, height=(int)1080, sof-marker=(int)2
/GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstNvJpegDec:nvjpegdec0.GstPad:src: caps = video/x-raw(memory:NVMM), format=(string)I420, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, chroma-site=(string)mpeg2, colorimetry=(string)1:4:0:0, framerate=(fraction)0/1
ERROR: from element /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind: Internal data stream error.
Additional debug info:
gsttypefindelement.c(1236): gst_type_find_element_loop (): /GstPipeline:pipeline0/GstDecodeBin:decodebin0/GstTypeFindElement:typefind:
streaming stopped, reason error (-5)
ERROR: pipeline doesn't want to preroll.
Setting pipeline to NULL ...
Freeing pipeline ...
xinit: connection to X server lost
waiting for X server to shut down (II) Server terminated successfully (0). Closing log file.
Couldn't get a file descriptor referring to the console
I think this is because there is an error in nvjpegdec regarding its type find funcionality which will make decodebin to fail.