Capturing Incoming RTMP Data?

So, I use HAproxy to redirect rtmp. (or forward…not sure which one describes what I am doing?)

Currently I send rtmp as such: rtmp://“serverIP”:1935/stream HAproxy handles this properly.

However, now I want to send rtmp://“serverIP”:1935/stream/“stream key”. The stream key can be a name or number. My Media Server does not actually use the stream key. However, I want to use it as an identifier of who is sending the rtmp. So in HAproxy, I want to take the “stream key” and shove it in a variable that the bash shell can read. Then I use this variable to construct a file name when I create an mp4 out of a live stream. I hope what I am wanting to do this makes sense?

Can this be done? Can HAproxy take the incoming rtmp and grab what comes after /stream/ and save it in a variable that a shell script can read?

Haproxy does not support RTMP. What you are doing is transparently forwarding arbitrary TCP data, which works fine, but you cannot access RTMP application data.

Well Ok.

But anyway, how can HAproxy take the incoming url and save anything after the /stream/ part of the URL?
?

Haproxy cannot “save” anything to disk, expect perhaps with a custom LUA script (which would be blocking the entire instance then). It’s a bad idea for this reasons, but this theory can only work with HTTP anyway.

I think he wants to put some part of the url in a string variable.

I wonder if it would be possible to use LUA to parse out RTMP/Stream key.