TeamNewPipe / NewPipe

A libre lightweight streaming front-end for Android.
https://newpipe.net
GNU General Public License v3.0
31.58k stars 3.07k forks source link

add mp3 support #507

Open m4iler opened 7 years ago

m4iler commented 7 years ago

Call me granddaddy McSquare, but now that MP3 is slowly moving from patent to free software, can we expect MP3 support? Not to knock M4A, but my player simply doesn't understand it and the podcasts I frequent are too large to be practical as video when it's just a still image.

Thank you for your answer, love your app! Helps me get off google that little bit more.

mauriciocolli commented 7 years ago

Youtube doesn't offer mp3 direct links, so the only alternative is converting it (we could implement the FFMpeg library, but I don't know when or if it'll ever happen...).

But did you tried the background player of NewPipe? It uses only the audio stream of the video saving a lot of data, and now that ExoPlayer is implemented (very recently, my PR was merged today), is more stable than ever, I think you should give a try.

m4iler commented 7 years ago

Fair enough, I suppose, until then I think I'm forced to use FFMPEG for Android, huh? Too bad there are no good alternatives on f-droid.

Seriously, though, keep up the awesome work, I love your app! Thanks to you I'm one step further away from Google.

On 19 Apr 2017 01:32, "mauriciocolli" notifications@github.com wrote:

Youtube doesn't offer mp3 direct links, so the only alternative is converting it (we could implement the FFMpeg library, but I don't know when or if it'll ever happen...).

But did you tried the background player of NewPipe? It uses only the audio stream of the video saving a lot of data, and now that ExoPlayer is implemented (very recently, my PR was merged today), is more stable than ever, I think you should give a try.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/TeamNewPipe/NewPipe/issues/507#issuecomment-295014820, or mute the thread https://github.com/notifications/unsubscribe-auth/AXP3NwQW8AlMFKJ6rgY2Ht9gTVqCHD9mks5rxUgegaJpZM4NA85W .

theScrabi commented 7 years ago

FFMPEG for Android, huh? Too bad there are no good alternatives on f-droid.

Yea an ffmpeg converter app on fdroid would be a serious and valuable addition to the repo. I'd realy loved to see something like that.

Also having an external app for converting things sounds much more covenient to me than putting ffmpeg (which is a huge thing) into NP.

That sounds interesting: https://trac.ffmpeg.org/wiki/CompilationGuide/Android

darkon5 commented 7 years ago

Not to knock M4A, but my player simply doesn't understand it

Android natively supports AAC on M4A containers. Maybe something is wrong with your player?

Source: https://developer.android.com/guide/topics/media/media-formats.html#core

utack commented 7 years ago

@m4iler what happens when you rename the m4a to mp3 or aac manually?
I know this is not a "clean" solution, but that might just force your player to open it and play it
Or grab vanilla from F-Droid

SkyzohKey commented 7 years ago

Couldn't this be solved by using a webservice to convert the song instead of embeding ffmepg in the app ?

theScrabi commented 7 years ago

Uch ... than you'd have to upload it to some muddy service. I don't like this solution.

But we could make someone implement a proper android fronted for ffmpeg.

ghost commented 7 years ago

@theScrabi: Wouldn't that make the NewPipe binaries much bigger? Or will you provide it as an optional add-on? If you'll provide it as an optional add-on, how will you do that? I can think of 2 ways:

  1. Add some button in the app to download the add-on (from GitHub?)
  2. Create another app (without a launcher intent) that you'll publish at F-Droid and communicate with that (btw does F-Droid allow different packages for different architectures?)
theScrabi commented 7 years ago

I'd like to have an app that provides ffmpeg, so we could write an interface to that app. So second choice.

SkyzohKey commented 7 years ago

What about a converter hosted on your, website?

theScrabi commented 7 years ago

@TheAssassin would kill me, because everything runs on his server. Also I don't want to make anyone depend on infrastructure I provide.

utack commented 7 years ago

I still don't believe there is an Android media player out there that does not support ogg/vorbis or aac/m4a
Maybe you just need to trigger the Android Media Scanner after each download, so it shows up?
I think that is usualy only done when USB is connected and disconnected?

