Have a favorite Twitch streamer? Do you wish you could watch their broadcasts offline on Linux? With tools like Livestreamer and YouTube-DL, you can save Twitch streams for later and watch them even if you’re offline.
You may want to save a Twitch live broadcast to your Linux PC while it’s still live. To do that, you’ll need the Livestreamer Linux tool. With it, it’s possible to record and save the broadcast as it’s going on directly to your Linux PC. Best of all, this software can capture the live stream and save as much of the content as you want, on-demand.
Livestreamer is an excellent piece of software for Linux. Unfortunately, it isn’t set up on mainstream operating systems by default. As a result, before we can go over how to use it, we must install it. Open up a terminal window and go through the commands below to learn how to get the app on your OS of choice.
sudo apt install livestreamer
sudo apt-get install livestreamer
sudo pacman -S livestreamer
The Livestreamer software is available in the primary software sources for Fedora 26, and the command below should install it. However, keep in mind 26 is an old version, and newer releases may not have access to this package. You may need to refer to the Generic Linux instructions to get it going.
sudo dnf install livestreamer
sudo zypper install livestreamer
Livestreamer is available for all Linux distributions thanks to Python Pip installation tool. Go through, install Python-Pip on your system. Then, use the Pip tool to get Livestreamer.
sudo pip install livestreamer
Save live Twitch broadcast with Livestreamer
Livestreamer is a brilliant application that sends any stream (including Twitch) directly to a video file. For this reason, it’s perfect for recording live Twitch broadcasts on Linux.
To use Livestreamer, open up a terminal. Then, go to your browser, and find the URL for the Twitch channel that you’d like to save a live stream from. Right-click on the URL and select the “copy” option.
With the URL copied, return to the terminal and write out the following command below. Be sure to paste the Twitch channel URL you copied in place of the example one in the article.
livestreamer https://www.twitch.tv/channelname -o best livestream.mp4
Or, to save a lower-quality version of the stream, do:
livestreamer https://www.twitch.tv/channelname -o worst livestream.mp4
When you’re satisfied with the length of the recording, close the Livestreamer app by pressing Ctrl + Z on the keyboard. Then, close the terminal and open up your Linux file manager.
In the file manager, find livestream.mp4 and right-click on it. Hover over “open with” and choose a video player that can handle the Mp4 file to play it back!
If you’re looking to save a Twitch broadcast that is no longer live, you won’t need to use the Livestreamer tool to get it. Instead, it’s possible to use the YouTube-DL tool to encode and save the broadcast for later.
YouTube-DL is an excellent tool that, despite its name, works with more than just YouTube. However, like the Livestreamer program, you won’t find YouTube-DL set up on your Linux PC by default. Instead, we must install it before continuing with this portion of the tutorial.
sudo apt install youtube-dl
sudo apt-get install youtube-dl
sudo pacman -S youtube-dl
sudo dnf install youtube-dl
sudo zypper install youtube-dl
Need to get the YouTube-DL app on your system? Can’t find it your OS’s primary software sources? No worries! YouTube-DL is available via PIP!
sudo pip install youtube-dl
Save Twitch broadcasts with YouTube-DL
Saving a Twitch video or stream for later works very well with YouTube-DL. It doesn’t require any unique options and works a lot like saving a YouTube video. To save a stream for later, open up a terminal and follow the steps below.
Step 1: Visit the Twitch channel page you’d like to save a video from. Once on the page, click the “videos” tab.
Step 2: Scroll through the video section and find a VOD (past broadcast). Then, right-click on the title of the video, and click “copy link location” or “copy link address.”
Step 3: Launch a terminal window, and use YouTube-DL to save the video for later. Be sure to change the example URL below with the one you copied from the web earlier.
youtube-dl https://www.twitch.tv/videos/1234567890 -v
Alternatively, if you’d like to save just the audio of a Twitch broadcast, run YouTube-DL, with the “x” command-line option.
youtube-dl https://www.twitch.tv/videos/1234567890 -x --audio-format mp3 -v
Step 4: When YouTube-DL finishes running, close the terminal and open up the Linux file manager. Navigate to “home” and find your Twitch video file. Right-click on the video file, and hover over the “open with” option.
In the “open with” menu, select a video player that can handle the MP4 (or MP3) Twitch file that YouTube-DL generated on your computer.