Skip to main content

python-librtmp

http://img.shields.io/pypi/v/python-librtmp.svg?style=flat-square http://img.shields.io/pypi/dm/python-librtmp.svg?style=flat-square http://img.shields.io/travis/chrippa/python-librtmp.svg?style=flat-square

python-librtmp is a RTMP client library. It uses the implementation provided by librtmp via cffi.

Installation

The latest stable version is available to install using pip

sudo 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
sudo python setup.py install

Dependencies

  • Python, at least version 2.6 or 3.3.

  • a C compiler capapable of building Python extensions, e.g. gcc

  • librtmp: The library including its headers (librtmp-dev or equivalent)

  • cffi: cffi depends on libffi and its headers (libffi-dev or equivalent)

  • On Python <3.4 the backport of singledispatch is also required.

Windows

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 python-librtmp

(on older pip versions you need to use --use-wheel)
> pip install --use-wheel python-librtmp

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_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
@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.3.0 (2015-05-25)

  • Added update_buffer option (enabled by default) to RTMP.create_stream, which enables a hack to increase throughput.

  • Added a update_buffer method to RTMPStream.

  • We now require at least version 1.0.1 of cffi.

0.2.2 (2015-04-15)

  • Fixed proxy not being used by librtmp.

  • Added support for Cygwin, patch by @schrobby. (#17)

0.2.1 (2014-09-01)

  • Fixed expected bytes type on Python 2.

  • Fixed singledispatch dependency condition.

0.2.0 (2014-04-07)

  • RTMPError now inherits from IOError.

  • Fixed MSVC build.

  • Added librtmp.so.1 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.

Download files

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

Source Distribution

python-librtmp-0.3.0.tar.gz (24.4 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

python_librtmp-0.3.0-cp34-none-win32.whl (34.2 kB view details)

Uploaded CPython 3.4Windows x86

python_librtmp-0.3.0-cp33-none-win32.whl (34.3 kB view details)

Uploaded CPython 3.3Windows x86

python_librtmp-0.3.0-cp27-none-win32.whl (34.1 kB view details)

Uploaded CPython 2.7Windows x86

File details

Details for the file python-librtmp-0.3.0.tar.gz.

File metadata

File hashes

Hashes for python-librtmp-0.3.0.tar.gz
Algorithm Hash digest
SHA256 4a41ada646270baa5b388f17481d08679d23b2947835901d0db7602c59ec772b
MD5 f7afe8d463214072281998fa84553927
BLAKE2b-256 48a633b1a5864e22de3e59dd29fcbc2602462511c04a31057b16baec639d7d4f

See more details on using hashes here.

File details

Details for the file python_librtmp-0.3.0-cp34-none-win32.whl.

File metadata

File hashes

Hashes for python_librtmp-0.3.0-cp34-none-win32.whl
Algorithm Hash digest
SHA256 a72a848bf8d00665dfeaf3f10fdd2734c95b15b91a9ae13a62c9e9dc28c53ad7
MD5 31d094b4a22e68bbc5bcd1c413299431
BLAKE2b-256 6dcac21b60d97e972711cfc7f481e6812487ea78d150953e08c52680f5b2cf4b

See more details on using hashes here.

File details

Details for the file python_librtmp-0.3.0-cp33-none-win32.whl.

File metadata

File hashes

Hashes for python_librtmp-0.3.0-cp33-none-win32.whl
Algorithm Hash digest
SHA256 fe48acf4ea01eddf06e520ed9e1fc76abfd16dbaaf697874a950eb92042f56ff
MD5 2c41fee93993be844b92d20389b59388
BLAKE2b-256 b2e9518f571f6ced0a36a419bc161e6a6cd2f19ee733527b690cdb8524e1b3d2

See more details on using hashes here.

File details

Details for the file python_librtmp-0.3.0-cp27-none-win32.whl.

File metadata

File hashes

Hashes for python_librtmp-0.3.0-cp27-none-win32.whl
Algorithm Hash digest
SHA256 6d0f5c2a169b42a25b2c06c286114c92611853940567f8a361ed9c9d2b822133
MD5 2111aa49791baaeb835caff8a8aeb207
BLAKE2b-256 c199b3b9d8af52422e0c11727f5b3917cb1d37152a6c19fda9314b4ada44bb0e

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

4 files

0.2.2

4 files

0.2.1

4 files

0.2.0

4 files

0.1.2

3 files

0.1.1

1 file

0.1.0

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page