How to Download YouTube, Facebook, Twitter Videos Easily

There are plenty of free online portals that help you download YouTube, Facebook, and Twitter embedded videos. These portals process the inputted video URL and make multiple resolutions of the video available for download.

However, if you want to avoid the online video download portals and wish to download YouTube, Facebook, and Twitter videos from your computer directly (without an intermediary), this post is for you.

Download YouTube, Facebook, or Twitter Videos Directly

Youtube-dl.exe is an open-source command-line program that helps you download videos from YouTube, Twitter, Facebook, and many other video platforms. Because it’s a command-line tool, many users tend to ignore this valuable utility. But once you learn the basic command-line parameters, it’s extremely easy to download any video in a single click.

  1. Download youtube-dl.exe from the following link:
    youtube-dl: Download Page:
    http://ytdl-org.github.io/youtube-dl/download.html

    Note: You’ll also need to install Visual C++ 2010 Redistributable Package (x86) in order to run youtube-dl. Else, you’ll get the msvcr100.dll missing error.

  2. After downloading youtube-dl.exe move it to the C:\Windows folder.
  3. Copy the YouTube, Facebook, or a Tweet URL to the clipboard.
  4. Open a Command Prompt window, and then type:
    youtube-dl [url_containing_the_video]  -o %(id)s.%(ext)s

    IMPORTANT: If a 4K video is the best quality available, that copy will be downloaded if you don’t mention the quality (format code -f). The best quality also means higher file download size. For video quality selection, you’ll need to use the -f (format) parameter followed by the format code, which denotes the resolution. See Video quality selection section below for details. For social media sharing, 360p or 240p videos would suffice in most cases.

    Example for YouTube

    [For the best quality video, use this command-line.]
    Note: *Best quality = high file size*
    youtube-dl https://www.youtube.com/watch?v=8FNpAjB9oP0 -o %(id)s.%(ext)s
    
    youtube-dl download twitter, facebook or youtube videos
    
    [For 360p video quality, use this command-line]
    youtube-dl -f 18 https://www.youtube.com/watch?v=8FNpAjB9oP0 -o %(id)s.%(ext)s
    
    [For worst video quality, use this command-line]
    youtube-dl -f worst https://www.youtube.com/watch?v=8FNpAjB9oP0 -o %(id)s.%(ext)s
    

    Example for Facebook

    youtube-dl https://www.facebook.com/watch/?v=348836293166471 -o %(id)s.%(ext)s
    
    youtube-dl download twitter, facebook or youtube videos
    

    Tidy up the Facebook URL

    To avoid errors such as ERROR: unable to download video data: urlopen error [Errno 8] _ssl.c:510: EOF occurred in violation of protocol, make sure you tidy up the Facebook URL. For instance, if the URL you obtained looks like this:

    https://www.facebook.com/watch/?v=348836293166471/?__xts__%5B0%5D=68.ARA2Gpon4RtqFugkspgIYR9Sw4mMFS9Fx1nlJTkN-KfquRjwtKnhVsRoV16hwHy_gB1dqVLT_Qfda9dzL22A_zV8ODLgIcq8wMMrgp5yaBSM2NQomKL0wxPPZNw2hIhg_CvSCAL_I64-CtEQvU8_oz5MlLPmAmdWzD5UEs9HhPTNxqhOvQnGwMaIMsDNhmIWqvi8MONKYQEKIc85gy7fqUbvM07WKvnjp5VkyU4xkM0Ct50DkuthmSXJAkVfC8Ascbu9rs0Udmei-6qaM3Y0mjXTpCgOgQ9PDP_WtETfhnY88QImVw6BtrSuoUjD9FrwsT56iCbNxNbALIoWmkZ5DhVJ7n2bfyfAlVxDBLeoBGFXRmZpaHcvkKw5EjQ4IlZC&__tn__=-R
    
    https://www.facebook.com/video.php?v=10152588878600983&set=vb.107925785982&type=2&theater

    Clean up the URL by removing the additional letters after the ID. After tidying up, it would look like below:

    https://www.facebook.com/watch/?v=348836293166471
    
    https://www.facebook.com/video.php?v=10152588878600983

    tips bulb iconIt’s always a better option to right-click on the Facebook video and click Show video URL and copy the address from there, rather than from the browser’s address bar.

    Example for Twitter

    youtube-dl https://twitter.com/livefist/status/1299200547149340672 -o %(id)s.%(ext)s
    
    youtube-dl download twitter, facebook or youtube videos
    

    This downloads the best/specified quality video from the mentioned URL to the current working directory.

    youtube-dl download twitter, facebook or youtube videos

tips bulb iconFile download time vs modified time: The downloaded videos would have the same last modified date and time as the last modified date and time of the file in the server. This can be annoying sometimes when you organize downloaded videos on your computer. To set the timestamp to download time instead of video’s last modified server time, also include the --no-mtime parameter when downloading the videos.

Output file name: The output file template can be customized to your liking. The -o option allows users to indicate a template for the output file names. To know more about customizing the output file name template, see OUTPUT TEMPLATE section in the youtube-dl documentation.

Video quality selection

YouTube and other video hosting platforms store different resolution copies of a video, such as 240p, 360p, 480p, 720p, 1080p, etc for the same URL. Likewise, several audio formats would be available.

youtube-dl download twitter, facebook or youtube videos

To list all available audio and formats of a YouTube, Twitter, or Facebook video, use the -F parameter, as in the example below. This parameter is case-sensitive.

youtube-dl -F https://www.youtube.com/watch?v=8FNpAjB9oP0

You’ll see an output similar to the following:

format code  extension  resolution note
249          webm       audio only tiny   71k , opus @ 50k (48000Hz), 877.38KiB
250          webm       audio only tiny   90k , opus @ 70k (48000Hz), 1.10MiB
140          m4a        audio only tiny  130k , m4a_dash container, mp4a.40.2@128k (44100Hz), 1.70MiB
251          webm       audio only tiny  163k , opus @160k (48000Hz), 2.02MiB
278          webm       256x144    144p  111k , webm container, vp9, 30fps, video only, 1.24MiB
160          mp4        256x144    144p  112k , avc1.4d400c, 30fps, video only, 1.21MiB
242          webm       426x240    240p  224k , vp9, 30fps, video only, 2.60MiB
133          mp4        426x240    240p  357k , avc1.4d4015, 30fps, video only, 3.07MiB
243          webm       640x360    360p  407k , vp9, 30fps, video only, 4.67MiB
244          webm       854x480    480p  757k , vp9, 30fps, video only, 8.04MiB
134          mp4        640x360    360p  763k , avc1.4d401e, 30fps, video only, 6.51MiB
135          mp4        854x480    480p 1139k , avc1.4d401f, 30fps, video only, 9.79MiB
247          webm       1280x720   720p 1515k , vp9, 30fps, video only, 15.35MiB
136          mp4        1280x720   720p 1909k , avc1.4d401f, 30fps, video only, 14.99MiB
18           mp4        640x360    360p  682k , avc1.42001E, 30fps, mp4a.40.2@ 96k (44100Hz), 8.95MiB
22           mp4        1280x720   720p 1271k , avc1.64001F, 30fps, mp4a.40.2@192k (44100Hz) (best)

(If you know the format code(s) by heart, you don’t need to issue the above command. Anyway, running the above command can be helpful to know if the specific format of the YouTube video is available in the inventory or not.)

To download the 360p version (format code: 18) of the video, you need to use the following command-line example. Note that this time around, you need to use the small -f. The parameter is case-sensitive.

youtube-dl -f 18 https://www.youtube.com/watch?v=8FNpAjB9oP0 -o %(id)s.%(ext)s

youtube-dl download twitter, facebook or youtube videos

