About youtube-dl formats

Hi there,

I installed youtube-dl from the Fedora repos, checked the documentation here,

And, well, it is mostly syntax, which is fine, but I do have some hiccups;

When I enter

youtube-dl -F [url]

I get a list of available choices, but, it is all either as audio only or video only,
If I just enter

youtube-dl [url]

I get the highest video resolution, with terrible audio, I tried

youtube-dl -f 271 --merge-output-format mp4 [url]

Still, I got audio only. I have tried a bunch of different syntax.

So, Is there a guide / tutorial on how to properly use youtube-dl ?

Thx.

I’ve used youtube-dl several times and always found the defaults to be fine. My experience is based on a direct from github installation though, not from a repo. It does depend on the video source too. You could try the --audio-format or --audio-quality options as well. Another option is to install youtube-dl with curl or wget as described on the github and make sure you’re running the most up to date version. The Fedora repo is probably outdated.

1 Like

I guess youtube-dl in Fedora comes from rpmfusion and is actually quite up-to-date there still like @Ethanol said, I also prefer the most recent version and use pip to obtain it like in the documentation.

The defaults are actually great though a lot of time I only want the audio and type this:

youtube-dl -f bestaudio --extract-audio --audio-quality 0

That will give you the highest quality but stick to Youtube’s default codec, oftentimes opus.
Or you can convert it e.g. to mp3 by using:

youtube-dl -f bestaudio --extract-audio --audio-quality 0 --audio-format mp3

That is all of course using conversion of videos to audio. Youtube-dl is very capable and have an obligatory look at the manpage.

Thing is if you want to have the highest quality of both video and audio, then that is actually the default setting in youtube-dl using the standard command at least from the manpage.

2 Likes

just FYI, some youtube-dl download might result in error, due to copyright etc, and some downloads might have only video not audio, youtube has a complicated policy about download I am talking the last time I used it few years back using Linux Mint (based on debian/ubuntu Linux).
The tutorial might be correct, but the contect you want to get cannot be download video+audio.

Regards, Alex

I added ffmpeg, that is needed for the conversion, probably lame for mp3 but other than that the default install does not need much else I think. Of course you need Python but that is a given on any Linux installation.

youtube-dl uses ffmpeg for all advance video/audio tasks.

Problem. You are using Fedora, as much as I LUV Fedora. edora default repos only contain free software. this means programs like ffmpeg that are really good but included nonfree codecs get rejected from the repos.

you can also see this with stuff like blender. Fedora’s blender doesnt have ffmpeg, and Blender will not use an outside ffmpeg, only ones compiled with it. Giving you a blender install that cant do videos too well.
If you havent done the following yet…

Install RPMFUSION with…

sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

Then give yourself a hug by pulling in these groups that fix the codec insanity

sudo dnf update -y

# For the Appstrem Metadata for the GUI Software Tools
sudo dnf groupupdate core -y

# Dem codecs
sudo dnf groupupdate sound-and-video -y

# FFMPEG
sudo dnf install ffmpeg -y

RPMFusion is where packages that do not directly align with Fedoras Ethos go. for both Free and Non-Free software.

1 Like

It is true. With Fedora I would add rpmfusion and youtube-dl directly from the official page, either with curl or pip. But it could be that the version of youtube-dl in rpmfusion, it is there, is not so old. The only way to package youtube-dl in Fedora is via rpmfusion anyway.