Motion vectors in Gstreamer

Hello,
was anybody successfully with processing motion vectors using gstreamer.
If I use following gstreamer pipeline

videotestsrc pattern=ball num-buffers=300 ! ‘video/x-raw, width=(int)1280, height=(int)720, format=(string)I420, framerate=(fraction)30/1’ ! nvvidconv ! ‘video/x-raw(memory:NVMM), format=(string)I420’ ! nvv4l2h264enc EnableMVBufferMeta=1 ! ‘video/x-h264, stream-format=(string)byte-stream, alignment=(string)au’ ! filesink location=test.264

I will get on screen really many messages like

Num MVs = 3600
0: mv_x=0 mv_y=0 weight=0
1: mv_x=0 mv_y=0 weight=0


3599: mv_x=0 mv_y=0 weight=0

Is possible to disable showing it in console/screen?
How to process it programmatically, e.g.using appsink or some callbacks?

Thanks

1 Like

Hi,
The source code of nvv4l2h264enc is public. You may download it and keep the required prints. Please check

https://developer.nvidia.com/EMBEDDED/linux-tegra
L4T Driver Package (BSP) Sources

Thanks for your answer.

I have found required files and recompiled library. I have commented out g_print lines and no info is showing anymore.

Now to second part of my question - is possible to get motion vector data from my application (using some sort of GstAppSinkCallbacks, GstPadProbeInfo or GstMeta )?

It seems, that function get_motion_vectors used in gstv4l2bufferpool.c do nothing more with founded motion vectors. Is it so?

Hi,
There is no existing implementation for this. Since gst-v4l2 is open source, you may check the code and do customization.

If is anyone intersted I have made modification of

gst-nvvideo4linux2_src

See:

GitHub - lagurus/gst-nvvideo4linux2_src: Meta data support for motion vectors on Jetson Nano

3 Likes