Home > Linux, Testing > How to Download YouTube 4K Videos with Youtube-dl Script

How to Download YouTube 4K Videos with Youtube-dl Script

September 20th, 2016 Leave a comment Go to comments

Many Android devices can now support 4K VP9 and/or H.264 video decoding, but for some reasons, Google only serves 4K videos to devices running Android TV OS, as opposed to just Android, with the latter limited to 1080p videos. If for some reasons you want to watch a YouTube 4K video on a capable device, you could download it with youtube-dl script written in Python, and available for Linux, Windows, and Mac OS.

youtube-4k-video-downloadI’ve been using the script for a while to download various video or audio files from YouTube, and other website, but for the purpose of this post, I made sure to update it to the latest version:

If you have already installed the script, it can also be updated with:

I’ll use one of the most popular 4K videos on YouTube as example, namely: COSTA RICA IN 4K 60fps (ULTRA HD) w/ Freefly Movi.

The first task is to list the video’s supported formats:

So we can see there are lots of different formats for a given video with different resolution, container formats, and bitrates. You have to find the lines you want and select the corresponding “format code” in the first column to download the video and audio. I’ll select 313 for video and let the script select the best audio format:


The “+” sign is used to merge video and audio. If you don’t add an option for audio, only the video without audio will be downloaded. You can also run “youtube-dl URL” without options, and it should download the video with both “best audio and video”, but you don’t have full control over the exact format of the video.

Youtube-hd script has many others options, include support for YouTube playlist downloads so it’s a very useful script.

  1. TC
    September 20th, 2016 at 17:44 | #1

    jDownloader also does this and should be the simpler option on Windows

  2. paul taraneh
    September 20th, 2016 at 19:14 | #2

    If your device ID rooted you can install og YouTube, but must delete your original YouTube, if you’d like to sign in, then message me for the modified Google services files. Offers 4k and music video downloading because geez that’s alot of code

  3. September 20th, 2016 at 19:18 | #3

    @paul taraneh
    It looks very interesting, but based on the Changelog, resolution is limited to 140p~1440p.

  4. agumonkey
    September 20th, 2016 at 19:31 | #4

    I learned not long ago that youtube-dl has a syntax to specify what kind of resolution you want. See https://github.com/rg3/youtube-dl/blob/master/README.md#format-selection (a little bit below you’ll see a best[>=480p].

    It helps writing robust scripts without hardcoded format number like 331.

    Cheers

  5. maredsous10
    September 20th, 2016 at 22:34 | #5

    @TC

    I use both youtube-dl and jDownloader2. Both are cross platform and I agree jDownloader2 is much simpler.

    The primary reason I use youtube-dl is to download videos from sites that aren’t supported by jDownloader2.

    List of supported sites:
    https://github.com/rg3/youtube-dl/blob/master/docs/supportedsites.md

  6. farrukh
    September 21st, 2016 at 00:02 | #6

    4k downloader does the job way more effortlessly. Available for windows and Mac. Not sure about Linux.

  7. Drone
    September 22nd, 2016 at 19:50 | #7

    TC :
    jDownloader also does this and should be the simpler option on Windows

    Youtube-dl has a Windows stand-alone (portable) .exe ready to dowload. Just remember to download the latest version if something stops working.

  8. Scott Bailey
    February 21st, 2017 at 14:59 | #8

    Thank you for these instructions, really helpful!! I’d also recommend Acethinker Video Downloader which I have used for many years. It is a free cloud based software to download videos without install any software in your device.

  1. No trackbacks yet.