omxh264dec vs nv_omx_h264dec

Hi, my environment is TK1 with Release 21.5. Im using gst to decode videos. It seem that omxh264dec NOT using hard accl, why ?

gst-launch-1.0 -ev filesrc location="./test.mp4" ! qtdemux ! queue ! h264parse ! omxh264dec ! fakesink
cpu: 69%

gst-launch-0.10 -e filesrc location="./test.mp4" ! qtdemux ! queue ! h264parse ! nv_omx_h264dec ! fakesink
cpu: 6%

any suggest is appreciated.

I think that’s expected, the regular OpenMAX decoder isn’t GPU accelerated.

thanks, but how to use GPU accelerating for gst-1.0 ?

Did you already check out the L4T 21.5 multimedia guide? There’s some examples in there.

hi cstotts

This is my testing. Im using ipcamera video source, 1280x1024, h264 mainprofile, 25fps, and using top to query the cpu performance.

gst-launch-0.10 -ve rtspsrc location=rtsp://172.16.1.56/av0_0 ! rtph264depay ! h264parse ! nv_omx_h264dec ! fakesink
cpu: 8%

gst-launch-1.0 -ve rtspsrc location=rtsp://172.16.1.56/av0_0 ! rtph264depay ! h264parse ! omxh264dec ! fakesink
cpu: 36%

I don’t think there are diffs between the samples in manual and the commands.

Hi sunkw
I can make sure both of the omxh264dec and nv_omx_h264dec are using hardware decoder. The different is the gstreamer framework is different. These use case should not be compared. You can try some other SW decoder to see the what different in cpu usage and performance.

hi ShaneCCC
I use ffmpeg to test.

ffmpeg -i rtsp://172.16.1.56/av0_0 -f null /dev/null
cpu: 45%

en, Looks like CPU usage is a bit high. BUT its not so obvious.

$ffmpeg -i rtsp://172.16.1.56/av0_0 -f null /dev/null
ffmpeg version N-67840-ga4f58c5 Copyright © 2000-2014 the FFmpeg developers
built on Aug 24 2016 08:17:06 with gcc 4.8 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04.3)
configuration: --enable-static --disable-shared
libavutil 54. 14.100 / 54. 14.100
libavcodec 56. 12.101 / 56. 12.101
libavformat 56. 14.100 / 56. 14.100
libavdevice 56. 3.100 / 56. 3.100
libavfilter 5. 2.103 / 5. 2.103
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100

Input #0, rtsp, from ‘rtsp://172.16.1.56/av0_0’:
Metadata:
title : av0_0
Duration: N/A, start: 0.040000, bitrate: N/A
Stream #0:0: Video: h264 (Main), yuv420p, 1280x1024, 25 fps, 25 tbr, 90k tbn, 180k tbc

Output #0, null, to ‘/dev/null’:
Metadata:
title : av0_0
encoder : Lavf56.14.100
Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x1024, q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc56.12.101 rawvideo
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))

