flecs icon indicating copy to clipboard operation
flecs copied to clipboard

Download music without any conversion

Open Rubecks opened this issue 2 years ago • 6 comments

Looks like the download plugin downloads the highest bitrate audio it can find with youtube-dl and converts it to mp3 or opus with FFmpeg based on your settings, right?

So, this makes sense for mp3, but YouTube uses opus and aac, and they are lossy formats. Converting lossy to lossy is a bad practice, you are reducing the file quality 2 times (YouTube converts the upload on their side, and FFmpeg converts it again), 3 times if the uploader sent a lossy audio too. And there's no reason to convert to a format that YouTube already provides.

So, I wanted to ask for a change on this plugin: to make it download the highest bitrate opus file available and skip the conversion, preserving the original file. Then add an option to make the same thing with aac files.

Rubecks avatar Jan 24 '22 12:01 Rubecks

Seems you can now choose to download opus files in 1.15, which should mean no conversion?

CTalvio avatar Jan 24 '22 14:01 CTalvio

Seems you can now choose to download opus files in 1.15, which should mean no conversion?

I could be wrong here, I don't really know how to code that much, but reading the downloader plugin's util.js, looks like it just parses arguments to FFmpeg:

// Presets for FFmpeg
module.exports.presets = {
	"None (defaults to mp3)": undefined,
	opus: {
		extension: "opus",
		ffmpegArgs: ["-acodec", "libopus"],
	},
};

Rubecks avatar Jan 24 '22 15:01 Rubecks

That is correct, libopus is the default encoding format that googlevideo uses, main fallback being aac.

MulverineX avatar Feb 04 '22 06:02 MulverineX

Hey guys, so it seems the opus preset solves this issue and we can close it?

th-ch avatar Apr 08 '22 13:04 th-ch

Hey guys, so it seems the opus preset solves this issue and we can close it?

Not really. The problem with the preset is that it stills converts the audio. The program downloads the opus file from YouTube, and then it converts it to opus again locally with ffmpeg. To solve this, the ffmpeg conversion step should be skipped completely.

There's another way too, to check if the source file is an opus stream, and parse arguments to ffmpeg to just copy the audio to another opus container, instead of converting. But the only reason to do this is if the conversion step is totally necessary to the way the plugin is written.

The check is necessary because YouTube Music offers audio in m4a/aac with a higher quality than opus too. So a possible m4a profile would need this check too.

Rubecks avatar Apr 08 '22 17:04 Rubecks

Download defaults to 128kb for me. I have Youtube Premium and quality set to highest. I'd like 320kb minimum ideally.

beljim avatar Jun 06 '22 11:06 beljim

in #1054 opus isn't "re-converted"

Araxeus avatar Mar 04 '23 12:03 Araxeus