[Libav-user] RTMP Server

Chen Fisher chen.fisher at gmail.com
Thu Mar 24 16:43:39 CET 2016

I'm trying to implement a simple RTMP Server.

What I've tried so far is using avformat_open_input with an option of
rtmp_listen. When I receive a new stream I create a new thread to handle
that stream and immediately call avformat_open_input again with rtmp_listen.

While this works pretty good, I can't seem to find a way to get the RTMP
app/stream name. When I'm using avformat_open_input I'm specifying a
general rtmp url without app name details (i.e rtmp:// but the
client is publishing to a well defined name like

How can I get the app and stream name?
Is there a way to get a handle of the underlaying RTMPContext?

Alternatively, is there a way to get RTMP AMF messages via a callback?

Another way I though of was to bind and accept connections on a socket,
figure out the app name and then pass the socket/stream to
avformat_open_input with custom AVIOContext, but it seems I would have to
implement the RMTP server side handshake, which I prefer not to.

In short, how would you go about implementing a process that dynamically
receives rtmp streams and handles each one in a separate thread?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160324/4df019fd/attachment.html>

More information about the Libav-user mailing list