Gstreamer pipeline optimisation with hardware acceleration on TX2

hello all:)

I’m struggling with gstreamer pipelines at the moment. I wonder if any of you tried to stream a video (without audio) from a jetson to a computer using Nvidia hardware acceleration module for h264 encoding?my pipeline on my jetson TX2 looks like

appsrc ! 'video/x-raw, width=(int)640, height=(int)480 ! nvvidconv ! \ 'video/x-raw(memory:NVMM), framerate=(fraction)16/1' ! nvv4l2h264enc ! \ video/x-h264, stream-format=(string)byte-stream ! h264parse ! \ rtph264pay pt=96 ! udpsink host=<IP @> port=2345 sync=false"

But I cannot manage to make it work in my app although the same pipeline launched with gstreamer command line works perfectly (with testvideosrc instead of appsrc):

sudo gst-launch-1.0 videotestsrc ! 'video/x-raw, width=(int)1280, height=(int)720, format=(string)I420, framerate=(fraction)16/1' ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! nvv4l2h264enc ! 'video/x-h264, stream-format=(string)byte-stream' ! h264parse ! rtph264pay pt=96 ! udpsink host=<IP @> port=3456 sync=false -e

My questions are:

  • how my pipeline is working in my command line but not in my code?

  • did any of you manage to leverage jetson hardware acceleration for h264 encoding en streaming?

  • which parameters did you tweak to have the best performances and best image quality without impacting the rests of calculus going on the jetson (bitrate, framerate, format, quantizier, pass, speed-preset…)?

    • on x264 encoding
    • on livestreaming
  • is using opencv instead of gstreamer cpp api a good practice? In my code I have something like cv::VideoWriter writer(command.toStdString(),...);?

Thank you very much
Have a great day

Hi,
This use-case should work fine. There are topics for reference and please take a look at:
VideoWriter with gstreamer - #9 by DaneLLL

Note that single quotes are only useful with gst-launch-1.0 for preventing bash from interpreting the parenthesis such as (memory:NVMM).
Also backslashes may be a convenient way for splitting long pipelines into several lines for shell, but for C++, python or else code this may be different depending on your code and programming language.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.