5 ways to download a Twitter video
We are regularly asked how a video can be downloaded from Twitter. Unlike platforms such as Facebook and Instagram, downloading a video on Twitter is a bit more difficult. This has to do with the fact that videos on Twitter are loaded in a different way. In this blog post, we’ll explain five different ways you can download a video from Twitter.
Twitter video file extensions
In order to download videos from Twitter, it is important to know the filetype of a video on Twitter and how the video is loaded on Twitter. We will show you how to find out how the video is played on Twitter using the video below (https://twitter.com/fdavw/status/1294732687857655810/).
If you watch the above video on Twitter, unfortunately you do not have the option to save the video with your right mouse button and the option “Save video as …“. Also if you want to find the link to the video via “Inspect element“, or if you look up the video in the source code, you will not be successful. This is because videos are loaded different on Twitter. We will explain exactly how below.
To find out how videos are played on Twitter, navigate to the respective video you wish to save. Open your Browser developer tools via F12 and click on the “Network” tab. Once you’ve done this, refresh the page to view all requests from your web browser. Then click on the “Media” tab, after which you will see the requests below.
In the image above, you can see that your web browser has sent seven requests to the domain video.twimg.com. You will also see that there are two different file types, a “.m3u8” extension and a “.ts” extension. The M3U8 extension is a file format for multimedia playlists. It is text file that contains information about the location of one or more media files. The extension TS is an abbreviation for “MPEG Transport Stream” and is a file format for the transmission and storage of audio and video files
Have a close look at a m3u8 file
To open the .m3u8 file, right-click on “video.twimg.com” and click “Copy” to copy the URL. Open a new tab and paste the copied URL*. You can now try to open the file with a media player, which will most likely not work. Instead, you can save and view the file with a text editor like “Notepad” (your default Windows notepad) or “Notepad ++“. When you open the file, you will see that the text file referers to other .TS files.
* You can also double click to open the file directly.
The image above is a screenshot of a part of the downloaded text file. If you look at the contents of the full text file, you will see that there is a link to a .TS file 23 times. These links are 22 times “3.000” and once “2.013“. These numbers represent the duration of the .TS file in seconds and the number of seconds added together results in 68 seconds. This is exactly the duration of the video in seconds. Apparently the .TS files are a sort of cutted videos which form a complete video once they are put together.
How to view a TS file
If you want to open a .TS file, you can do so by copying the URL of the file again or by double clicking the “video.twimg.com” with your left mouse. You will probably find that you can play the file with your Media Player, but the video will only have a duration of three seconds. After all, as we have already seen in the .M3U8 file, the .TS files only last three seconds. So in order to save the entire video, you could save all .TS files individually and then play them seperately or stitch them together*. This is not very practical, so below we explain five different ways to download Twitter videos.
* Make sure to load all .TS files via the browser developer tools first.
Method #1: use youtube-dl
Our favorite tool to download videos from Twitter (and YouTube) is youtube-dl. With this open source* commandline tool downloading videos from various platforms like Twitter and YouTube is fast and easy. Youtube-dl requires the installation of Python, is maintained on Github and can be used in both Windows and Mac OS X environments.
* Because the program is “open source” you can view the source code of the program yourself. The advantage of this is that you have control over what you are doing. After all, you know exactly what the program does and does not do and what happens with your data.
Step 1: install Python & PIP
Before downloading youtube-dl, we recommend you to install Python and PIP . Please have a look at our previous blogpost to learn how to install Python. PIP, included in the Python installation, is needed to install and manage Python packages. Check whether Python and PIP are installed using the commands below in your Windows command prompt (CMD). If you get an error, please go through the steps from our earlier blog post again.
Step 2: download youtube-dl
Youtube-dl is not included by default in Python, so you must install this program before you can use the program. To install the youtube-dl program via PIP in your Windows command prompt (CMD):
pip install youtube-dl
Step 3: download a video with youtube-dl
To download a video, run the command below. The video will be automatically saved into the user’s folder on the computer.
Step 4: all set! Just play the video
Open the folder where the video is saved and you will see that the video has been automatically converted to a .mp4 file . You can easily play this file via your standard media player.
Method #2: use VLC Mediaplayer
Another way to download videos from Twitter (and YouTube) is through the program VLC Mediaplayer . With this program you can open network streams and automatically convert these streams to MP4 files. You can find out how to do this below.
Step 1: download VLC Mediaplayer
Download VLC Mediaplayer via https://www.videolan.org/vlc/index.nl.html.
Step 2: convert the video
Open VLC Mediaplayer and click “Convert/save as…” below the “Media” tab.
Click on the “Network” tab and fill in the URL of the video on Twitter. Click on “Convert/save“.
Next, make sure to check “Profile” “(MP4) ” and select the location where you want to save the video. Then click on “Start” to convert the video and wait.
Step 3: There you go! Just play the video
The video has now been converted and saved in the location you designated. You can now play the video with your Mediaplayer.
Method #3: use FFMPEG
The program FFMPEG actually is indispensable if you work with videos a lot. For example, please check out nixintel’s blogpost about extracting frames and audio files from videos. Please read on to see how to use FFMPEG to download a video on Twitter.
Step 1: download FFMPEG
Typ in the following commands to download FFMPEG via PIP.
pip install ffmpeg
To check if FFMPEG has been installed successfully, simply type “ffmpeg” in your command prompt. Are you getting an error message? Then we advise you to read this tutorial about installing FFMPEG.
Step 2: download a video
To download a video via FFMPEG, enter the following command in your Windows command prompt (CMD). Make sure that you enter the .m3u8 link and that you can give a name to the video yourself. In our case, the video is just called “video“.
ffmpeg -i https://video.twimg.com/ext_tw_video/1294732618374811650/pu/pl/490x270/8BWd_nuHKWqg-px7.m3u8 video.mp4
Step 3: Let’s go! Play the video
The FFMPEG program will download the video in MP4 file format. The file is automatically saved in the current user’s folder on the computer. You can play this file with your Mediaplayer.
Method #4: use a third party website
Why make it difficult when it can be done easily? After all, there are many websites that allow downloading videos on platforms such as Twitter. A website such as http://twittervideodownloader.com/ is a good example. Just fill in the video URL and click on “Download” to download the video.
Method #5: use a browse extension
There are various browser extensions developed which extensions can be used to download Twitter videos. Examples of browser extensions are Video Downloader Plus (thanks for the tip Serge Courrier!) and Twitter Media Downloader. You just need to install these extensions and then you can easily download videos on Twitter.
Warning! Please be careful
We strongly advise you to carefully consider whether the use of a tool, website or extension is desired. If you cannot check whether your privacy and safety is being infringed, then you can assume that (at least some) data will be collected about you.
This blog post is only for the purpose of giving you various options for downloading videos on Twitter. For that reason, Aware Online is not liable for the use of the aforementioned tools, websites and extensions.
Want to know more about investigating Twitter?
Would you like to learn more about how to conduct investigations on Twitter? Or how to save videos on other platforms? Or do you have any additions to this article? Please contact us.