STREAMLINK(1)

NAME
streamlink - extracts streams from various services and pipes them into a video player of choice

TUTORIAL

Streamlink is command-line application, this means the commands described here should be typed into a terminal. On Windows this means you should open the command prompt or PowerShell, on Mac OS X open the Terminal app and if you're on Linux or BSD you probably already know the drill.

The way Streamlink works is that it's only a means to extract and transport the streams, and the playback is done by an external video player. Streamlink works best with VLC or mpv, which are also cross-platform, but other players may be compatible too, see the Players page for a complete overview.

Now to get into actually using Streamlink, let's say you want to watch the stream located on http://twitch.tv/day9tv, you start off by telling Streamlink where to attempt to extract streams from. This is done by giving the URL to the command streamlink as the first argument:

$ streamlink twitch.tv/day9tv
[cli][info] Found matching plugin twitch for URL twitch.tv/day9tv
Available streams: audio, high, low, medium, mobile (worst), source (best)

NOTE: You don't need to include the protocol when dealing with HTTP URLs, e.g. just twitch.tv/day9tv is enough and quicker to type.

This command will tell Streamlink to attempt to extract streams from the URL specified, and if it's successful, print out a list of available streams to choose from.

In some cases (Supported streaming protocols) local files are supported using the file:// protocol, for example a local HLS playlist can be played. Relative file paths and absolute paths are supported. All path separators are /, even on Windows.

$ streamlink hlsvariant://file://C:/hls/playlist.m3u8
[cli][info] Found matching plugin stream for URL hlsvariant://file://C:/hls/playlist.m3u8
Available streams: 180p (worst), 272p, 408p, 554p, 818p, 1744p (best)

To select a stream and start playback, we simply add the stream name as a second argument to the streamlink command:

$ streamlink twitch.tv/day9tv source
[cli][info] Found matching plugin twitch for URL twitch.tv/day9tv
[cli][info] Opening stream: source (hls)
[cli][info] Starting player: vlc

The stream you chose should now be playing in the player. It's a common use case to just want start the highest quality stream and not be bothered with what it's named. To do this just specify best as the stream name and Streamlink will attempt to rank the streams and open the one of highest quality. You can also specify worst to get the lowest quality.

Now that you have a basic grasp of how Streamlink works, you may want to look into customizing it to your own needs, such as:

•   Creating a configuration file of options you want to use

•   Setting up your player to cache some data before playing the stream to help avoiding buffering issues

CONFIGURATION FILE

Writing the command-line options every time is inconvenient, that's why Streamlink is capable of reading options from a configuration file instead.

Streamlink will look for config files in different locations depending on your platform:
Platform | Location
Unix-like (POSIX) | $XDG_CONFIG_HOME/streamlink/config ~/.streamlinkrc
Windows | %APPDATA%\streamlink\streamlinkrc

NOTE: Currently the Windows installer does not create the streamlinkrc file. This is a known issue being tracked here. An example configuration file is available in the repo.

You can also specify the location yourself using the --config option.

NOTE:

•   $XDG_CONFIG_HOME is ~/.config if it has not been overridden

•   %APPDATA% is usually <your user directory>\Application Data

    NOTE: On Windows there is a default config created by the installer but on any other platform you must create the file yourself.

  Syntax

The config file is a simple text file and should contain one command-line option (omitting the dashes) per line in the format:

option=value

or for a option without value:

option

NOTE: Any quotes used will be part of the value, so only use when the value needs them, e.g. specifiying a player with a path containing spaces.

  Example

# Player options
player=mpv --cache 2048
player-no-close
# Authenticate with Twitch
twitch-oauth-token=mytoken

PLUGIN SPECIFIC CONFIGURATION FILE

You may want to use specific options for some plugins only. This can be accomplished by placing those settings inside a plugin specific config file. Options inside these config files will override the main config file when a URL matching the plugin is used.

