Profile gstreamer plugins?

I am using gstreamer and the nvidia provided hw accelerated plugins to decode and encode video. Is there a way to tell how much time is spend doing the decode and encode step of a pipeline?

I found some tools ( https://github.com/kirushyk/gst-instruments) that provide timing information for different elements of a pipeline but it doesn’t seem to understand how much time is spent in the hw accelerated plugins.

I tried this on my pipeline that transcodes a video file.
I don’t think that the gst-top tool is able to record how much time is actually being spent by the hw decoder and encoder. My theory that it is only recording the time taken by the sw to pass the data back and forth to the hardware decoder and encoder.

gst-launch reports total running time of

Execution ended after 0:01:42.139042670 (102.14 seconds)

Adding up all the running time of gst-top comes to 69.912 seconds leaving 32.228 seconds un accounted for.

Here are the pipeline and the results I found.

gst-top-1.0 gst-launch-1.0 -e mpegtsmux name=m ! filesink location=uhd1280x720hwenc.mp4 filesrc location=uhd.trp ! tsdemux name=dem dem. ! queue ! h265parse ! omxh265dec ! nvvidconv ! ‘video/x-raw(memory:NVMM), width=(int)1280, height=(int)720, format=(string)I420’ ! omxh264enc profile=8 ! m. dem. ! queue ! avdec_aac ! audioconvert ! voaacenc ! m.

ELEMENT %CPU %TIME TIME
voaacenc0 23.6 34.5 24.1 s
m 7.4 10.9 7.59 s
h265parse0 7.3 10.7 7.51 s
filesink0 5.7 8.4 5.87 s
dem 5.7 8.3 5.80 s
nvvconv0 4.5 6.6 4.60 s
avdec_aac0 4.5 6.5 4.57 s
filesrc0 3.5 5.1 3.56 s
audioconvert0 2.5 3.7 2.58 s
omxh265dec-omxh265dec0 1.9 2.8 1.95 s
omxh264enc-omxh264enc0 0.6 0.8 580 ms
capsfilter0 0.4 0.6 454 ms
queue0 0.4 0.6 410 ms
queue1 0.3 0.5 338 ms
pipeline0 0.0 0.0 0 ns

Regards,
Rand

1 Like

Hi Rand,
For profiling of HW encoder/decoder, you can try to add gettimeofday() in the source to get time taken in encoder/decoder

The source code of gstomx1 is at
https://developer.nvidia.com/embedded/dlc/l4t-sources-24-2-1

PLease follow the steps to build libgstomx.so
https://devtalk.nvidia.com/default/topic/983587/jetson-tx1/gst-omx-plugin-build-error/post/5059343/#5059343

Source files:
gstomxvideodec.c
gstomxvideoenc.c

Hi,

I am interested in profiling the hardware encoder, but I don’t understand what you (@Danell) you mean with the source ?

Regards,

I think Dane suggested that you get source code of these two plugins and rebuild your own versions where you could add measurements.

You may also have a look to http://developer.ridgerun.com/wiki/index.php?title=GstShark.

Hi Honey_Patouceul,

Thank you for your reply, BTW I need to profile the hardaware encoder omxh264enc of Jetson TX2, can u give me more details about how access the source code of this plugin to change it or give me a documentation or another thread that explain this.

Regards,

You can get the sources by downloading the source_package archive from nvidia.
The link provided by Dane is for L4T R24.2.1. If

head -n 1 /etc/nv_tegra_release

shows another version, you can go to https://developer.nvidia.com/embedded/downloads#?search=source and download the source package (L4T Sources) for your L4T version.

It comes as a compressed archive. It contains several compressed archives. The one you will extract is gst-omx1_src.tbz2.
Once extracted, just check the README.txt in the extracted directory and follow these instructions.

Thanks Honey_Patouceul for your reply,