30

We are trying to get Gstreamer working on a DM368 Leopardboard*, we've successfully persuaded it to create a test video (videotestsrc), encode it, and dump it into a file.

The pipe that worked is:

gst-launch -v videotestsrc num-buffers=100 ! queue ! ffenc_mpeg4 bitrate=800000 ! ffmux_mp4 ! filesink location=video_test.mp4

The next step is to modify the pipe to stream the testcard over the network, to be viewed on a PC with VLC using something like rtsp://ip_addr:port/streamname but the documentation on how to do this seems quite thin on the ground (and often outdated), and the examples seem to blur source code and command line ways of doing it.

I'll freely admit that >50% of the problem is our lack of familiarity with Gstreamer & its various parts, I've always found that if I have a working example to start from I can poke it with sticks and work out the rest from there.

I've got this far:

gst-launch -v videotestsrc ! queue ! ffenc_mpeg4 bitrate=800000 ! rtpmp4vpay ! tcpserversink host=<PC_ip> port=5000

Which seems to make something happen in VLC (using tcp://board_ip:port)- it seems to think there's something going on (doesn't throw an error) but doesn't play/show anything. When I break (^C) the gst process, VLC notices.

So, basically - any guidance/feedback would be great, a working one-liner would be fantastic.

Edited to add: Yes I see the test_video.c example, but that's compiling a special program to do something which looks like it should be possible to just invoke from the command line to prove the concept.

* = Linux version 2.6.32-17-ridgerun /CPU: ARM926EJ-S
6
  • 2
    There is a c example that seems to do it here, but doesn't really explain how it's used: cgit.freedesktop.org/gstreamer/gst-rtsp-server/tree/examples/…
    – John U
    Dec 6, 2012 at 14:06
  • 1
    gst-rtsp-server has test-launch example, you can specify the encoding pipeline. The server code is very small since it uses most of the gstreamer's rtsp implementation.
    – rajneesh
    Dec 6, 2012 at 14:27
  • 2
    Yes, I'm looking at the gst example code, but it seems to me there should be some way of invoking gstreamer from the command line to stream a video just to prove that it's possible & working.
    – John U
    Dec 7, 2012 at 12:04
  • But what plugin (element) does the RTSP server use? Does it use udpsink? Jul 15, 2016 at 22:20
  • 1
    I'm voting to close this question as off-topic because questions about Linux and its applications should be on unix.stackexchange.com
    – Rob
    Nov 23, 2018 at 20:09

3 Answers 3

34

Source: In contradiction to RTP, a RTSP server negotiates the connection between a RTP-server and a client on demand (Link). The gst-rtsp-server is not a gstreamer plugin, but a library which can be used to implement your own RTSP application. The following test case was applied on a Ubuntu 12.04.5 machine:

  • Preliminars
    • Install gstreamer-1.0 with base/good/ugly/bad plugins
    • Install autoconf automake autopoint libtool and the other missing essential build tools
  • Build gst-rtsp-server
    • git clone git://anongit.freedesktop.org/gstreamer/gst-rtsp-server && cd gst-rtsp-server
    • We use gstreamer 1.2: git checkout remotes/origin/1.2
    • Build: ./autogen.sh --noconfigure && GST_PLUGINS_GOOD_DIR=$(pkg-config --variable=pluginsdir gstreamer-plugins-bad-1.0) ./configure && make (For some reason, GST_PLUGINS_GOOD_DIR is not set by pkg-config, so we set it explicitly)
  • Test run
    • Run test application: cd examples && ./test-launch "( videotestsrc ! x264enc ! rtph264pay name=pay0 pt=96 )"
    • One can now access the stream (e.g. using VLC) remotely by the address: rtsp://HOST_IP:8554/test
6
  • This is a good start but the main problem I see is that your last bullet point "rtsp://HOST_IP:8554/test" is actually hard-coded in "test-launch.c" to 127.0.0.1 so it's not bound to anything exposed externally. Nov 5, 2016 at 5:26
  • 1
    No, not at all. Just replace HOST_IP with the IP or domain name of your PC which runs the application test-launch.c. Then run an application like VLC from a remote PC and voila, there you'll see your test source.
    – Tik0
    Nov 8, 2016 at 20:14
  • The above test launch works great and i can play it on VLC player. Now i want to input a encoded network live stream. How do i change the input source? Jul 13, 2018 at 21:54
  • For me "test-mp4" worked fine, which was there in examples folder. Beware it won't give any console output - just go ahead and test at: rtsp://HOST_IP:8554/test
    – Blaze
    Aug 12, 2020 at 11:48
  • 1
    @CAMOBAP rtph265pay + udpsink you propose is for sending RTP stream directly to dedicated UDP port at the far end. RTSP server is a layer higher as it serves multimedia streams to many clients. RTSP protocol (in fact RTP + RTCP) is for setting up connections and sessions with clients that connect. To recap - RTP+UDP is point-to-point, RTSP is point-to-multiple clients. Jan 2, 2023 at 14:23
4

Finally found a working example here:

GStreamer rtp stream to vlc

But it does require creating an .SDP file for VLC and specifying IP addresses which is not really how we want to end up... but hey it's a start!

0

I had an issue at the end of the process, something like:

  • configure: No package 'gstreamer-1.0' found
  • configure: error: no gstreamer-1.0 >= 1.2.3 (GStreamer) found

I found the solution in this post:

https://askubuntu.com/questions/384059/error-compiling-a-package-configure-error-no-gstreamer-1-0-1-0-0

And it worked perfectly!!!

1
  • 2
    Rather then linking to an external solution, please summarize the relevant parts in your answer.
    – TomTom101
    May 20, 2017 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.