Streamlink expects this config to be named like the main config but with .<plugin name> attached to the end.

  Examples
Platform | Location
Unix-like (POSIX) | $XDG_CONFIG_HOME/streamlink/config.twitch ~/.streamlinkrc.ustreamtv
Windows | %APPDATA%\streamlink\streamlinkrc.youtube

Have a look at the list of plugins to see the name of each built-in plugin.

PLUGIN SPECIFIC USAGE

  Authenticating with Twitch

It's possible to access subscription content on Twitch by giving Streamlink access to your account.

Authentication is done by creating an OAuth token that Streamlink will use to access your account. It's done like this:

$ streamlink --twitch-oauth-authenticate

This will open a web browser where Twitch will ask you if you want to give Streamlink permission to access your account, then forwards you to a page with further instructions on how to use it.

  Authenticating with Crunchyroll

Crunchyroll requires authenticating with a premium account to access some of their content. To do so, the plugin provides a couple of options to input your information, --crunchyroll-username and --crunchyroll-password.

You can login like this:

$ streamlink --crunchyroll-username=xxxx --crunchyroll-password=xxx http://crunchyroll.com/a-crunchyroll-episode-link

NOTE: If you omit the password, streamlink will ask for it.

Once logged in, the plugin makes sure to save the session credentials to avoid asking your username and password again.

Neverthless, these credentials are valid for a limited amount of time, so it might be a good idea to save your username and password in your configuration file anyway.

WARNING: The API this plugin uses isn't supposed to be available to use it on computers. The plugin tries to blend in as a valid device using custom headers and following the API usual flow (e.g. reusing credentials), but this does not assure that your account will be safe from being spotted for unusual behavior.

  HTTP proxy with Crunchyroll

You can use the --http-proxy and --https-proxy options (you need both since the plugin uses both protocols) to access the Crunchyroll servers through a proxy to be able to stream region locked content.

When doing this, it's very probable that you will get denied to access the stream; this occurs because the session and credentials used by the plugin where obtained when logged from your own region, and the server still assumes you're in that region.

For this, the plugin provides the --crunchyroll-purge-credentials option, which removes your saved session and credentials and tries to log in again using your username and password.

SIDELOADING PLUGINS

Streamlink will attempt to load standalone plugins from these directories:
Platform | Location
Unix-like (POSIX) | $XDG_CONFIG_HOME/streamlink/plugins
Windows | %APPDATA%\streamlink\plugins

NOTE: If a plugin is added with the same name as a built-in plugin then the added plugin will take precedence. This is useful if you want to upgrade plugins independently of the Streamlink version.

PLAYING BUILT-IN STREAMING PROTOCOLS DIRECTLY

There are many types of streaming protocols used by services today and Streamlink supports most of them. It's possible to tell Streamlink to access a streaming protocol directly instead of relying on a plugin to extract the streams from a URL for you.

A protocol can be accessed directly by specifying it in the URL format:

protocol://path [key=value]

Accessing a stream that requires extra parameters to be passed along (e.g. RTMP):

$ streamlink "rtmp://streaming.server.net/playpath live=1 swfVfy=http://server.net/flashplayer.swf"

When passing parameters to the built-in stream plugins the values will either be treated as plain strings, as is the case in the above example for swfVry, or they will be interpreted as Python literals. For example you can pass a Python dict or Python list as one of the parameters.

$ streamlink "rtmp://streaming.server.net/playpath conn=['B:1', 'S:authMe', 'O:1', 'NN:code:1.23', 'NS:flag:ok', 'O:0']"
$ streamlink "hls://streaming.server.net/playpath params={'token': 'magicToken'}"

In the above examples conn will be passed as the Python list:

['B:1', 'S:authMe', 'O:1', 'NN:code:1.23', 'NS:flag:ok', 'O:0']

and params will be passed as the Python dict:

{'token': 'magicToken'}

