Download as mp3 and as video

#! /usr/bin/env bash

youtube-dl --extract-audio --audio-format mp3 --audio-quality 192K --output '%(title)s.%(ext)s' "$1" && youtube-dl "$1"


-F to get list of available quality and formats
-f 18 is good default and usually available (mp4)
-f 22 is normally best mp4

To get best audio as mp3:

-f bestaudio –extract-audio –audio-format mp3 –audio-quality 192K

To get best mp4:

-f mp4

To get quality and force container:

-f ‘bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4’



vtt Web Video Text Tracks (plain text) - based on SRT
ttml Timed Text Markup Language (XML)
srt Plain text classic - non-web


–sub-lang en Download only english language subtitles
–write-sub Place subs in external file
–write-auto-sub Transfer YouTube’s automatically generated subtitles into an external file
–embed-subs Include subs with the video; this will delete the downloaded subs - must first download subs e.g. with –all-subs
–all-subs Download all available subtitles
–convert-subs FORMAT Convert the subtitles to other format (currently supported: srt

To include subtitles: