top | item 37474690

(no title)

jmondi | 2 years ago

yt-dlp has been awesome, but one thing I [admittedly havent tried to solve and] don't like about it is that it seems to default to unusual container types when downloading.

When using yt-dlp, I get a .webm file, and when asking for audio only using `-x`, I get an .opus file. Is there any reason for this?

discuss

order

ericol|2 years ago

That is because by default yt-dlp tries to download the best / better format available and (I take it the context of your downloads are YT) these are the best ones available.

You can customize which format to download by doing first:

yt-dlp -F <url>

Check what numbers are there, and then download the formats you want.

You can customize both the video format & rate, and same for sound, by using

yt-dlp #+# <url>

Where the first hash is the id of the video stream, and the 2nd hash is the id of the audio id.

Take into account that you'd probably need also ffmpeg available on the command line for this; that if you "mix" containers (Say, a webm video and an m4u audio stream) you-ll end up with an .mkv container; and finally, that all of the downloaded streams are themselves containers (.m4u, mp4 & webm).

thaumasiotes|2 years ago

> Take into account that [...] if you "mix" containers [...] you'll end up with an .mkv container

He's complaining about getting an .mkv in the first place, so this seems unlikely to solve his problem.

thaumasiotes|2 years ago

A .webm file is an .mkv file. You can rename to .mkv without any ramifications.

My guess would be that yt-dlp is giving you whatever file format it finds, with no editorializing. The default is just to go with "best quality" available. So "Is there a reason for this?" is likely a better question for whoever maintains the site(s) you're downloading from.

dylan604|2 years ago

i can imagine it's a bit of grandstanding for open formats vs the encumbered formats that are more popular.

hnarn|2 years ago

No. It’s simply going for the highest quality available.