Skip to content

Instantly share code, notes, and snippets.

@tavinus
Last active November 21, 2020 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tavinus/3bb56acc372f1fe336ba583b71cc2a76 to your computer and use it in GitHub Desktop.
Save tavinus/3bb56acc372f1fe336ba583b71cc2a76 to your computer and use it in GitHub Desktop.
Bash alias for forced MP4 youtube-dl

Youtube-DL MP4

Add the alias to your shell profile.

Depending on your system, shell and local/remote connection, the file sourced(loaded) may change.

For BASH and Debian, you could edit ~/.bash_profile

nano ~/.bash_profile

Force MP4

It is common to get a mkv from youtube because the streams downloaded are not compatible with mp4.

It is easy to force the best mp4 streams though.

Add this to your shell profile file

alias youtube-dl-mp4="youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4'"

OR

alias youtube-dl-mp4='youtube-dl -f '\''bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4'\'''

Then you need to reload/reconnect the shell or source the profile again.

Use

To use you can just call it

youtube-dl-mp4 <url>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment