For those who use yt-dlp
to download YouTube videos
yt-dlp
defaults to .webm when downloading. Here’s how to get .mp4.- In addition to
yt-dlp
, make sure you haveffmpeg
installed. It’s available in the Arch Extra Repo
-
Example YouTube Video Link: The standard, default for using
yt-dlp
would be…
yt-dlp https://www.youtube.com/watch?v=3Q6uCrpzbPY
This provides a .webm file. -
I researched how to get an .mp4 instead. If you would like to have an .mp4 instead, add
-S res,ext:mp4:m4a --recode mp4
to the download command. So the full command for the example video above would be…
yt-dlp https://www.youtube.com/watch?v=3Q6uCrpzbPY -S res,ext:mp4:m4a --recode mp4
This downloads mp4/m4a if available, and if not, will download the best available format(s) and recode/merge to mp4. -
I’ve tried 7 YouTube videos using this and, so far, it’s worked 100% of the time.
-
As with any tutorial, your mileage may vary.
RELEVANT EDITS -
-
EDIT: If you’re using the fish shell, you’ll need a single
'
and the beginning and end of the desired YouTube video link in the command. Like this…
yt-dlp 'https://www.youtube.com/watch?v=3Q6uCrpzbPY' -S res,ext:mp4:m4a --recode mp4
-
EDIT 2: These also work well (using the example video above).