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.
Request feature of merging video and audio separately served at YouTube #2765
Comments
|
We already have support for this, though it's undocumented until we work out a few problems. Just specify two format codes with a + between them. For example, This feature isn't enabled by default, because it requires either ffmpeg or avconv to be available and in the $PATH to mux the video, and we need to be able to automatically detect their availability, and change what format is considered the 'best' if they are available. It's certainly something that could be done, but no one has taken the time to do so. |
|
As @AGSPhoenix said, this is already implemented, but it needs some improvements. If you just want the best quality you may prefer to use |
|
@AGSPhoenix: Why isn't this in the man page? BTW didn't work. After downloading
Yet I can merge the original downloaded files no problem using:
This is a 4k video. |
|
@PacoH It is documented now. We're still waiting for someone to contribute code that automatically detects whether merging is possible so that we could even default to this. The webm container does not support m4a content, and that's why youtube-dl fails (If you think it should detect this situation and maybe choose a better container, please file a bug saying that you'd be interested. In your command-line, you are converting the audio to vorbis, whereas youtube-dl tries to do it losslessly. By the way, why are you recoding the video? That will lead to a loss of quality. |
|
I tried
|
My suggestion is that, according to the codecs that YouTube are currently using, most of them can be fitted into an MP4 container or a WebM one. General MKV can be used as the last resort: Use MP4 for H.264/FLV1/H.263/MPEG4 + AAC/MP3/AMR (coming from .mp4 .flv .3gp(only 144p) .m4a .mp3) Use WebM for VP9/VP8 + Opus/Vorbis (coming from .webm) Use MKV for the remaining combinations.= |
|
OK, it works perfectly if you don't mix formats. I successfully downloaded both wbem-video+webm-audio and mp4-video+m4a-audio formats and they were properly muxed into |
From the screenshot we can know YouTube now serves video and audio separately.
I think it will be great if
youtube-dlcan automatically merge them.I give three ways. Either of them can be implemented into
youtube-dl:ffmpeg -i video.webm -i audio.m4a -c copy output.mkv mkvmerge -o output.mkv video.webm audio.m4a MP4Box -add video.mp4 -add audio.m4a output.new.mp4 && mv output.new.mp4 output.mp4Thank you.
BTW: The worst/best decision is not accurate now, since the 'dash' version is not always the worst and the 'non-dash' version serves only up to 720p.