Gstreamer Install and UDP stream instructions - MDHSRobotics/TeamWiki GitHub Wiki

Ok guys here's a step by step (no pictures yet, I need to boot into Linux to do that and it's a pain. It'll happen eventually)

Step 1. Install gstreamer

This step is fairly easy. Follow these steps and you'll have it in no time.

  1. Open the terminal

  2. Enter the following into the terminal, sequentially and individually

  3. sudo add-apt-repository ppa:gstreamer-developers/ppa Note: Sometimes this doesn't work, that's ok it seems to work without it.

  4. sudo apt-get update

  5. sudo apt-get install gstreamer1.0*

  6. Run this line gst-launch videotestsrc ! ximagesink . It will come up with an error, saying you need to install some tools and will give you a line to run that will install them. Do that.

  7. Congrats Gstreamer is now installed. The plugins (at least the good, bad, and ugly ones) are available through basically every distro's package repository.

And now for UDP streaming.

This is the only line that I've gotten to work and it needs work. The delay is about 8 seconds, useless for a competition. I'll work on it and update the results.

Enter this into the terminal gst-launch-1.0 -vv -e videotestsrc ! queue ! x264enc bitrate=5000 ! mpegtsmux alignment=7 ! rndbuffersize max=1316 min=1316 ! udpsink host=127.0.0.1 port=5004 for a stream of the video test (the colored bars with the snow in the corner)

Enter this for testing the default camera gst-launch-1.0 -vv -e autovideosrc ! queue ! x264enc bitrate=5000 ! mpegtsmux alignment=7 ! rndbuffersize max=1316 min=1316 ! udpsink host=127.0.0.1 port=5004

Enter this to manually select which camera will be used gst-launch-1.0 -vv -e /dev/video0 ! queue ! x264enc bitrate=5000 ! mpegtsmux alignment=7 ! rndbuffersize max=1316 min=1316 ! udpsink host=127.0.0.1 port=5004 (replace the /dev/video0 with /dev/video1, /dev/video2 etc.)

udp://@127.0.0.1:5004

Update 2: We lowered the latency to ~0.64 seconds!

Use this line (Linux) gst-launch-1.0 -vv -e autovideosrc ! queue ! x264enc bitrate=1024 speed-preset=superfast qp-min=30 tune=zerolatency ! mpegtsmux alignment=7 ! rndbuffersize max=1316 min=1316 ! udpsink host=127.0.0.1 port=5000

udp://@127.0.0.1:5000

And to pick it up in VLC:

  1. Open VLC

  2. Right click in the playback area and click Open Media then select Open Network

  3. For the url put udp://@127.0.0.1:5000 For local streaming. We are still working on streaming from one computer to another.

  4. Cick on 'Show more options' and set the Caching to 250ms

You should be able to get a video stream from the camera/test that you chose.

Plans for the future:

  • I need to make it a UDP multicast so we can choose between the cameras.

  • I also would like to reduce the bandwidth (if possible) by fine tuning the compression for the Jetson TX1. I'll probably throw some compression together for different devices if I have the time and desire.

  • If I have time I'd like to make it so the stream is saved locally, as it would be pretty cool. If not, I'll just record the video that is streamed in using OBS or similar

  • Lastly, I need to work on getting the command to run on boot so it can actually be used in a competition. This should be fairly easy