How to download 1080p + best audio using youtube-dl?

前端 未结 1 1676
醉梦人生
醉梦人生 2021-02-01 08:50

I\'m trying to download 1920x1080 video with 192kb/s audio but I\'m unable to extract both. For example:

        format code  extension  resolution note
    249          


        
相关标签:
1条回答
  • 2021-02-01 09:40

    First of all, a word about audio quality: As described on our sister site, mp3 becomes indistinguishable from lossless CD quality (transparent) at about 192kb/s with a constant bitrate. However, any modern encoder is using a variable bitrate (VBR), putting more quality in some sections than others. With VBR, the cutoff is likely a bit lower. With professional ears and equipment, it may be a little bit higher.

    AAC and Vorbis are one generation farther than MP3. This seems to be the most comprehensive quality test - at least the one I could find. AAC and Vorbis have been claimed to be transparent at 128kb/s, although I'd guess 160kb/s is a more realistic threshold. Opus is yet another significant improvement, being reasonably good for music at 64kb/s and probably transparent at 128kb/s.

    When youtube-dl lists the format quality for YouTube, the quality it lists is hardcoded. Other websites supported sometimes relay quality information in advance, but for YouTube we'd have to download at least the headers of each file.

    I got bad news for your claim to be able to hear the difference between 192kb/s and 128kb/s on this video: All the audio formats offered for this video (namely, 251, 140, 171 and 22) are encoded with 128KB/s VBR. You can check so by downloading them (for 22, you need to split off the audio) and comparing file sizes: They're all 1.6MB = 12.8 Mb (conveniently, the video is 100 seconds long).

    In particular, the codecs are opus(251), Vorbis(171), AAC(140 and 22). Of these, Opus definitely offers the highest quality. So why does youtube-dl pick Vorbis with bestaudio? The way I originally designed the youtube-dl format selection, it would have picked the Opus indeed. But there was significant user feedback that some formats may be of worse quality, but supported more broadly.

    Even today, lots of applications are unable to handle Opus, or even Vorbis or AAC and their container. A high-quality music player such as VLC will support everything, but out of the box, many laptops will be limited; smartphones more so, and smartwatches or smart headphones even more so. This is why most podcasts will still serve mp3 files - it is a much worse user experience to be unable to play a file at all, than a slight degradation in audio quality and/or file size. In addition, some of these formats are also free, while others are not, bringing further problems on systems configured to use only free software.

    If you value audio quality above all, you should pick format 251 here. Store your preferences in a configuration file to make them permanent.

    Note that all of this discussion presumes that the original audio source is high-fidelity, if possible lossless. Since the uploader of that video is called MikeTheAnimeRunnerX2, I would not presume expert audio recording skills - although there is credit of the original singer, so he may have gotten a high-quality file in private. If the audio that was uploaded to YouTube was in a lossy format (especially one at the edge of transparency or lower), all the further reencoding by YouTube can do is minimize further artifacts.

    Note that to non-experts, worse compression can sometimes sound better, especially when the original source is not that good, noisy, or has been degraded by lossy reencodings. This is because worse compression will remove some inaccuracies and may make the sound more "smooth".

    Fortunately, youtube-dl gives you the option to test multiple formats. Just download all candidates (e.g. with youtube-dl -f 251 i-c-K3pNtj4, or -f bestvideo+251 to get a video file) and pick the one you like most.

    0 讨论(0)
提交回复
热议问题