SkyzohKey commented 7 years ago

Good idea, but MP3 allows better ID3 tagging I guess.

ghost commented 7 years ago

@utack: On some devices there's also a refresh button in the music player. Btw you could also trigger it with some code.

TheAssassin commented 7 years ago

There's several issues with this feature proposal. Below I point out most of them. TL;DR: Bad idea, don't implement it.

But the most meaningful argument that I can come up with to prevent you from implementing it is the following.

Downloads of copyrighted material are usually not prosecuted as there's too many of them and it's not really worth the effort. But as soon as you change the material, it can get dangerous.

E.g., you convert a file, the converter puts some information on who did it into the file (yes, that's happened in the past with some "freeware" (maybe they wanted to track their software usage or something), some people have been sued (I'd try to find the link if anyone cares, but it was quite a while ago, even if I wouldn't find it, it's a realistic scenario)). Then, if the people sent it to a friend who sent it to a few friends etc etc, police might somewhen get hands on these files, and try to find the origin. That might cause serious trouble for those people.

Sure, you can blame the users for breaking laws there, but to be honest, most users are quite unexperienced and (sorry, I didn't find another word), naive, and as a software vendor, I'd try to protect my users from such stuff. You shouldn't make them break law even more. Downloading is primarly an issue for YouTube as the hoster, but they are a huge company and can deal with it accordingly. Anything that happens after that is risky.

Us software devs have the responsibility for protecting users from such stuff. Please think about this feature, and try to compare costs and benefits of implementing this. This is just an advice, and I don't want to prevent anyone from implementing it, but primarily make you think about it.

(Side fact: In Germany, it should be fine to save and even convert the files for private use, as they are validly licensed via YouTube and thus can be saved for offline use (it's called "Privatkopie"), as long as you don't share them with anyone (even family users would have to download and thus create their own copy) and use them for private purposes only (e.g. listening to it with friends). But most other countries don't have something like that in their copyright laws. So yeah, try to avoid such stuff.)

But, if the executives of the project consider it more useful than risky (democracy ftw), please don't use MP3 or AAC, use something open such as Vorbis (it's in the list @darkon5 linked to) . They are way less problematic in so many ways, well supported and we should spread the spirit of patent less open-source (and even public domain) code.

utack commented 7 years ago

@TheAssassin forgetting the most obvious reason to not implement it:
Lossy to lossy conversion to support some odd legacy music player that can't deal with audio formats introduced almost two decades ago is a major waste of ressources

TheAssassin commented 7 years ago

I disagree, @utack. Your statement isn't really scientific, please let me explain why that is not an argument against this feature proposal.

First of all, it isn't our decision what people do on their phones. The only waste of resources with pointless conversions could be electric energy and CPU cycles. But it would even save resources on the flash storage of a phone, considering that a file encoded with a lower bitrate (or a more modern encoder) will consume less space. So that argument isn't valid.

Also, lossy to lossy conversion doesn't necessarily decrease the file quality in a way so most people would hear a difference between the files. In fact, most users don't even care much. And in these cases, conversion can make a lot of sense. Also, 320kpbs MP3's quality is pretty good (most DJs use that instead of lossless for example), such files can be converted to other formats without much loss either. So, if you got some high quality files, and just need another format (same quality level), a conversion can make sense, too. Newer codecs can reach a way higher quality with a lower bitrate.

Also, DACs in smartphones are far from high fidelity, so I think you don't really need to think about quality losses due to conversions.

darkon5 commented 7 years ago

AAC has been proved to provide better filesize at the same bitrate as MP3 using the latest encoders. And yes, lossy to lossy decreases content quality by a significant margin (MP3 directly cuts above 20 KHz, for example).

IMHO what people want their files to be encoded at is not NewPipe's concern, as it's just a tool to scrap content from Youtube. And Youtube is using AAC for a reason.

Source: I'm a DJ, musician and a huge music collection owner.

PS: You'll never see a DJ who used a MP3 reencoded from a AAC. Only lossless to lossy.

TheAssassin commented 7 years ago

@darkon5 your statement about less filesize for the same quality is true, but not the way you describe it: the bitrate must be lower for an AAC file to be smaller, like MP3 bitrate > AAC bitrate. This is due to how bitrate is defined: amount of bits per second.

Sure, (real) DJs or audiophile people avoid reencoded files for a reason. But still, for the reasons I pointed out, this argument doesn't really matter for the average smartphone user, because 1) they don't hear the difference and 2) the hardware isn't good enough to hear a difference even between lossless and say, 256 kbit/s MP3.

The psychoacoustic effects that MP3 uses for its perceptual audio coding are lossy, right, but any frequency above 20 kHz cannot be heard anyway by humans (average human being hears up to 16 kHz, young people up to 20 kHz). What makes MP3 really lossy are the masking effects that MP3's psychoacoustic model describes, i.e. frequencies which are masked are encoded with lower precision by audio coders, thus information are lost.

Audiophiles don't use phones to listen to music anyway, they buy and use proper hardware. All these pseudo DJs with their iPads who feel cool because they can get two channels from a single audio plug with an adapter because they combine two mono channels for the stereo output which is split by an adapter so they can use their overpriced fully automated apps...

I fully agree about the separation of concerns, as stated above.

By the way: MP3 is a free standard now! As Fraunhofer IIS announced recently, the patents are EOL now: https://www.iis.fraunhofer.de/en/ff/amm/prod/audiocodec/audiocodecs/mp3.html So that's definitely not going to cause problems ever again.

My background by the way: my current job is about audio coding and communication, so I have quite a background in that, too. Also, I'm a hobby DJ and musician, too, and occasionally host some live events.

utack commented 7 years ago

@TheAssassin youtube's highest bitrate for stereo audio is somewhere in the 128kbit/s range, the lowest bitrate is around 50kbit/s
So if people are really desperate for some few megabytes, adding the option to download the smallest opus file is the option to go for, not downloading the 128kbit/s opus first and then converting to to 50kbit/s mp3

anilgulecha commented 6 years ago

I have a usecase for transfering long talks to a device which only supports mp3 as the format. So if it's possible to include an mp3 encode in the app, this would be a much used feature.

theScrabi commented 6 years ago

Answer to this here. Well get there eventually :D

theScrabi commented 6 years ago

serveimage

https://github.com/brarcher/video-transcoder/issues/42#issuecomment-377742178

theScrabi commented 6 years ago

@brarcher notified us that the upcomming version 0.8 of video-decoder will have an intent interface which we call, so now we can finally start and implement this: https://github.com/brarcher/video-transcoder/issues/42#issuecomment-390452786

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

xlotlu commented 5 years ago

This issue is still of interest, as old devices are still in use, and sometimes impractical to upgrade.

My use-case is playing the files on the car stereo, which only supports mp3. (and it's really not all that old...)

opusforlife2 commented 4 years ago

@TobiGr @Stypox I think it's been decided overall that it is outside Newpipe's purview to transcode media. Should this and related issues be closed?

Stypox commented 4 years ago

I think this issue has the "help wanted" label, that is, if someone finds a small embeddable mp3 converting library it would be ok to use it

BrajBliss commented 3 years ago

Is this still not available? Because I don't see mp3 download option @mhmdanas

Stypox commented 3 years ago

The issue is open, hence no

ghost commented 2 years ago

youtube-dl can currently convert to MP3 using the --audio-format flag. As for libs which can convert ffmpeg is probably the way to go. Those looking for MP3s check out Spotiflyer.

renezito commented 1 year ago

Hi! Thanks for this great app and the way you Made it (order and configuration details we can set). About download audio in mp3, You say that the size will increment a lot. Take a look to this size comparison between NewPipe and Videoder (a great app to download video and audio in mp3 format from different sites, unfortunately it stopped working). The size is the same :-) So I think u can add the library :D

https://drive.google.com/file/d/17DjYSxikl6sZ2uWAEd5cujY_MaT7CAAR/view?usp=drivesdk