Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
-f bestvideo+bestaudio with only mp4 codecs #4886
Comments
|
I have EXACTLY the same problem, and I don't know how to solve it. youtube-dl https://www.youtube.com/watch?v=..... -f 299/137/298/136+141 to let the youtube-dl download the best video from the format list, but it doesn't work. So I tried youtube-dl https://www.youtube.com/watch?v=..... -f [299/137/298/136]+141 but don't work too. How can we do? |
That should do it. |
|
It doesn't work, because 137 is not always the best mp4 quality. 137 is 1080p 30fps. |
|
@mati8 @ericzutter sure, but that's why you have It lists the formats along with their identifier. Something like |
|
@chrisaljoudi you don't understand the problem.
Of course it would be possible to transcode the webm file to mp4 and then merge it with audio, but at the moment it's not possible with youtube-dl. Question: |
I only mentioned that because the original post (and issue) said "mp4 only". Do you see that?
Why do you think you can't combine webm with audio? If you want the best video and the best audio (from DASH), If it doesn't, please share an example. It most certainly should. On a completely separate note (you shouldn't have to do this), this works fine:
|
|
@chrisaljoudi DASH video can be mp4 too. "DASH" is not a video format. youtube-dl https://www.youtube.com/watch?v=-da2L9wY-rc -f bestvideo+bestaudio It downloads the webm, and it's not possible to combine it with the best audio. |
|
It should be added a function to download the best mp4 DASH, to combine it with the best audio. @chrisaljoudi Let's try: It will download just the 137. So it should be something like this: |
|
@mati8 I never said anything to the effect that DASH is a video format.
I know that. The reason we're talking about mp4 is what this issue is. Did you read the original issue? Here's a quote:
and
I get what you're saying, but you keep redefining the problem. There are two possible sources:
MP4 (a container) does not support
Ah, you're right. |
|
@chrisaljoudi what I think it would be great, it's to download the best "mp4" DASH, and combine it with the bestaudio. Did you try it? |
|
@mati8 yes, indeed it will show an error — This, for example, works great:
To warn you, this will fail in your case:
Because |
|
@mati8 If there is an error, please do open a new issue (do not forget to include the output you get when you add
|
|
@phihag the error occurs when Furthermore, if the container is
|
|
The following help info has been added to youtube-dl version 2015.02.09.1 : youtube-dl.exe --help You can filter the video results by putting a condition in brackets, as in -f "best[height=720]" (or -f "filesize>10M]"). This works for filesize, height, width, tbr, abr, vbr, asr, and fps and the comparisons <, <=, >, >=, =, != and for ext, acodec, vcodec, container, and protocol and the comparison =, != . The following example worked (= download best video + audio codec for mp4 container) : youtube-dl -f bestvideo[ext=mp4]+bestaudio https://www.youtube.com/watch?v=_YIae5mwmNU I don't know what will happen if a video contains no DASH. Will the option "-f bestvideo[ext=mp4]+bestaudio" download the best video/audio for mp4 container when there are no DASH formats ? In the help info they added the filters container/vcodec/acodec/protocol. But the following examples didn't work : youtube-dl -f bestvideo[container=mp4]+bestaudio https://www.youtube.com/watch?v=_YIae5mwmNU youtube-dl -f bestvideo[container=mp4]+bestaudio[container=mp4] https://www.youtube.com/watch?v=_YIae5mwmNU youtube-dl -f bestvideo[vcodec=h264]+bestaudio https://www.youtube.com/watch?v=_YIae5mwmNU youtube-dl -f bestvideo[vcodec=avc]+bestaudio https://www.youtube.com/watch?v=_YIae5mwmNU youtube-dl -f bestvideo[vcodec=mp4]+bestaudio https://www.youtube.com/watch?v=_YIae5mwmNU How to use the new filter options container/vcodec/acodec/protocol ? |
|
How does the bestvideo actually work? Because for this video:
|
|
@Yhonay open anew issue for that. @ericzutter Not all formats have the same info available, so some of the filters won't match anything. If you only want mp4 files, using |
|
I realize this thread is a bit old, but I think the situation has changed somewhat. For my goal:
Previously, I was using
Notice that, in the first term, the 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 But what if you care more about getting a mp4 container than you do about the audio quality? By insisting on As I said, you may still get some Also... note that there is now a new youtube-dl issue that affects whether you get the best video. Unlike the issue discussed here (which concerns how youtube-dl operates), #14143 is caused by YouTube reporting false metadata. |
|
Hello, it will download audio format 140, which is not best.. as you can see in format 22 (720p) it has mp4a @ 192kb . Is there anyway how to extract audio from 720p and merged with video 1080p ? |
|
Normally, |
Hmm strange that MacOS cannot open such videos via QuickTime but VLC has no problem. Seems this method uses codec that MacOS does not like. |
|
As of March 24, 2020, bestvideo[ext=mp4] seems to include av01 videos sometimes. Example video where this happens for me (although I expect this may be region dependent): https://www.youtube.com/watch?v=jW6gzAa-VUE Is there a way to specify "best video that uses h264"? |
even now still I think there is no way around this. my flags:
will merge the video and audio into a mp4 container but will still at times(around 60% of the time) encode using the vp09 codec(google's Not-Invented-Here codec). Very irritating and frankly I think they did that on purpose to throw a wrench in youtube archivers using youtube-dl. A workaround is a transcode that is not actually heavyweight(should get about 3x speed on an i5): vp09-codec-mp4-wrapper to mp4/h264/h265:
|
ext=mp4 is not the right format selection for your use case. It selects the container format but you want to select the codec. You can use the vcodec=... selector to specify the video format you want to download. |
Thanks for the suggestion. I tried: but it does not seem to fetch h264 codec. |
|
Echoing the above— I've tried:
All result in "Requested format not available". Is this a separate bug I should open a new issue for? |
H264 streams in Youtube are called "avc1....." and the |
How to get best video + best audio for mp4 container format ?
codecs
The ideal parameter would be: -f "bestvideo[container=mp4]"+"bestaudio[container=mp4]"
But this parameter doesn't work.
Is there another way to use the parameter "-f bestvideo+bestaudio" and force to use only mp4 codecs and skip webm codecs ?