Vitaliy
Vitaliy

Reputation: 183

Simple RTMP Python client

I'm looking for a proper RTMP python client or Python code example that could do at least the following:

  1. Properly handshake with Flash server
  2. Send a properly encoded (AMF0 or AMF3) "connect" message to the server (and process the result)
  3. Send a properly encoded "subscribe" message (and process the result)

I've been investigating RTMPy, rtmplite, fmspy libraries, but haven't gotten anything to work yet. The AMF0 encoding capabilities from rtmplite seem good, though.

Can anyone point me in the right direction?

Upvotes: 9

Views: 16563

Answers (3)

Jatin Bansal
Jatin Bansal

Reputation: 1

try this:

import librtmp
conn=librtmp.RTMP(url)
conn.connect(None)
conn_stream=conn.create_stream(0,True)

for more information you can visit https://pypi.python.org/pypi/python-librtmp/0.2.0

Upvotes: 0

Vitaliy
Vitaliy

Reputation: 183

A minor update on this ... I've found a lib that might solve the problem: rtmp-python. rtmplite has been used as a Flash server for testing purposes...

from rtmp_python.rtmp_protocol import RtmpClient
cl = RtmpClient(ip="127.0.0.1", port=1935, tc_url='rtmp://localhost/myapp', page_url='', swf_url='', app='myapp')
cl.connect([])
cl.call(proc_name='createStream')
cl.call(proc_name='play', parameters=['user1'])
cl.handle_messages()

From the logs I saw that connection had established successfully, "createStream" call worked as well, but "play" didn't... TBC

Upvotes: 1

meson10
meson10

Reputation: 1954

Perhaps rtmplite could help you?

Upvotes: 2

Related Questions