Most streaming technologies simply requires you to pass a HTTP URL, this is a Adobe HDS stream:

$ streamlink hds://streaming.server.net/playpath/manifest.f4m

  Supported streaming protocols
Name | Prefix
Adobe HTTP Dynamic Streaming | hds://
Akamai HD Adaptive Streaming | akamaihd://
Apple HTTP Live Streaming | hls:// hlsvariant:// [1]
Real Time Messaging Protocol | rtmp:// rtmpe:// rtmps:// rtmpt:// rtmpte://
Progressive HTTP, HTTPS, etc | httpstream:// [1]

[1] supports local files using the file:// protocol

COMMAND-LINE USAGE

$ streamlink [OPTIONS] <URL> [STREAM]

  Positional arguments

URL A URL to attempt to extract streams from.

    If it's a HTTP URL then "http://" can be omitted.

STREAM
    Stream to play.

    Use "best" or "worst" for highest or lowest quality available.

    Fallback streams can be specified by using a comma-separated list:

    "720p,480p,best"

    If no stream is specified and --default-stream is not used then a list of available streams will be printed.

  General options

-h, --help
    Show this help message and exit.

-V, --version
    Show version number and exit.

--plugins
    Print a list of all currently installed plugins.

--can-handle-url URL
    Check if Streamlink has a plugin that can handle the specified URL.

    Returns status code 1 for false and 0 for true.

    Useful for external scripting.

--can-handle-url-no-redirect URL
    Same as --can-handle-url but without following redirects when looking up the URL.

--config FILENAME
    Load options from this config file.

    Can be repeated to load multiple files, in which case the options are merged on top of each other where the last config has highest priority.

-l LEVEL, --loglevel LEVEL
    Set the log message threshold.

    Valid levels are: none, error, warning, info, debug

-Q, --quiet
    Hide all log output.

    Alias for "--loglevel none".

-j, --json
    Output JSON representations instead of the normal text output.

    Useful for external scripting.

--auto-version-check {yes,true,1,on,no,false,0,off}
    Enable or disable the automatic check for a new version of Streamlink.

    Default is no

--version-check
    Runs a version check and exits.

--locale LOCALE
    The preferred locale setting, for selecting the preferred subtitle and audio language.

The locale is formatted as [language_code]_[country_code],
    eg. eg. en_US or es_ES

    Default is: system locale.

  Player options

-p COMMAND, --player COMMAND
    Player to feed stream data to. This is a shell-like syntax to support passing options to the player. For example:

    "vlc --file-caching=5000"

    To use a player that is located in a path with spaces you must quote the path:

    "'/path/with spaces/vlc' --file-caching=5000"

    By default VLC will be used if it can be found in its default location.

-a ARGUMENTS, --player-args ARGUMENTS
    This option allows you to customize the default arguments which are put together with the value of --player to create a command to execute.

    This value can contain formatting variables surrounded by curly braces, { and }. If you need to include a brace character, it can be escaped by doubling, e.g. {{ and }}.

    Formatting variables available:

filename
    This is the filename that the player will use. It's usually "-" (stdin), but can also be a URL or a file depending on the options used.

    It's usually enough to use --player instead of this unless you need to add arguments after the filename.

    Default is: "{filename}".

-v, --verbose-player
    Allow the player to display its console output.

-n, --player-fifo, --fifo
    Make the player read the stream through a named pipe instead of the stdin pipe.

--player-http
    Make the player read the stream through HTTP instead of the stdin pipe.

--player-continuous-http
    Make the player read the stream through HTTP, but unlike --player-http it will continuously try to open the stream if the player requests it.

    This makes it possible to handle stream disconnects if your player is capable of reconnecting to a HTTP stream. This is usually done by setting your player to a "repeat mode".

--player-external-http
    Serve stream data through HTTP without running any player. This is useful to allow external devices like smartphones or streaming boxes to watch streams they wouldn't be able to otherwise.

    Behavior will be similar to the continuous HTTP option, but no player program will be started, and the server will listen on all available connections instead of just in the local (loopback) interface.

    The URLs that can be used to access the stream will be printed to the console, and the server can be interrupted using CTRL-C.

--player-external-http-port PORT
    A fixed port to use for the external HTTP server if that mode is enabled. Omit or set to 0 to use a random high (>1024) port.

--player-passthrough TYPES
    A comma-delimited list of stream types to pass to the player as a URL to let it handle the transport of the stream instead.

    Stream types that can be converted into a playable URL are:

•   hls

•   http

•   rtmp

    Make sure your player can handle the stream type when using this.

--player-no-close
    By default Streamlink will close the player when the stream ends. This is to avoid "dead" GUI players lingering after a stream ends.

    It does however have the side-effect of sometimes closing a player before it has played back all of its cached data.

    This option will instead let the player decide when to exit.

  File output options

-o FILENAME, --output FILENAME
    Write stream data to FILENAME instead of playing it.

    You will be prompted if the file already exists.

-f, --force
    When using -o, always write to file even if it already exists.

-O, --stdout
    Write stream data to stdout instead of playing it.

  Stream options

--default-stream STREAM
    Open this stream when no stream argument is specified, e.g. "best".

--retry-streams DELAY
    Will retry fetching streams until streams are found while waiting DELAY (seconds) between each attempt.

--retry-open ATTEMPTS
    Will try ATTEMPTS times to open the stream until giving up.

    Default is: 1.

--stream-types TYPES, --stream-priority TYPES
    A comma-delimited list of stream types to allow.

    The order will be used to separate streams when there are multiple streams with the same name but different stream types.

    Default is: "rtmp,hls,hds,http,akamaihd".

--stream-sorting-excludes STREAMS
    Fine tune best/worst synonyms by excluding unwanted streams.

    Uses a filter expression in the format:

    [operator]<value>

    Valid operators are >, >=, < and <=. If no operator is specified then equality is tested.

    For example this will exclude streams ranked higher than "480p":

    ">480p"

    Multiple filters can be used by separating each expression with a comma.

    For example this will exclude streams from two quality types:

    ">480p,>medium"

  Stream transport options

--hds-live-edge SECONDS
    The time live HDS streams will start from the edge of stream.

    Default is: 10.0.

--hds-segment-attempts ATTEMPTS
    How many attempts should be done to download each HDS segment before giving up.

    Default is: 3.

--hds-segment-threads THREADS
    The size of the thread pool used to download HDS segments. Minimum value is 1 and maximum is 10.

    Default is: 1.

--hds-segment-timeout TIMEOUT
    HDS segment connect and read timeout.

    Default is: 10.0.

--hds-timeout TIMEOUT
    Timeout for reading data from HDS streams.

    Default is: 60.0.

--hls-live-edge SEGMENTS
    How many segments from the end to start live HLS streams on.

    The lower the value the lower latency from the source you will be, but also increases the chance of buffering.

    Default is: 3.

--hls-segment-attempts ATTEMPTS
    How many attempts should be done to download each HLS segment before giving up.

    Default is: 3.

--hls-playlist-reload-attempts ATTEMPTS
    How many attempts should be done to reload the HLS playlist before giving up.

    Default is: 3.

--hls-segment-threads THREADS
    The size of the thread pool used to download HLS segments. Minimum value is 1 and maximum is 10.

    Default is: 1.

--hls-segment-timeout TIMEOUT
    HLS segment connect and read timeout.

    Default is: 10.0.

--hls-timeout TIMEOUT
    Timeout for reading data from HLS streams.

    Default is: 60.0.

--hls-audio-select CODE
    Selects a specific audio source, by language code, when multiple audio sources are available.

    Note: This is only useful in special circumstances where the regular locale option fails.

--http-stream-timeout TIMEOUT
    Timeout for reading data from HTTP streams.

    Default is: 60.0.

--ringbuffer-size SIZE
    The maximum size of ringbuffer. Add a M or K suffix to specify mega or kilo bytes instead of bytes.

    The ringbuffer is used as a temporary storage between the stream and the player. This is to allows us to download the stream faster than the player wants to read it.

    The smaller the size, the higher chance of the player buffering if there are download speed dips and the higher size the more data we can use as a storage to catch up from speed dips.

    It also allows you to temporary pause as long as the ringbuffer doesn't get full since we continue to download the stream in the background.

    NOTE: A smaller size is recommended on lower end systems (such as Raspberry Pi) when playing stream types that require some extra processing (such as HDS) to avoid unnecessary background processing.

    Default is: "16M".

--rtmp-proxy PROXY, --rtmpdump-proxy PROXY
    A SOCKS proxy that RTMP streams will use.

    Example: 127.0.0.1:9050

--rtmp-rtmpdump FILENAME, --rtmpdump FILENAME, -r FILENAME
    RTMPDump is used to access RTMP streams. You can specify the location of the rtmpdump executable if it is not in your PATH.

    Example: "/usr/local/bin/rtmpdump"

--rtmp-timeout TIMEOUT
    Timeout for reading data from RTMP streams.

    Default is: 60.0.

--stream-segment-attempts ATTEMPTS
    How many attempts should be done to download each segment before giving up.

    This is generic option used by streams not covered by other options, such as stream protocols specific to plugins, e.g. UStream.

    Default is: 3.

--stream-segment-threads THREADS
    The size of the thread pool used to download segments. Minimum value is 1 and maximum is 10.

    This is generic option used by streams not covered by other options, such as stream protocols specific to plugins, e.g. UStream.

    Default is: 1.

--stream-segment-timeout TIMEOUT
    Segment connect and read timeout.

    This is generic option used by streams not covered by other options, such as stream protocols specific to plugins, e.g. UStream.

    Default is: 10.0.

--stream-timeout TIMEOUT
    Timeout for reading data from streams.

    This is generic option used by streams not covered by other options, such as stream protocols specific to plugins, e.g. UStream. Default is: 60.0.

--stream-url
    If possible, translate the stream to a URL and print it.

--subprocess-cmdline, --cmdline, -c
    Print command-line used internally to play stream.

    This is only available on RTMP streams.

--subprocess-errorlog, --errorlog, -e
    Log possible errors from internal subprocesses to a temporary file. The file will be saved in your systems temporary directory.

    Useful when debugging rtmpdump related issues.

--subprocess-errorlog-path PATH, --errorlog-path PATH
    Log the subprocess errorlog to a specific file rather than a temporary file. Takes precedence over subprocess-errorlog.

    Useful when debugging rtmpdump related issues.

--ffmpeg-ffmpeg FILENAME
    FFMPEG is used to access mux separate video and audio streams. You can specify the location of the ffmpeg executable if it is not in your PATH.

    Example: "/usr/local/bin/ffmpeg"

--ffmpeg-verbose
    Write the console output from ffmpeg to the console

--ffmpeg-verbose-path PATH
    Path to write the output from the ffmpeg console

--ffmpeg-video-transcode CODEC
    When muxing streams transcode the video to this CODEC, defaults to copy (no transcode)

    Example: "h264"

--ffmpeg-audio-transcode CODEC
    When muxing streams transcode the audio to this CODEC, defaults to copy (no transcode)

    Example: "aac"

  HTTP options

--http-proxy HTTP_PROXY
    A HTTP proxy to use for all HTTP requests.

    Example: http://hostname:port/

--https-proxy HTTPS_PROXY
    A HTTPS capable proxy to use for all HTTPS requests.

    Example: http://hostname:port/

--http-cookie KEY=VALUE
    A cookie to add to each HTTP request.

    Can be repeated to add multiple cookies.

--http-header KEY=VALUE
    A header to add to each HTTP request.

    Can be repeated to add multiple headers.

--http-query-param KEY=VALUE
    A query parameter to add to each HTTP request.

    Can be repeated to add multiple query parameters.

--http-ignore-env
    Ignore HTTP settings set in the environment such as environment variables (HTTP_PROXY, etc) or ~/.netrc authentication.

--http-no-ssl-verify
    Don't attempt to verify SSL certificates.

    Usually a bad idea, only use this if you know what you're doing.

--http-disable-dh
    Disable Diffie Hellman key exchange

    Usually a bad idea, only use this if you know what you're doing.

--http-ssl-cert FILENAME
    SSL certificate to use.

    Expects a .pem file.

--http-ssl-cert-crt-key CRT_FILENAME KEY_FILENAME
    SSL certificate to use.

    Expects a .crt and a .key file.

--http-timeout TIMEOUT
    General timeout used by all HTTP requests except the ones covered by other options.

    Default is: 20.0.

  Plugin options

--plugin-dirs DIRECTORY
    Attempts to load plugins from these directories.

    Multiple directories can be used by separating them with a semi-colon.

--twitch-oauth-token TOKEN
    An OAuth token to use for Twitch authentication. Use --twitch-oauth-authenticate to create a token.

--twitch-oauth-authenticate
    Open a web browser where you can grant Streamlink access to your Twitch account which creates a token for use with --twitch-oauth-token.

--twitch-cookie COOKIES
    Twitch cookies to authenticate to allow access to subscription channels.

    Example:

    "_twitch_session_id=xxxxxx; persistent=xxxxx"

    NOTE: This method is the old and clunky way of authenticating with Twitch, using --twitch-oauth-authenticate is the recommended and simpler way of doing it now.

--twitch-disable-hosting
    Do not open the stream if the target channel is hosting another channel.

--ustream-password PASSWORD
    A password to access password protected UStream.tv channels.

--crunchyroll-username USERNAME
    A Crunchyroll username to allow access to restricted streams.

--crunchyroll-password [PASSWORD]
    A Crunchyroll password for use with --crunchyroll-username.

    If left blank you will be prompted.

--crunchyroll-purge-credentials
    Purge cached Crunchyroll credentials to initiate a new session and reauthenticate.

--crunchyroll-session-id SESSION_ID
    Set a specific session ID for crunchyroll, can be used to bypass region restrictions

--btv-username USERNAME
    A BTV username required to access any stream.

--btv-password PASSWORD
    A BTV account password to use with --btv-username.

--schoolism-email EMAIL
    The email associated with your Schoolism account, required to access any Schoolism stream.

--schoolism-password PASSWORD
    A Schoolism account password to use with --schoolism-email.

--schoolism-part PART
    Play part number PART of the lesson

    Defaults is 1

--daisuki-mux-subtitles
    Automatically mux available subtitles in to the output stream

--rtve-mux-subtitles
    Automatically mux available subtitles in to the output stream

--funimation-language
    The audio language to use for Funimation streams; japanese or english

    Default is english

--funimation-mux-subtitles
    Enable automatically including available subtitles in to the output stream

--tvplayer-email EMAIL
    The email address used to register with tvplayer.com.

--tvplayer-password PASSWORD
    A TVPlayer account password to use with --tvplayer-email.

--pluzz-mux-subtitles
    Automatically mux available subtitles in to the output stream

--wwenetwork-email EMAIL
    The email associated with your WWE Network account, required to access any WWE Network stream.

--wwenetwork-password PASSWORD
    A WWE Network account password to use with --wwenetwork-email.

--animelab-email EMAIL
    The email address used to register with animelab.com.

--animelab-password PASSWORD
    A TVPlayer account password to use with --animelab-email.

--npo-subtitles
    Include subtitles for the deaf or hard of hearing, if available

AUTHOR
Streamlink Contributors

COPYRIGHT
2017, Streamlink