Search code examples
c++gstreamerrtsprtp

Gstreamer RT(S)P Server with custom encoder C++


I'm looking to create a Real-time transport/streaming protocol (RT(S)P) server using gstreamer api in c++ (on a linux platform) with the possibility to send out data encoded by a custom encoder/decoder. So far i have a simple server working using the following tutorial: http://www.ip-sense.com/linuxsense/how-to-develop-a-rtsp-server-in-linux-using-gstreamer/

The following step would be to find a way to do so with raw images and then with my custom encoder.

Can anyone point me towards a tutorial/example of something similar and perhaps explain which of both RTSP and RTP (or both?) would be best to use for this?


Solution

  • to use custom encoder/decoder you would need to write your own gstreamer plugin. If you look at line 83 to 85 in tutorial code, it is defining a gstreamer pipeline.

    gst_rtsp_media_factory_set_launch (factory, "( " "videotestsrc ! video/x-raw-yuv,width=320,height=240,framerate=10/1 ! " "x264enc ! queue ! rtph264pay name=pay0 pt=96 ! audiotestsrc ! audio/x-raw-int,rate=8000 ! alawenc ! rtppcmapay name=pay1 pt=97 "")");

    here the pipeline is using x264enc and H.264 encoder. After writing a gstreamer plugin you can change the above pipeline to use your encoder.