Streamlink Commands (with examples)

Streamlink Commands (with examples)

Extract streams from a URL

To extract streams from a specified URL and view a list of available streams, use the following command:

streamlink example.com/stream

Motivation: This command allows you to extract streams from various services, such as video streaming platforms, and view the available options. This is useful when you want to select a specific stream to watch or analyze.

Explanation:

  • streamlink: The command to run the Streamlink tool.
  • example.com/stream: The URL of the stream you want to extract.

Example Output:

Available streams:
  - 720p (best)
  - 480p
  - 360p
  - 240p (worst)

Open a stream with specified quality

To open a stream with a specific quality, use the following command:

streamlink example.com/stream 720p60

Motivation: This command allows you to directly open a stream with the desired quality. If the stream supports the specified quality, it will be played in that quality.

Explanation:

  • streamlink: The command to run the Streamlink tool.
  • example.com/stream: The URL of the stream you want to open.
  • 720p60: The desired quality of the stream. In this example, we specified “720p60”, which represents 720p resolution with a 60 fps (frames per second) refresh rate.

Example Output: The stream will be opened in the specified quality in a video player.

Select the highest or lowest available quality

To select the highest or lowest available quality for a stream, use the following command:

streamlink example.com/stream best

or

streamlink example.com/stream worst

Motivation: Sometimes, it is not necessary to specify a specific quality. You may want to select the best or worst available quality based on your preference or the capabilities of your device.

Explanation:

  • streamlink: The command to run the Streamlink tool.
  • example.com/stream: The URL of the stream you want to open.
  • best or worst: The keyword representing the highest or lowest available quality, respectively.

Example Output: The stream will be opened in the selected quality in a video player.

Specify the player

To specify which player to use for streaming, use the following command:

streamlink --player=mpv example.com/stream best

Motivation: By default, Streamlink uses VLC as the video player. However, if you prefer using a different player, such as “mpv,” you can specify it using this command.

Explanation:

  • streamlink: The command to run the Streamlink tool.
  • --player=mpv: Specifies the player to use. In this example, we specify “mpv” as the player.
  • example.com/stream: The URL of the stream you want to open.
  • best: The desired quality of the stream.

Example Output: The stream will be opened in the specified quality using the specified player.

Specify the start offset of the stream

To specify the amount of time to skip from the beginning of the stream, use the following command:

streamlink --hls-start-offset [HH:]MM:SS example.com/stream best

Motivation: This command allows you to skip a certain amount of time from the beginning of the stream. It is particularly useful when you want to start watching a stream from a specific point or skip commercial breaks.

Explanation:

  • streamlink: The command to run the Streamlink tool.
  • --hls-start-offset: Specifies the start offset of the stream.
  • [HH:]MM:SS: The time duration to skip from the beginning of the stream. You can specify the offset in hours, minutes, and seconds format.
  • example.com/stream: The URL of the stream you want to open.
  • best: The desired quality of the stream.

Example Output: The stream will be opened at the specified start offset in a video player.

Skip to the beginning or restart a live stream

To skip to the beginning of a live stream or restart a live stream from the current position, use the following command:

streamlink --hls-live-restart example.com/stream best

Motivation: This command is useful when you want to start watching a live stream from the beginning or when you experience buffering issues and want to restart the stream.

Explanation:

  • streamlink: The command to run the Streamlink tool.
  • --hls-live-restart: Specifies the action of skipping to the beginning or restarting a live stream.
  • example.com/stream: The URL of the live stream you want to open.
  • best: The desired quality of the stream.

Example Output: The live stream will either start from the beginning or restart from the current position, depending on the stream’s availability.

Write stream data to a file

To write stream data to a file rather than playing it, use the following command:

streamlink --output path/to/file.ts example.com/stream best

Motivation: This command allows you to save the stream data to a file for future playback or analysis. It is particularly useful when you want to archive a stream or perform offline analysis.

Explanation:

  • streamlink: The command to run the Streamlink tool.
  • --output path/to/file.ts: Specifies the location and name of the output file. In this example, we specify “path/to/file.ts” as the file path.
  • example.com/stream: The URL of the stream you want to open.
  • best: The desired quality of the stream.

Example Output: The stream data will be saved to the specified file path.

Open the stream and write it to a file simultaneously

To open the stream in the player and simultaneously write it to a file, use the following command:

streamlink --record path/to/file.ts example.com/stream best

Motivation: This command allows you to watch the stream while saving it to a file. It is useful when you want to both watch and record a stream for later use.

Explanation:

  • streamlink: The command to run the Streamlink tool.
  • --record path/to/file.ts: Specifies the location and name of the output file. In this example, we specify “path/to/file.ts” as the file path.
  • example.com/stream: The URL of the stream you want to open.
  • best: The desired quality of the stream.

Example Output: The stream will be played in the video player while simultaneously being saved to the specified file path.

Related Posts

How to use the command 'dvc config' (with examples)

How to use the command 'dvc config' (with examples)

The ‘dvc config’ command is a low level command used to manage custom configuration options for DVC repositories.

Read More
How to use the command 'sox' (with examples)

How to use the command 'sox' (with examples)

The command sox stands for Sound eXchange. It is a versatile command-line tool that allows you to play, record, and convert audio files.

Read More
How to use the command xpdf (with examples)

How to use the command xpdf (with examples)

The xpdf command is a portable document format (PDF) file viewer that allows users to open and view PDF files.

Read More