Overview¶
Why Shaka Streamer?¶
Shaka Streamer is packaging and streaming made easy.
Simple, config-file-based application
No complicated command-lines
Sane defaults
Reusable configs
Runs on Linux, macOS, and Windows
Supports almost any input FFmpeg can ingest
Can push output automatically to Google Cloud Storage or Amazon S3
FFmpeg and Shaka Packager binaries provided
See also the more detailed list of Features below.
Getting started¶
Shaka Streamer requires Python 3.9+. Release versions of Shaka Streamer can
be installed or upgraded through pip3
with:
# To install/upgrade globally (drop the "sudo" for Windows):
sudo pip3 install --upgrade shaka-streamer shaka-streamer-binaries
# To install/upgrade per-user:
pip3 install --user --upgrade shaka-streamer shaka-streamer-binaries
The shaka-streamer-binaries
package contains Shaka Packager and FFmpeg
binaries, for your convenience. You may also choose to install these
dependencies separately and use shaka-streamer --use-system-binaries
instead
of the binary package.
To use Shaka Streamer, you need two YAML config files: one to describe the input, and one to describe the encoding pipeline. Sample configs can be found in the config_files/ folder. Sample inputs referenced there can be downloaded individually over HTTPS or all at once through gsutil:
gsutil -m cp gs://shaka-streamer-assets/sample-inputs/* .
Features¶
Supports:
VOD or live content
DASH and HLS output (or both at once)
VOD multi-period DASH (and equivalent HLS output)
Clear or encrypted output
Hardware encoding (if available from the platform)
Output to HTTP/HTTPS server or cloud storage provider (see Cloud Storage)
Lots of options for input
Transcode and package static input for VOD
Loop a file for simulated live streaming
Grab video from a webcam
Generate input from an arbitrary external command
Gives you control over details if you want it
Control DASH live stream attributes
Control output folders and file names
Add arbitrary FFmpeg filters for input or output
Known issues¶
We do support subtitles/captions (media_type
set to text
) for VOD
content. But please note that at this time, we have no way to pipeline text
for live streams, loop a single text input with input_type
of
looped_file
, transform text streams from one format to another, or cut a
snippet of text using the start_time
and end_time
fields of the input
config.
Multiple VAAPI devices are not yet supported on Linux. See issue #17.
Development¶
See Installing Prerequisites for detailed instructions on installing prerequisites and optional dependencies.
Running tests¶
We have end-to-end tests that will start streams and check them from a headless browser using Shaka Player. End-to-end tests can be run like so:
python3 run_end_to_end_tests.py
Technical details¶
Shaka Streamer connects FFmpeg and Shaka Packager in a pipeline, such that output from FFmpeg is piped directly into the packager, and packaging and transcoding of all resolutions, bitrates, and languages occur in parallel.
The overall pipeline is composed of several nodes. At a minimum, these are
TranscoderNode
(which runs FFmpeg) and PackagerNode
(which runs Shaka
Packager). They communicate via named pipes on Linux and macOS.
All input types are read directly by TranscoderNode
. If the input type is
looped_file
, then TranscoderNode
will add additional FFmpeg options to
loop that input file indefinitely.
If the -o
option is given with a Google Cloud Storage URL, then an
additional node called ProxyNode
is added after PackagerNode
. It runs a
local webserver which takes the output of packager and pushes to cloud storage.
The pipeline and the nodes in it are constructed by ControllerNode
based on
your config files. If you want to write your own front-end or interface
directly to the pipeline, you can create a ControllerNode
and call the
start()
, stop()
, and is_running()
methods on it. You can use
the shaka-streamer
script as an example of how to do this. See also
Module API.