Skip to main content

MJPEG broadcaster

Project description

Live thumbnail using MJPEG and nginx_push_stream.

Usage

Compile Nginx with nginx_push_stream support. The example config also uses lua-nginx-module and lua-resty-redis to store and serve old snapshots from Redis, but this module is optional. The Nginx configuration should be something like this:

$ LUAJIT_LIB=/usr/local/lib/ LUAJIT_INC=/usr/local/include/luajit-2.0 ./configure --add-module=../nginx-push-stream-module --add-module=../lua-nginx-module --with-pcre --with-ipv6 --with-ld-opt=-L/usr/local/lib

Now run Nginx with sample config:

$ nginx -c $PWD/nginx.conf

Make a directory to store the thumbs

$ mkdir -p frames/parts

Start ffmpeg to create thumbs for a channel (parts in this example):

$ ffmpeg -re -i rtmp://example.com/live/stream -vf "scale=159:-1" -r 3 frames/parts/thumb%9d.jpg

Run the broadcaster:

$ python broadcaster.py

If you prefer, install the script using pip and run it:

$ pip install live_thumb
$ broadcaster

Watch the movie with the example html:

$ open test.html

Or go to http://localhost:9080/sub/parts directly.

To also store the snapshots on redis, you should run the broadcaster with an extra env variable:

$ REDIS_HOST="localhost" REDIS_PORT=7000 python broadcaster.py

The snapshots will be served from http://localhost:9080/snapshot/parts. You can also specify a timestamp: http://localhost:9080/snapshot/parts?timestamp=1396381230

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

live_thumb-0.1.8.tar.gz (4.6 kB view details)

Uploaded Source

File details

Details for the file live_thumb-0.1.8.tar.gz.

File metadata

  • Download URL: live_thumb-0.1.8.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for live_thumb-0.1.8.tar.gz
Algorithm Hash digest
SHA256 74e1c612abc33c4726b09e1e82f18cd0f56dd1bd8ced081febcab9e54962f030
MD5 c0e4536a1ba730d53b36436a54316268
BLAKE2b-256 77a0dd74b4f46d1d8277183266bb51373062ab12597690cdaf945a2140df7141

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page