Home

Awesome

pythumbio

License

Streaming webm transcoder plus previews, metadata, and jpg thumbnails in a convenient micro-service.

Quick Start

Running:

docker run --rm -it -p 8000:8000 ubergarm/pythumbio

Testing:

# apt-get install -y httpie || brew install httpie
http -v http://localhost:8000/meta?url=http://myvideo.com/name.mp4

Development:

docker run --rm -it -v `pwd`:/app --workdir=/app -p 8000:8000 --entrypoint=/bin/sh ubergarm/pythumbio
python3 server.py

Building:

docker build -t ubergarm/pythumbio .

Runtime Configuration

Environment VariableDescriptionDefault
PYTHUMBIO_PORTTCP/IP port number on which to listen8000
PYTHUMBIO_WORKERSHow many sanic worker threads2
PYTHUMBIO_CONCURRENCY_PER_WORKERHow many concurrent requests handled per sanic worker threads4
PYTHUMBIO_CHUNKSIZEStreaming HTTP Chunked Transfer Encoding size in bytes32 KiB

API

Endpoint: /version

Returns application/json output from ffmpeg -version

ArgumentDescriptionDefault
-n/an/a

Endpoint: /thumb

Returns image/jpeg thumbnail from a beginning of video

ArgumentDescriptionDefault
urlsource video urln/a

Endpoint: /webm

Returns video/webm stream

ArgumentDescriptionDefault
urlsource video urln/a

Endpoint: /preview

Returns video/webm stream animated gif style preview

ArgumentDescriptionDefault
urlsource video urln/a

Endpoint: /meta

Returns application/json stream of ffprobe metadata

ArgumentDescriptionDefault
urlsource video urln/a

Style Guide

Run

flake8 --max-line-length=120 server.py

TODO

Bugs

References