Alternate video quality & prioritizing

The format codes are standard for every YouTube video. If a format you’re looking for (e.g., 240p) is not available for the input video URL, then you’ll see the error ERROR: requested format not available.

You can use other format codes as your 2nd, 3rd, 4th preference, and so on. To do so, if you use -f 22/17/18 , it will download format 22 if it’s available, otherwise, it will download format 17 if it’s available, otherwise, it will download format 18 if it’s available. If none of the three formats are available, it will complain that no suitable formats are available for download.



What are the “video only” and “audio only” entries?

As you can see in the above screenshot, there are some “video only” and “audio only” streams listed. In some cases, if a particular of the video (e.g., 240p) may only be available as separate audio and video streams. If you need only that particular resolution of the YouTube, Facebook, or Twitter video, then you need to concatenate the format codes like -f 247+140 and let youtube-dl.exe combine the streams automatically into an MP4 or MKV container format — whichever format is feasible.

Download 240p resolution YouTube video

If you want to download the 240p version of the video, use this command-line:

youtube-dl -f  133+140 https://www.youtube.com/watch?v=8FNpAjB9oP0 -o %(id)s.%(ext)s

Youtube-dl downloads the video and audio streams separately and then merges the files into a single MP4 or MKV container file.

hand point iconFor more details on this subject, go through the FORMAT SELECTION section of the excellent youtube-dl official documentation.

You can use the -F parameter for Twitter & Facebook video URLs as well. However, you may not find that much number of video formats in Twitter embedded videos. You’ll see a short list like this:

[twitter] 1299200547149340672: Downloading guest token
[twitter] 1299200547149340672: Downloading JSON metadata
[twitter] 1299200547149340672: Downloading m3u8 information
[info] Available formats for 1299200547149340672:
format code  extension  resolution note
hls-256      mp4        480x270     256k , avc1.4d001e, mp4a.40.2
http-256     mp4        480x270     256k
hls-832      mp4        640x360     832k , avc1.4d001f, mp4a.40.2
http-832     mp4        640x360     832k
hls-2176     mp4        1280x720   2176k , avc1.640020, mp4a.40.2
http-2176    mp4        1280x720   2176k  (best)

As you can see in the above table, the format code numbers vary completely for Twitter videos.

And for Facebook videos, you’ll see a different set of format codes, such as the example below:

 348836293166471: Downloading webpage
 348836293166471: Downloading webpage
 348836293166471: Downloading webpage
[info] Available formats for 348836293166471:
format code               extension  resolution note
356639258844548a          m4a        audio only [eng] DASH audio   66k , m4a_dash container, mp4a.40.5 (48000Hz)
2392186321075263v         mp4        960x540    [eng] DASH video  124k , mp4_dash container, avc1.4D401F, video only
301104637857927v          mp4        960x540    [eng] DASH video  248k , mp4_dash container, avc1.4D401F, video only
368399077486746v          mp4        960x540    [eng] DASH video  499k , mp4_dash container, avc1.4D401F, video only
3225713340851625v         mp4        960x540    [eng] DASH video 1006k , mp4_dash container, avc1.4D401F, video only
628189178117443v          mp4        960x540    [eng] DASH video 1247k , mp4_dash container, avc1.4D401F, video only
dash_sd_src               mp4        unknown
dash_sd_src_no_ratelimit  mp4        unknown
dash_hd_src               mp4        unknown    (best)
Editor’s note: You may also try using MediaHuman YouTube Downloader, a feature-rich app to download online videos and playlists.mediahuman download youtube videos

You can download it from the following link:

https://www.mediahuman.com/youtube-downloader/

Hope the above information helped you download videos from social media easily and quickly, without needing to use an intermediary website to accomplish the task. In one of the upcoming articles, we’ll see how to download a specific segment (time) of a YouTube, Twitter, or Facebook video without having to download the full video first.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

Leave a Comment