[FFmpeg-devel] UDP Multicast

Andre Lopes andre.lopes at enear.co
Mon Mar 23 18:13:01 CET 2015


I was trying to setup a ffmpeg client to work with an Arecont camera in multicast and realized that the camera would only return a multicast stream after an RSTP call, if the SETUP was requested with the following transport:

Transport: RTP/AVP;multicast;client_port=xxxxx

Since the current implementation of the FFMpeg client is sending the transport  the values RTP/AVP/UDP;multicast and this was not being recognized by the camera, I have changed the FFMpeg code to send the required transport definition. This way the client started to receive a multicast stream from the camera.

The diff is the following:

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index c9ffba4..ecbfdf5 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1451,7 +1451,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,

         else if (lower_transport == RTSP_LOWER_TRANSPORT_UDP_MULTICAST) {
             snprintf(transport, sizeof(transport) - 1,
-                     "%s/UDP;multicast", trans_pref);
+                     "%s;multicast;client_port=%d-%d", trans_pref, rtsp_st->sdp_port, rtsp_st->sdp_port + 1);
         if (s->oformat) {
             av_strlcat(transport, ";mode=record", sizeof(transport));

Could this patch be included in the ffmpeg code?

Best regards,
André Lopes

More information about the ffmpeg-devel mailing list