[Live-devel] Cannot watch RTSP stream from Live555 using FFMPEG
Ross Finlayson
finlayson at live555.com
Mon Oct 30 08:44:43 PDT 2023
> On Oct 30, 2023, at 5:16 AM, Şükrücan Taylan IŞIKOĞLU <staylanisik at aselsan.com.tr> wrote:
>
> I am trying to create an RTSP server using Live555, with the stream source being raw h264 video of my USB webcam encoded with FFMPEG, sent over UDP.
>
> I have used BasicUDPSource from Live555 sources as my FramedSource class. I created my own MediaSubsession class as per the Live555 FAQ<http://www.live555.com/liveMedia/faq.html#liveInput-unicast>. However when I am trying to watch it using FFPLAY I am not getting any output. What am I doing wrong?
Probably lots of things. You are asking how to run before you have demonstrated that you know how to crawl. In particular…
Have you considered streaming your video over RTP/UDP rather than over raw-UDP? In particular, why not make your source its own RTSP server? You could do this with FFMPEG (it has its own RTSP server built-in, as an option), or else use our RTSP server implementation, as described in <http://www.live555.com/liveMedia/faq.html#liveInput>. Then, you might not need an intermediate server (or if you still did need one, you could use our “LIVE555 Proxy Server” <http://live555.com/proxyServer/> instead).
But if you insist on streaming your H.264 video data over raw-UDP, then it’s important that each H.264 NAL unit be sent - with no fragmentation - in its own UDP packet (which means that you can’t have a H.264 NAL unit (in particular, no single ‘key frame’ NAL unit) larger than 65535 bytes). This is one reason why it’s better to stream over RTP/UDP rather than over raw-UDP; RTP has a mechanism for fragmenting large H.264 NAL units into multiple RTP packets. Also, if you pack H.264 NAL units into UDP packets (exactly one NAL unit per UDP packet), then these NAL units *must not* begin with a 0x00 0x00 0x00 0x01 ’start code’.
Also, when testing whether a RTSP server is working, it is best to use our “openRTSP” command-line RTSP client first, before something more complicated like FFMPEG or VLC; see <http://live555.com/openRTSP/>
> The source code and the commands I have used can be found at https://stackoverflow.com/questions/77388506/cannot-watch-rtsp-stream-from-live555-using-ffmpeg
I don’t know why you would post questions about the LIVE555 code to a site like ’Stack Overflow’ before posting them here, but anyway…
- You should set the “reuseFirstSource” variable to True (so that, if your server has multiple concurrent clients, they all read from the same source stream, rather than trying to reopen the input source each time).
- Because you’re receiving the stream via unicast, rather than via multicast, you don’t specify an IP address. Instead, just pass nullAddress() as the “inputAddress” parameter when you create your “Groupsock” object. (Also, this “Groupsock” object should be created on the heap (and deleted in your destructor), rather than being declared on the stack; see the “MPEG2TransportUDPServerMediaSubsession.cpp” code for an example of how to do this.)
- Finally, your “RTPSink” object should be a “H264VideoRTPSink”, not a “H265VideoRTPSink”.
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
More information about the live-devel
mailing list