[FFmpeg-user] RTMP to RTP using SDP Information provided by Asterisk PBX
Sean Phelan
ffmpeg at 2hhg.uk
Sat Feb 8 10:45:48 EET 2025
>
> Hi All,
>
> I am a long time ffmpeg user but still consider myself somewhat of a novice and always learning new things.
>
> I have recently learned about phone calling which uses the SIP (Session Initiation Protocol) and SDP (Session Description Protocol) and have an application that I am stuck on.
>
> Specifically, we are using an Asterisk PBX (https://asterisk.org) and I want to send audio from a RTMP feed into a call via RTP.
>
> When I open a SIP call the Asterisk server gives me back this SDP which as I understand it is all the information needed to send the RTP (ports, IP address, codecs etc)
>
> v=0
> o=- 1674874032 1674874032 IN IP4 10.1.20.135
> s=Asterisk
> c=IN IP4 10.1.20.135
> t=0 0
> m=audio 17560 RTP/AVP 0 101
> a=rtpmap:0 PCMU/8000
> a=rtpmap:101 telephone-event/8000
> a=fmtp:101 0-16
> a=ptime:20
> a=maxptime:140
> a=sendrecv
>
> I am used to command lines in FFMPG and I am trying to get it set up correctly:
>
> ffmpeg -i rtmp://<my server> -vn -ar 8000 -codec:a pcm_mulaw -f rtp -payload_type 0 rtp://23.177.208.145:17560
>
> When I run the above command I see:
>
> SDP:
> v=0
> o=- 0 0 IN IP4 127.0.0.1
> s=No Name
> c=IN IP4 10.1.20.135
> t=0 0
> a=tool:libavformat 60.20.100
> m=audio 17560 RTP/AVP 0
> b=AS:128
>
> So clearly there is some type of a mismatch from what I need and what I am doing.
>
> We see the server receiving the data on port 17560 but it’s just sitting in the UDP queue, Asterisk is never pulling the data so I am thinking something is missing.
>
> Is there a way for me to “read in” a SDP file (I can write it to a local file prior to invoking ffmpeg) from ffmpeg so it will setup properly (destination, codecs, etc) as well as use my “RTMP” as the source input?
>
> Ideally I could just drop the SDP file on the filesystem, invoke FFMPEG with the SDP file + my input RTMP url and away it goes.
>
> Thanks for taking the time to read this.
>
> -Rob
Rob - you write "We see the server receiving the data on port 17560 but it’s just sitting in the UDP queue"..... is that definitely audio data in UDP datagrams? Or could it be IP datagrams that establish a TCP connection?
I can't see an explicit request for UDP in the SDP message, or in the ffmpeg command.
Having said that, like you, I still consider myself somewhat of a novice with ffmpeg and asterisk :)
cheers
Sean
More information about the ffmpeg-user
mailing list