Support downloading YouTube videos with multiple audio tracks #26909

Open
opened 2026-02-21 14:32:41 -05:00 by deekerman · 7 comments
Owner

Originally created by @mahaveergautamji on GitHub (Jul 20, 2024).

Checklist

  • I'm asking a question
  • I've looked through the README and FAQ for similar questions
  • I've searched the bugtracker for similar questions including closed ones

Question

how to downloa dmultiple audio tracks from youtube

WRITE QUESTION HERE
image

Originally created by @mahaveergautamji on GitHub (Jul 20, 2024). <!-- ###################################################################### WARNING! IGNORING THE FOLLOWING TEMPLATE WILL RESULT IN ISSUE CLOSED AS INCOMPLETE ###################################################################### --> ## Checklist <!-- Carefully read and work through this check list in order to prevent the most common mistakes and misuse of youtube-dl: - Look through the README (http://yt-dl.org/readme) and FAQ (http://yt-dl.org/faq) for similar questions - Search the bugtracker for similar questions: http://yt-dl.org/search-issues - Finally, put x into all relevant boxes (like this [x]) --> - [x] I'm asking a question - [ ] I've looked through the README and FAQ for similar questions - [ ] I've searched the bugtracker for similar questions including closed ones ## Question how to downloa dmultiple audio tracks from youtube WRITE QUESTION HERE ![image](https://github.com/user-attachments/assets/b593c069-29e2-410f-b710-23603e04a320)
Author
Owner

@dirkf commented on GitHub (Jul 20, 2024):

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

@dirkf commented on GitHub (Jul 20, 2024): First use `-F` to list the available formats; then specify the desired audio format in the download command.
Author
Owner

@dirkf commented on GitHub (Jul 21, 2024):

@mahaveergautamji ?

@dirkf commented on GitHub (Jul 21, 2024): @mahaveergautamji ?
Author
Owner

@mahaveergautamji commented on GitHub (Jul 22, 2024):

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

@mahaveergautamji commented on GitHub (Jul 22, 2024): i used that command but how i can download a selected track like japaness or hindi pls give instructions
Author
Owner

@dirkf commented on GitHub (Jul 22, 2024):

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.

@dirkf commented on GitHub (Jul 22, 2024): [The instructions](https://github.com/ytdl-org/youtube-dl/issues/32862#issuecomment-2241085979) assume that you've read the [Manual](https://github.com/ytdl-org/youtube-dl#user-content-description), 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.
Author
Owner

@aiur-adept commented on GitHub (Jul 28, 2024):

@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).

@aiur-adept commented on GitHub (Jul 28, 2024): @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).
Author
Owner

@dirkf commented on GitHub (Jul 28, 2024):

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 on GitHub (Jul 28, 2024): 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: ```console $ python -m youtube_dl -f 'bestaudio[language=pl]' -o '%(language)s' --get-filename HwAPLk_sQ3w pl $ ```
Author
Owner

@dirkf commented on GitHub (Aug 1, 2024):

@mahaveergautamji ?

@dirkf commented on GitHub (Aug 1, 2024): @mahaveergautamji ?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#26909
No description provided.