Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

youtube-dl format options API

Does youtube API provide the original audio you are listening from youtube as a download option? Is it perhaps the --extract-audio option?

like image 710
Aristos Georgiou Avatar asked Feb 20 '20 20:02

Aristos Georgiou


People also ask

Does yt-dlp need ffmpeg?

yt-dlp works reasonably well on its own on most sites. However, some sites - most notably YouTube - serve higher quality formats as separate audio and video. You will need ffmpeg to download and merge such formats. yt-dlp also uses many other optional dependencies for additional features.

Is there a GUI for youtube-dl?

Open Video Downloader or youtube-dl-gui, is a cross-platform GUI for youtube-dl made in Electron and Node.js. With this app you can download videos and playlists in all kind of formats, from just about every major website.

What is Tartube?

Tartube is a GUI front-end for youtube-dl, yt-dlp and other compatible video downloaders. It is written in Python 3 / Gtk 3 and runs on MS Windows, Linux, BSD and MacOS. Problems can be reported at our GitHub page.


1 Answers

By default youtube-dl tries to download the best available quality, i.e. if you want the best quality you don't need to pass any special options, youtube-dl will guess it for you by default.

Since the end of April 2015 and version 2015.04.26, youtube-dl uses -f bestvideo+bestaudio/best as the default format selection (see #5447(https://github.com/ytdl-org/youtube-dl/issues/5447), #5456(https://github.com/ytdl-org/youtube-dl/issues/5456)).

If you want to preserve the old format selection behavior (prior to youtube-dl 2015.04.26), i.e. you want to download the best available quality media served as a single file, you should explicitly specify your choice with -f best. You may want to add it to the configuration file in order not to type it every time you run youtube-dl.

Reference: https://github.com/ytdl-org/youtube-dl/blob/master/README.md#readme

Let me know if this helps. if not, we could figure it out in specifics.

UPDATE

Here are a few commands that could come handy;

# Download best mp4 format available or any other best if no mp4 available
$ youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best'

# Download best format available but no better than 480p
$ youtube-dl -f 'bestvideo[height<=480]+bestaudio/best[height<=480]'

# Download best video only format but no bigger than 50 MB
$ youtube-dl -f 'best[filesize<50M]'

# Download best format available via direct link over HTTP/HTTPS protocol
$ youtube-dl -f '(bestvideo+bestaudio/best)[protocol^=http]'

# Download the best video format and the best audio format without merging them
$ youtube-dl -f 'bestvideo,bestaudio' -o '%(title)s.f%(format_id)s.%(ext)s'
like image 90
mw509 Avatar answered Oct 15 '22 16:10

mw509