Python bindings for librtmp, built with cffi
Project description
python-librtmp is a Python interface to librtmp. It uses cffi to interface with the C library librtmp.
Free software: BSD license
Documentation: http://pythonhosted.org/python-librtmp
Installation
The latest stable version is available to install using pip:
# pip install cffi
# pip install python-librtmp
But you can also get the development version using Git:
$ git clone git://github.com/chrippa/python-librtmp.git
$ cd python-librtmp
# pip install cffi
# python setup.py install
Dependencies
a compiler, e.g gcc
librtmp: The library including it’s headers (librtmp-dev)
cffi: The setup.py script currently depends on cffi being installed. Therefore you need to install it before installing this library. cffi also depends on libffi and it’s headers (libffi-dev)
Features
Streaming
The most common use case of RTMP is to read a video stream from a server.
import librtmp
# Create a connection
conn = librtmp.RTMP("rtmp://your.server.net/app/playpath", live=True)
# Attempt to connect
conn.connect()
# Get a file-like object to access to the stream
stream = conn.create_stream()
# Read 1024 bytes of data
data = stream.read(1024)
Remote function calls
Here is a example of creating a Python function that can be used to call remote functions:
my_remote_function = conn.remote_function("MyRemoteMethod", block=True)
result = my_remote_function("some argument")
Waiting for the server to call our function:
# This will automatically name the function after it's Python name
@conn.invoke_handler
def my_add(a, b):
return a + b
# Start waiting for calls
conn.process_packets()
You can also use custom function name instead:
@conn.invoke_handler("MyMath.MyAdd")
Instead of blocking forever when waiting for a call you can specify to wait only for a specific invoke and then stop blocking:
conn.process_packets(invoked_method="MyMath.MyAdd", timeout=30)
History
0.1.2 (2013-10-08)
Fixed compilation issue on some platforms.
Fixed AMF issue on older librtmp versions. (#1)
0.1.1 (2013-09-25)
Fixed packaging issues.
0.1.0 (2013-09-23)
First release on PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for python_librtmp-0.1.2-cp33-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4150b4f51412f5aae4643727d36970ad8d522c1e9e7fc44a2c189826a9ce0fa0 |
|
MD5 | 00e231161d86b809c72822e221c05b59 |
|
BLAKE2b-256 | 40bd524e7532f45ec4cdbf4402c195724b73109c0eb710273e699e0aad19ceed |
Hashes for python_librtmp-0.1.2-cp27-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68b5b61f8c6ffe0a23ef8a24a860af0f810e1f36def53d605451499d2d5b56d4 |
|
MD5 | 93d00e27cfe2539c9f272da16a7c2a69 |
|
BLAKE2b-256 | d6ac170ce19ab3f19cc5fce6e28f6caa3804787cf5c2d6397aeae20966d26347 |