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
131.29k stars 9.95k forks source link

Support downloading YouTube videos with multiple audio tracks #32862

Open mahaveergautamji opened 1 month ago

mahaveergautamji commented 1 month ago

Checklist

Question

how to downloa dmultiple audio tracks from youtube

WRITE QUESTION HERE image

dirkf commented 1 month ago

First use -F to list the available formats; then specify the desired audio format in the download command.

dirkf commented 1 month ago

@mahaveergautamji ?

mahaveergautamji commented 1 month ago

i used that command but how i can download a selected track like japaness or hindi pls give instructions

dirkf commented 1 month ago

The instructions assume that you've read the Manual, especially the concerning the -F and -f options, and also Format Selection.

If the language of the tracks is not clear from the format listing, you would have to guess. As always, post a full verbose text log of any command that doesn't seem to be doing what you expect from the documentation.

aiur-adept commented 1 month ago

@mahaveergautamji the audio tracks are labelled in the -F output with their 2-letter language code. For example:

python3 -m youtube_dl -F https://www.youtube.com/w
atch\?v\=HwAPLk_sQ3w
[youtube] HwAPLk_sQ3w: Downloading webpage
[info] Available formats for HwAPLk_sQ3w:
format code  extension  resolution note
249-0        webm       audio only [fil] audio_quality_low   47k , webm_dash container, opus  (48000Hz
), 8.88MiB
249-1        webm       audio only [de] audio_quality_low   49k , webm_dash container, opus  (48000Hz)
, 9.11MiB
249-2        webm       audio only [ar] audio_quality_low   49k , webm_dash container, opus  (48000Hz)
, 9.14MiB
249-3        webm       audio only [ru] audio_quality_low   49k , webm_dash container, opus  (48000Hz)
, 9.15MiB
249-4        webm       audio only [pl] audio_quality_low   49k , webm_dash container, opus  (48000Hz)
, 9.16MiB
249-5        webm       audio only [es] audio_quality_low   49k , webm_dash container, opus  (48000Hz)
, 9.20MiB
249-6        webm       audio only [zh] audio_quality_low   49k , webm_dash container, opus  (48000Hz)
, 9.21MiB
249-7        webm       audio only [fr] audio_quality_low   50k , webm_dash container, opus  (48000Hz)
, 9.21MiB
249-8        webm       audio only [uk] audio_qual...

However, it doesn't seem there is a way to get the video with a specific language track as audio - all the video options will be "video only", so you will have to download the audio you want and then post-process to combine it with the video (I think ffmpeg can combine audio and video).

dirkf commented 1 month ago

Formats labelled video-only have no audio language by definition. They may possibly have burned-in subtitles that imply a specific language: it depends on the site and extractor as to whether that is reported in the extracted metadata, as the language attribute.

To get a desired audio language, you specify the language code, say pl for Polish, as the value of language for the audio format, so -f 'bestvideo+bestaudio[language=pl]' (Windows: '...' -> "..."), or, if there are language-specific combined audio+video formats, `-f '(bestvideo+bestaudio/best)[language=?pl]'.

Example showing that the language of the selected audio format matches the requested selection:

$ python -m youtube_dl -f 'bestaudio[language=pl]' -o '%(language)s' --get-filename HwAPLk_sQ3w
pl
$
dirkf commented 1 month ago

@mahaveergautamji ?