$gst-launch-1.0 -ve rtsp://172.16.1.56/av0_0 ! rtph264depay ! h264parse ! omxh264dec ! fakesink
Setting pipeline to PAUSED …
Inside NvxLiteH264DecoderLowLatencyInitNvxLiteH264DecoderLowLatencyInit set DPB and MjstreamingPipeline is live and does not need PREROLL …
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://172.16.1.56/av0_0
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:manager: latency = 2000
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:manager: ntp-sync = false
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:manager: use-pipeline-clock = false
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:manager: drop-on-latency = false
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:manager: buffer-mode = Slave receiver to sender clock
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSrc:udpsrc0: timeout = 5000000000
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSrc:udpsrc1.GstPad:src: caps = application/x-rtcp
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSrc:udpsrc1: caps = application/x-rtcp
Progress: (open) Opened Stream
Setting pipeline to PLAYING …
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSrc:udpsrc0: timeout = 0
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:manager/GstRtpSession:rtpsession0.GstPad:send_rtcp_src: caps = application/x-rtcp
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:manager.GstGhostPad:send_rtcp_src_0: caps = application/x-rtcp
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSink:udpsink1.GstPad:sink: caps = application/x-rtcp
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:manager.GstGhostPad:send_rtcp_src_0.GstProxyPad:proxypad2: caps = application/x-rtcp
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:manager.GstGhostPad:recv_rtp_src_0_1811609324_96: caps = application/x-rtp, media=(string)video, payload=(int)96, clock-rate=(int)90000, encoding-name=(string)H264, profile-level-id=(string)4d0020, packetization-mode=(string)1, sprop-parameter-sets=(string)“Z00AIJWoFACBkA==,aO48gA==”, npt-start=(guint64)0, play-speed=(double)1, play-scale=(double)1
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0.GstGhostPad:recv_rtp_src_0_1811609324_96: caps = application/x-rtp, media=(string)video, payload=(int)96, clock-rate=(int)90000, encoding-name=(string)H264, profile-level-id=(string)4d0020, packetization-mode=(string)1, sprop-parameter-sets=(string)“Z00AIJWoFACBkA==,aO48gA==”, npt-start=(guint64)0, play-speed=(double)1, play-scale=(double)1
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:src: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)014d0020ffe1000a674d002095a81400819001000468ee3c80
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, stream-format=(string)avc, alignment=(string)au, codec_data=(buffer)014d0020ffe1000a674d002095a81400819001000468ee3c80
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:sink: caps = application/x-rtp, media=(string)video, payload=(int)96, clock-rate=(int)90000, encoding-name=(string)H264, profile-level-id=(string)4d0020, packetization-mode=(string)1, sprop-parameter-sets=(string)“Z00AIJWoFACBkA==,aO48gA==”, npt-start=(guint64)0, play-speed=(double)1, play-scale=(double)1
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0.GstGhostPad:recv_rtp_src_0_1811609324_96.GstProxyPad:proxypad4: caps = application/x-rtp, media=(string)video, payload=(int)96, clock-rate=(int)90000, encoding-name=(string)H264, profile-level-id=(string)4d0020, packetization-mode=(string)1, sprop-parameter-sets=(string)“Z00AIJWoFACBkA==,aO48gA==”, npt-start=(guint64)0, play-speed=(double)1, play-scale=(double)1
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:manager.GstGhostPad:recv_rtp_src_0_1811609324_96.GstProxyPad:proxypad3: caps = application/x-rtp, media=(string)video, payload=(int)96, clock-rate=(int)90000, encoding-name=(string)H264, profile-level-id=(string)4d0020, packetization-mode=(string)1, sprop-parameter-sets=(string)“Z00AIJWoFACBkA==,aO48gA==”, npt-start=(guint64)0, play-speed=(double)1, play-scale=(double)1
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, width=(int)1280, height=(int)1024, parsed=(boolean)true
/GstPipeline:pipeline0/GstOMXH264Dec-omxh264dec:omxh264dec-omxh264dec0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)au, width=(int)1280, height=(int)1024, parsed=(boolean)true
NvMMLiteOpen : Block : BlockType = 261
TVMR: NvMMLiteTVMRDecBlockOpen: 5107: NvMMLiteBlockOpen
NvMMLiteBlockCreate : Block : BlockType = 261
TVMR: cbBeginSequence: 584: BeginSequence 1280x1024, bVPR = 0
TVMR: cbBeginSequence: 826: DecodeBuffers = 5
TVMR: cbBeginSequence: 850: Display Resolution : (1280x1024)
TVMR: cbBeginSequence: 851: Display Aspect Ratio : (1280x1024)
TVMR: cbBeginSequence: 1015: SurfaceLayout = 3
TVMR: cbBeginSequence: 1045: NumOfSurfaces = 9, InteraceStream = 0, InterlaceEnabled = 0, bSecure = 0, MVC = 0 Semiplanar = 1, bReinit = 1
Allocating new output: 1280x1024 (x 11), ThumbnailMode = 0
/GstPipeline:pipeline0/GstOMXH264Dec-omxh264dec:omxh264dec-omxh264dec0.GstPad:src: caps = video/x-raw, format=(string)NV12, width=(int)1280, height=(int)1024, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, framerate=(fraction)0/1
/GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-raw, format=(string)NV12, width=(int)1280, height=(int)1024, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, colorimetry=(string)bt709, framerate=(fraction)0/1

