ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.41k stars 10.04k forks source link

[youtube] -f to merge video with two audio tracks #24537

Open Gorrrg opened 4 years ago

Gorrrg commented 4 years ago

Checklist

Description

There are surround sound audio tracks popping up on YouTube now, and I'd like to mux both a stereo and a multi-channel track into the file using something like --format 313+258+251, so that the resulting file can be played on both stereo and surround setups without sounding bad.

But that gives the error:

[youtube] fbyIYXEu-nQ: Downloading webpage
ERROR: The first format must contain the video, try using "-f 251+258"
ERROR: 'NoneType' object is not subscriptable

Example video is the Vsauce Mindfield series: https://www.youtube.com/watch?v=fbyIYXEu-nQ

The example formats would be:

251          webm       audio only tiny  147k , opus @160k (48000Hz), 21.18MiB
258          m4a        audio only tiny  388k , m4a_dash container, mp4a.40.2 (48000Hz), 63.82MiB
313          webm       3840x2160  2160p 18419k , vp9, 24fps, video only, 2.39GiB

And I expect ffmpeg to mux them into a Matroska file. I know I could download the individual tracks and then mux them together manually, but I like how youtube-dl is able to embed thumbnails, metadata, subtitles and descriptions in one go.

Lee-Carre commented 2 years ago

I've wondered about this (short of downloading the components and manually muxing each of them with ffmpeg).

This would be useful for archiving.

Else, where storage isn't a constraint, a single multi-track file for playback on various different hosts, which have different capabilities, allowing the player to auto-select which tracks it uses. Besides fidelity (‘bitrate’, sort of), also different codecs. For video tracks, each could be a different angle, or 360° versus 16:9 versus 4:3 versus stereoscopic (‘3D’), or frame-rate.