diff --git a/public/en/youtube-downloads-with-yt-dlp.gmi b/public/en/youtube-downloads-with-yt-dlp.gmi index 7cdd890..b9d4a89 100644 --- a/public/en/youtube-downloads-with-yt-dlp.gmi +++ b/public/en/youtube-downloads-with-yt-dlp.gmi @@ -18,6 +18,42 @@ yt-dlp CHANNEL_URL|PLAYLIST_URL|VIDEO_URL -S res:1080 yt-dlp CHANNEL_URL/playlists -o '%(uploader)s/%(playlist)s/%(title)s.%(ext)s' ``` +## Download video with multiple audio streams + +* tested on yt-dlp v2025.12.08 + +### Download best video, best audio (original + uk) and subs + +``` bash +yt-dlp -f "bv+ba+ba[language=uk]" \ + --audio-multistreams \ + --embed-metadata \ + --embed-subs \ + --all-subs \ + --merge-output-format mkv \ + URL +``` +* it's important to provide the `--embed-metadata` flag to prevent all audio options from being marked as 'English' +* the `--merge-output-format mkv` argument is recommended, as the MKV container provides the necessary features for built-in audio and subtitle options + +### Fix audio stream names using post-processing + +If the `--embed-metadata` argument is missing, you can fix the names for audio options after by using ffmpeg: + +``` bash +ffmpeg -i input.mkv \ + -map 0 -metadata:s:a:0 language=en -metadata:s:a:1 language=uk \ + -c copy output.mkv +``` +* it's important to keep the previous `-f` order + +or just inline: + +``` bash +yt-dlp ... \ + --exec "ffmpeg -i {} -map 0 -metadata:s:a:0 language=en -metadata:s:a:1 language=uk -c copy output.mkv" URL +``` + ## Extract audio ``` bash