$gst-launch-0.10 -ve rtsp://172.16.1.56/av0_0 ! rtph264depay ! h264parse ! nv_omx_h264dec ! fakesink silent=1
Inside NvxLiteH264DecoderLowLatencyInitNvxLiteH264DecoderLowLatencyInit set DPB and MjstreamingSetting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Setting pipeline to PLAYING …
New clock: GstSystemClock
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:rtpbin0: latency = 2000
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:rtpbin0: buffer-mode = slave (1)
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSrc:udpsrc1: timeout = 5000000
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:rtpbin0.GstGhostPad:send_rtcp_src_0: caps = application/x-rtcp
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:rtpbin0/GstRtpSession:rtpsession0.GstPad:send_rtcp_src: caps = application/x-rtcp
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSink:udpsink1.GstPad:sink: caps = application/x-rtcp
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:rtpbin0.GstGhostPad:send_rtcp_src_0.GstProxyPad:proxypad2: caps = application/x-rtcp
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstUDPSrc:udpsrc1: timeout = 0
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)nal
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:sink: caps = application/x-rtp, media=(string)video, payload=(int)96, clock-rate=(int)90000, encoding-name=(string)H264, profile-level-id=(string)4d0020, packetization-mode=(string)1, sprop-parameter-sets=(string)“Z00AIJWoFACBkA\=\=\,aO48gA\=\=”, npt-start=(guint64)0, play-speed=(double)1, play-scale=(double)1
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0.GstGhostPad:recv_rtp_src_0_233946191_96: caps = application/x-rtp, media=(string)video, payload=(int)96, clock-rate=(int)90000, encoding-name=(string)H264, profile-level-id=(string)4d0020, packetization-mode=(string)1, sprop-parameter-sets=(string)“Z00AIJWoFACBkA\=\=\,aO48gA\=\=”, npt-start=(guint64)0, play-speed=(double)1, play-scale=(double)1
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0.GstGhostPad:recv_rtp_src_0_233946191_96.GstProxyPad:proxypad4: caps = application/x-rtp, media=(string)video, payload=(int)96, clock-rate=(int)90000, encoding-name=(string)H264, profile-level-id=(string)4d0020, packetization-mode=(string)1, sprop-parameter-sets=(string)“Z00AIJWoFACBkA\=\=\,aO48gA\=\=”, npt-start=(guint64)0, play-speed=(double)1, play-scale=(double)1
/GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0/GstRtpBin:rtpbin0.GstGhostPad:recv_rtp_src_0_233946191_96.GstProxyPad:proxypad3: caps = application/x-rtp, media=(string)video, payload=(int)96, clock-rate=(int)90000, encoding-name=(string)H264, profile-level-id=(string)4d0020, packetization-mode=(string)1, sprop-parameter-sets=(string)“Z00AIJWoFACBkA\=\=\,aO48gA\=\=”, npt-start=(guint64)0, play-speed=(double)1, play-scale=(double)1
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:src: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)nal, parsed=(boolean)true
/GstPipeline:pipeline0/GstH264Parse:h264parse0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)nal
WARNING: from element /GstPipeline:pipeline0/GstOmxH264Dec:omxh264dec0: Could not decode stream.
Additional debug info:
/dvs/git/dirty/git-master_linux/external/gstreamer/gst-openmax/omx/gstomx_h264dec.c(83): sink_setcaps (): /GstPipeline:pipeline0/GstOmxH264Dec:omxh264dec0:
Received Invalid Width/Height - using 720/480
/GstPipeline:pipeline0/GstOmxH264Dec:omxh264dec0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)nal, parsed=(boolean)true
/GstPipeline:pipeline0/GstOmxH264Dec:omxh264dec0.GstPad:sink: caps = video/x-h264, stream-format=(string)byte-stream, alignment=(string)nal, parsed=(boolean)true
NvMMLiteOpen : Block : BlockType = 261
TVMR: NvMMLiteTVMRDecBlockOpen: 5107: NvMMLiteBlockOpen
NvMMLiteBlockCreate : Block : BlockType = 261
TVMR: cbBeginSequence: 584: BeginSequence 1280x1024, bVPR = 0
TVMR: cbBeginSequence: 826: DecodeBuffers = 5
TVMR: cbBeginSequence: 850: Display Resolution : (1280x1024)
TVMR: cbBeginSequence: 851: Display Aspect Ratio : (1280x1024)
TVMR: cbBeginSequence: 1015: SurfaceLayout = 3
TVMR: cbBeginSequence: 1045: NumOfSurfaces = 9, InteraceStream = 0, InterlaceEnabled = 0, bSecure = 0, MVC = 0 Semiplanar = 1, bReinit = 1
Allocating new output: 1280x1024 (x 11), ThumbnailMode = 0
/GstPipeline:pipeline0/GstOmxH264Dec:omxh264dec0.GstPad:src: caps = video/x-nv-yuv, width=(int)1280, height=(int)1024, format=(fourcc)NV12, stereoflags=(int)0, framerate=(fraction)0/1, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstOmxH264Dec:omxh264dec0.GstPad:src: caps = NULL
/GstPipeline:pipeline0/GstOmxH264Dec:omxh264dec0.GstPad:src: caps = video/x-nv-yuv, width=(int)1280, height=(int)1024, format=(fourcc)NV12, stereoflags=(int)0, framerate=(fraction)0/1, pixel-aspect-ratio=(fraction)1/1
/GstPipeline:pipeline0/GstFakeSink:fakesink0.GstPad:sink: caps = video/x-nv-yuv, width=(int)1280, height=(int)1024, format=(fourcc)NV12, stereoflags=(int)0, framerate=(fraction)0/1, pixel-aspect-ratio=(fraction)1/1

Hi Shane/sunkw,

I am also facing same issue. When using omxh264dec, tegrastats shows 0% against GR3D.
[PS: I have enabled performance mode for CPU + set GPU to highest clock rate. Also, running tegrastat with root]

When using gstreamer-1.0, I am getting 50 FPS @ 96% CPU [h264 (Main) --> NV12]
Command : gstreamer-1.0 filesrc location= ! avidemux ! queue ! h264parse ! omxh264dec ! fakesink -e

But when I was using gstreamer-0.10, CPU usage was pretty less. So, whats the differance b/w gstreamer-0.10 and gstreamer-1.0. Ideally, new version should improve/optimize things.

It is also possible that my interpretation of results/stats is wrong. Please correct me if this is the case.

My last doubt is, whether GPU does video decoding or there is some other hardware for video decoding because in tegrastats GR3D shows 0% in both the cases but stats againts EMC, AVP, VDE shows change?

Reference link
https://devtalk.nvidia.com/default/topic/1009866/jetson-tk1/high-cpu-usage-in-omxh264dec-/post/5153387/#5153387