I am implementing a client/server application where video streaming occurs between two computers (in one direction). I would like to have the server publish an SDP file when it starts streaming. The client would then be able to download this SDP file and use it to get the stream. In order to implement this it seems I need to include a RTSP server in my server application.
I am planning to use either libVLC or GStreamer for the client. Both are able to get incoming video streams using the info from an SDP file.
Server-side I don't really know where to start. Can anyone recommend a good C++ library that would allow me to create a small RTSP server?
Use Live555 LGPL library or for fun, read the RFC and implement :-)
Libcurl's library offers a simple example that can be usefull for the server side..
Take a look at: https://curl.haxx.se/libcurl/c/rtsp.html
Related
I don’t know if I can say “I’m sorry for ask” but I spent more than a week looking for a solution without success. I have a Jetson Nano and with OpenCV I get and process an image at 4fps, I need to send this video to a web server to allow the client connected to the server get the video. Everything need to be written in C++.
Because a need a low latency I did test with GStreamer and WebRTC without success. I don’t have any web server ready, so I can use any implementation.
Anyone know where I can find some example implementation with this schema?
You can use mediasoup to send data to the server to then send the stream with rtp to another endpoint like gstreamer or ffmpeg.
Here is a recording project where data is sent from the browser -> server -> gstreamer -> file.
Mediasoup is written in c++ and has a wrapper for js.
I had similar problem and used such example from GStreamer WebRTC official repo. It's written in Python for Janus Gateway video rooms but I think it can be easily rewritten in C++ as you need.
In the code for OpenCV, I used V4L2Loopback as a virtual output device to be used as input for GStreamer WebRTC example.
I hope such approach may help you.
I think no need to send it to a Web Server. In Gstreamer examples [https://github.com/GStreamer/gst-examples]. The SendOnly example sends a video to a Web Client Using WebRTC. You can modify it to send an OpenCV mat.
I would like to write a RTSP streaming server using C++. Multiple clients will be connected to this server for receiving the streamed data.
What I understand is that I need to do socket programming in C++ for client server architecture.
I know FFMPEG has command line support for streaming audio/video. But my requirement is writing a client server socket model in C++.
I had a look at https://www.medialan.de/usecase0001.html
I am also looking at this. https://www.youtube.com/watch?v=MEMzo59CPr8
but I am not sure if this will help me.
For streaming the audio/video data, Do i need to use FFMEPG APIs. If yes, which libraries of FFMPEG i need to use?.
I think I will use gstreamer RTSP server.
Gstreamer is easy to use.
I tried sample example and I was able to stream a video over RTSP.
No, you don’t need ffmpeg to write an RTSP server.
I manged to run WebRTC peerconnection example, but it is not running on the browser.
I'm trying to find a way to stream both video and audio from browser to my native program.
Is there any way?
It can be done. WebRTC is designed to work in a peer-to-peer manner between two WebRTC agents (typically a Web Browser). Your native program needs to become the second peer.
If you need to rely on open source components a good starting point is:
OpenSSL for the DTLS key exchange.
libsrtp to encrypt the RTP packets.
ffmpeg to decode the PCM audio from the browser (libvpx if you need to do video).
You'll also need to handle the ICE negotiation which requires processing STUN messages. Also extract the media payloads from the RTP packets. All these steps are also after you've determined a signalling method to exchange the SDP offer and answer between you app and the browser.
As you've probably realised starting from scratch it's a major task. There are probably some commercial libraries that will do the job and save you a lot of pain.
If that doesn't scare you and you do still want to make an attempt using open source components this example "may" help. The sample is doing the reverse of what you've asked and is sending a video stream to Chrome rather than receiving an audio stream. The useful aspect is the connection negotiation. The sample program is able to get RTP packets flowing which is often the main problem.
The example is also using Windows Media Foundation which is Windows specific. It also has lots of shortcuts particularly with the RTP and STUN packet processing.
I worked in the past on WebRTC with a C server (Janus) that i know very very well, now i want to add the WebRtc capacity to Live555 to be able to stream some video through it.
The problem is that i'am kind of overwhelmed with the lack of documentation in live555 (worst than Janus)
If i can resume live555 lacks :
1- A SDP parser/builder
2- A HTTP signaling Parser/Builder
My question is if i see all that is missing, or need to be done ?
If by any chance someone can give me some hints.
Live555 make a demo that is available on http://webrtc.live555.com/, but this seems still not available opensource.
You can have a look to one of my experimentation that is available on github webrtc-streamer. This application use live555 as an RTSP consumer and give access to WebRTC using a embedded HTTP server (like janus-gateway does). The signaling try to be as simple as possible.
Live Demo
I would like to make of some sort of a streaming server. I would like it to receive RTSP streams over the net from live streams (e.g. webcam, ipcam, etc.) then broadcast that same stream on my local network using a different URL. I know gstreamer can do it quite well but I don't know how. I'm quite confused with the way the documentation is written. Can somebody help me?
If you would like to retransmit the video streams using RTSP as well, you can use GStreamer RTSP Server. There is a lot of examples on the Internet how to use it. The best source of the examples is the gst-rtsp-server's examples directory:
http://cgit.freedesktop.org/gstreamer/gst-rtsp-server/tree/examples
As you want to retransmit existing RTSP streams, you'll need to use the rtspsrc element for reception of the remote streams.
I think you are looking for something like this: https://github.com/jayridge/rtsprelay. It configures one rtsp server to receive clients on two urls with a record link and a play link.
This example uses a dynamic form:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1454
rtsp://server/path?uri=encoded-URI
you HTML encode the destination in URI form and add a path where it should register this camera to. The first time you connect; it will take some time, after that; the sessions are re-used.