137 Mp4 __LINK__
These commands will ensure you download the highest quality mp4 video and m4a audio from the video as a single file or will merge them back into a single mp4 (using ffmpeg in my case). If ffmpeg or avconv is not available, youtube-dl should fall back to the single file -f best option instead of the default.
notice that youtube-dl has labeled the last option 1280x720 as the 'best' quality and that's what it will download by default, but that the line starting with 137 is actually higher quality 1920x1080. Youtube has separated the video and audio streams for the lines labeled DASH so we also need to pick the highest quality audio which in this case is the line starting with 141. Then we run youtube-dl again this time specifying the audio and video:
and it will download the 1080p video and auto-merge it with the highest-quality audio. It should also auto-deleted the separate downloaded parts. This method is a little extra work, but will get you the best results.
This answer here, with the most votes, should be right to give you the best video quality available, but....it's not always. bestvideo+bestaudio seems to choose only the best video and best audio of the options that are video only and audio only, then it merges the two together. Note that this also appears to be identical to the default behavior of youtube-dl. However, on the video I was looking at, the best quality was a single, pre-merged file that was already in a format with combined video and audio. The bestvideo+bestaudio option did NOT choose this best quality 720p file because it was looking only for separate video and audio files. Details below.
Notice that row 22 says "(best)" to the far right of it. This is the only option which offers hd720 quality, which is the best quality I can get when watching this video in a web browser on YouTube. It is the clearest and has the best definition. When I use either of the commands recommended by the top answer:
I end up with a video that is both lower quality/lower resolution, and has a larger file size. I don't understand it exactly, but the -f best option is definitely the only one that truly gives me the best resolution.
Here's some screenshots from a tutorial video I was watching showing electronic circuit diagrams in the video. Notice how the latter one is much higher quality and more legible (click on each image and compare the tiny font in a zoomed-in view):
Some video sites, such as youtube, offer not only different resolutions of video to download, but have options in youtube-dl called formats to download video and audio separately. For the case of youtube, it will only offer the highest quality video and highest quality audio separately. Here's an example output of using -F flag to show all formats available:
So there's a lot of different formats, but some are labelled "audio only" or "video only". If I selected to download one of those formats by using the specified format code such as with -f 137, I would really get either an audio file or a video file with no audio, which is usually not what you want. If I had ffmpeg installed and specified both video and audio formats with -f 137+140, then youtube-dl would download video and audio and afterwards combine them together into one video file.
If you don't have ffmpeg installed, youtube-dl will by default select the highest quality format that has both audio and video. This maxes out at 720p (and is usually specified by format code 22 so you would download with -f 22). If you do have ffmpeg installed, youtube-dl will be able download the real best quality video (1080p or better if available) and best quality audio, and after downloading mux (combine) them together into one video file so this is what I recommend.
I am a disk saver, so I download videos of the format 1280 x 720, because 4k videos takes more size of my hard disk.So I add youtube-dl in /.bashrc file like given below
You may notice that some streams listed have both a video codec and audiocodec, while others have just video or just audio, this is a result of YouTubesupporting a streaming technique called Dynamic Adaptive Streaming over HTTP(DASH).
In the context of pytube, the implications are for the highest quality streams;you now need to download both the audio and video tracks and then post-processthem with software like FFmpeg to merge them.
Previously, I was using bestvideo+bestaudio/best, but I find the following variant works much better for reducing mkv, (apparently) eliminating webm, but yet still guaranteeing the highest quality video (don't use the --merge-output-format option when using this):
Notice that, in the first term, the ext filter is specified for the audio but not the video, a technique which I didn't see mentioned in the discussion above. If that seems backwards for my stated goals, that might be because, considering that we're trying to ensure that the video format is mp4, why is the constraint given for the audio?
The key is that each fallback term (separated by the slashes) will fail if any part of its requirement fails, moving on to the next term. When using bestvideo+bestaudio, many cases of getting a non-mp4 container only show up because that format selection unequivocally insists on bestaudio, which may then mean a mixed format. It's because the bestvideo+bestaudio command is too insistent that you get forced out of mp4.
But what if you care more about getting a mp4 container than you do about the audio quality? By insisting on m4a audio first--but then relenting on just that part while issuing bestvideo again--(by using the the format selection above) you essentially express a flexible preference for mp4 over the other containers; you surely do want mp4 if possible, but not at the cost of reduced video quality.
As I said, you may still get some mkv, but they will be greatly reduced in number and only used when required to supply a (supposedly) better video. And so far with this configuration, I haven't seen any webm at all, because something like 248+140 works ends up as mkv.
This file is slightly different from the file obtained with -f , although the streams seem to be the same. I tried both on a video: -f mp4, then -f 137+140 (manually choosing the best audio and video). ffprobe says this about the file obtained with -f mp4:
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.
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.
Specific workshop information is in Blackboard course IPEC 1301-001 (or 100 depending on your IPE Program Timeline), which you must be enrolled in to access course materials and participate. 041b061a72