dusty-nv / jetson-inference

Hello AI World guide to deploying deep-learning inference networks and deep vision primitives with TensorRT and NVIDIA Jetson.
https://developer.nvidia.com/embedded/twodaystoademo
MIT License
7.41k stars 2.92k forks source link

no element "omxh264dec" #810

Closed SergeyMalashenko closed 1 year ago

SergeyMalashenko commented 3 years ago

Good day! I am trying to build and use your project. I am getting the following message.

[gstreamer] gstDecoder -- failed to create pipeline [gstreamer] (no element "omxh264dec") [gstreamer] gstDecoder -- failed to create decoder for file:///home/smalashenko/My_projects/C++/jetson-inference/build/x86_64/bin/./e36-test-29294ba2ae_1602173004_587.mp4 detectnet: failed to create input stream

dusty-nv commented 3 years ago

Hi @SergeyMalashenko , it appears you are building this on x86_64, so the jetson-utils video decoding won't work there (as those hardware-accelerated gstreamer elements are for Jetson only)

You can try changing the GStreamer element here:

https://github.com/dusty-nv/jetson-utils/blob/833fc7998e34d852672277730a11aeed90024959/codec/gstDecoder.cpp#L554

You would want to change it from omxh264dec to a h264 decoding plugin for GStreamer that you have on x86 (see here)

irshadkn commented 2 years ago

Hardware: Jetson Nano 4GB

video-viewer --input-codec=h265 rtsp://admin:rgbsi123@192.168.1.61:554/Streaming/channels/101 [gstreamer] initialized gstreamer, version 1.14.5.0 [gstreamer] gstDecoder -- creating decoder for @192.168.1.61 Opening in BLOCKING MODE Opening in BLOCKING MODE NvMMLiteOpen : Block : BlockType = 279 NVMEDIA: Reading vendor.tegra.display-size : status: 6 NvMMLiteBlockCreate : Block : BlockType = 279 [gstreamer] gstDecoder -- discovered video resolution: 1280x720 (framerate 0.000000 Hz) [gstreamer] gstDecoder -- discovered video caps: video/x-h265, stream-format=(string)byte-stream, alignment=(string)au, width=(int)1280, height=(int)720, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true, profile=(string)main, tier=(string)main, level=(string)3.1 [gstreamer] gstDecoder -- pipeline string: [gstreamer] rtspsrc location=rtsp://@192.168.1.61:554/Streaming/channels/101 latency=2000 ! queue ! rtph265depay ! h265parse ! omxh265dec ! video/x-raw ! appsink name=mysink [gstreamer] gstDecoder -- failed to create pipeline [gstreamer] (no element "omxh265dec") [gstreamer] gstDecoder -- failed to create decoder for rtsp://@192.168.1.61:554/Streaming/channels/101 video-viewer: failed to create input stream

omxh264dec and omxh265dec not found on jetson nano

dusty-nv commented 2 years ago

Can you run gst-inspect-1.0 | grep omx ? Are there any listed?

These should be automatically installed when you use the Nano SD card image.

irshadkn commented 2 years ago

gst-inspect-1.0 | grep omx libav: avenc_h264_omx: libav OpenMAX IL H.264 video encoder encoder

I downloaded the image from this link: https://developer.nvidia.com/jetson-nano-sd-card-image

dusty-nv commented 2 years ago

This is the expected output:

gst-inspect-1.0 | grep omx

libav:  avenc_h264_omx: libav OpenMAX IL H.264 video encoder encoder
omx:  omxmpeg4videodec: OpenMAX MPEG4 Video Decoder
omx:  omxh264dec: OpenMAX H.264 Video Decoder
omx:  omxh265dec: OpenMAX H.265 Video Decoder
omx:  omxvp8dec: OpenMAX VP8 Video Decoder
omx:  omxvp9dec: OpenMAX VP9 Video Decoder
omx:  omxmpeg2videodec: OpenMAX MPEG2 Video Decoder
omx:  omxwmvdec: OpenMAX WMV Video Decoder
omx:  omxh264enc: OpenMAX H.264 Video Encoder
omx:  omxh265enc: OpenMAX H.265 Video Encoder
omx:  omxvp8enc: OpenMAX VP8 Video Encoder
omx:  omxvp9enc: OpenMAX VP9 Video Encoder
omx:  nvoverlaysink: OpenMax Video Sink

You may want to try re-flashing your SD card and confirm what this outputs with a fresh image.

Rayn0r commented 2 years ago

Since I could'nt get my hands on a Jetson Nano Developer Kit(sold out everywhere), I tried to get things running under Ubuntu.

I stumbled upon a similar issue, while trying to get jetson-inference to work under Ubuntu 18.04 x86_64 with a GTX1660S where omxh264dec is not available.

After installing vaapi for gstreamer and editing the include file gstUtility.h under build/... accordingly:

--- /usr/local/include/jetson-utils/gstUtility.h        2022-04-26 14:00:46.400992467 +0200
+++ /speedy/build-env/jetson-inference/build/x86_64/include/jetson-utils/gstUtility.h   2022-04-26 13:16:05.455809154 +0200
@@ -116,7 +116,7 @@
 #if GST_CHECK_VERSION(1,0,0)

 // Decoders for JetPack <= 4 and GStreamer >= 1.0
-#define GST_DECODER_H264  "omxh264dec"
+#define GST_DECODER_H264  "vaapih264dec"
 #define GST_DECODER_H265  "omxh265dec"
 #define GST_DECODER_VP8   "omxvp8dec"
 #define GST_DECODER_VP9   "omxvp9dec"

the video from the rtsp source got displayed.

Red areas are shifted vertically in some parts of the image. But for testing this is not an issue.

Thanks to this->issue, I was able to get the inital setup running :-)