Skip to main content

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.


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://
$ cd python-librtmp
# pip install cffi
# python install


  • a compiler, e.g gcc
  • librtmp: The library including it’s headers (librtmp-dev). Only the official librtmp is supported, patched versions such as librtmp-ksv may not work.
  • cffi: The 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)


python-librtmp (and cffi) has wheel packages (binaries) available on PyPi and can therefore be easily installed with pip 1.4+ without the need to compile anything:

> pip install --use-wheel python-librtmp



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://", live=True)
# Attempt to connect
# Get a file-like object to access to the stream
stream = conn.create_stream()
# Read 1024 bytes of data
data =

Remote function calls

Here is a example of creating a Python function that can be used to call remote functions:

my_remote_method = conn.remote_method("MyRemoteMethod", block=True)
result = my_remote_method("some argument")

Waiting for the server to call our function:

# This will automatically name the function after it's Python name
def my_add(a, b):
    return a + b

# Start waiting for calls

You can also use custom function name instead:


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)


0.2.0 (2014-04-07)

  • RTMPError now inherits from IOError.
  • Fixed MSVC build.
  • Added to library paths, patch by Athanasios Oikonomou. (#4)
  • Added librtmp.dylib to library paths, patch by Will Donohoe. (#6)

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

Release history Release notifications

History Node


History Node


History Node


This version
History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
python_librtmp-0.2.0-cp27-none-win32.whl (34.1 kB) Copy SHA256 hash SHA256 Wheel 2.7 Apr 7, 2014
python_librtmp-0.2.0-cp33-none-win32.whl (34.2 kB) Copy SHA256 hash SHA256 Wheel 3.3 Apr 7, 2014
python_librtmp-0.2.0-cp34-none-win32.whl (34.4 kB) Copy SHA256 hash SHA256 Wheel 3.4 Apr 7, 2014
python-librtmp-0.2.0.tar.gz (24.0 kB) Copy SHA256 hash SHA256 Source None Apr 7, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page