Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download music without any conversion #570

Closed
Rubecks opened this issue Jan 24, 2022 · 7 comments · Fixed by #1054
Closed

Download music without any conversion #570

Rubecks opened this issue Jan 24, 2022 · 7 comments · Fixed by #1054
Labels
awaiting-reply Awaiting reply

Comments

@Rubecks
Copy link
Contributor

Rubecks commented Jan 24, 2022

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.

@CTalvio
Copy link

CTalvio commented Jan 24, 2022

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

@Rubecks
Copy link
Contributor Author

Rubecks commented Jan 24, 2022

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"],
	},
};

@MulverineX
Copy link
Contributor

MulverineX commented Feb 4, 2022

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

@th-ch
Copy link
Owner

th-ch commented Apr 8, 2022

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

@th-ch th-ch added the awaiting-reply Awaiting reply label Apr 8, 2022
@Rubecks
Copy link
Contributor Author

Rubecks commented Apr 8, 2022

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.

@beljim
Copy link

beljim commented Jun 6, 2022

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

@Araxeus
Copy link
Collaborator

Araxeus commented Mar 4, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-reply Awaiting reply
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants