-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add mp3 encoding and/or decoding support #2000
Comments
Some general questions.... Since the majority of proprietary OSs already have mp3 playback and encoding support (i.e. ripping mp3s with iTunes, Windows Media Player, playback) is licensing an issue on those platforms that already have the capabilities? Furthermore are there any methods that provide fallback on an existing API? Last, how much is unlimited licensing? Could we kickstart the licensing costs to cover ourself legally? (Does the paid license allow the use of a 3rd party implementation such as LAME?) |
http://gstreamer.freedesktop.org/documentation/plugins.html, looks like Gstreamer uses LAME for encoding mp3, and libmad for decoding. Both listed as "ugly", i.e. distribution might pose problems, license- or patentwise. So, adding gstreamer would be quite a lot of stuff just to end up using LAME.
US$ 15k/year minimum, $0.75/unit for decoding, $2.50 to have it both ways. |
Honestly.. is it worth the hazzle /hazard |
15k a year minimum, is alot, If we added this feature, we would then have the added stress or raising this money every year, I am not sure kickstarter would raise that sort of money just to add mp3 to an already existing project. I would not expect kickstarter to raise this year after year for an already implemented feature. A thought that I just had, was to offer an option on export to open the .wav file in a 3rd party program (ie audacity) where the user can do the encoding. Ive not looked into it, but maybe it's possible to do this on import aswell. As for importing mp3's into a Daw, I personally feel this is not good practice to encourage the use of lossy compressed audio, the encoding artifacts seem to stack up when multiple samples are used, maybe its good to make users think "why have I got to convert this this mp3 before i can use it". I know it is possible to get decent quality mp3 at 320K, but most are not, generally 320k. I guess what I am saying is, thats a lot of money we have to find. The 3rd party route may be possible, but I would like to see some real legal advise ( not something someone once said in a forum etc). LMMS afaik is not a limited company, So it could come down to individual responsibility. I would hate to see anyone here having to go thru a costly legal battle. With 1500 download per day, we are far to big a project to "chance it". From what I have seen we are one of the larger open source audio projects, we are not under the radar and would be a prime target to make example of. On a more positive note, If we can do this properly, I feel it would be great to have as mp3 is a very common and popular format, and we are somewhat lagging behind on this. |
Thanks for the licensing research... I think the vast majority of our proprietary OS users are already licensed for decoding and encoding as the licensing costs are covered by Microsoft, Apple. libaudiodecoder Here's a project which claims to leverage the licensed versions of the libraries already on the OS (originally part of the mixxx project): The license is MIT, so I think we'd likely need special permission to re-release it as GPL. Allegro Here's another project which may have hooks to the correct DirectShow libraries on Linux, created primarily for game development: The license is a "do what you want" license, so we should have the ability to re-license it. They recommend a "pay it forward" or "giftware" usage, which we're not bound to, but we'd likely comply with by patching stuff upstream if we were to use it. Windows DirectShow Or we roll our own GPL version of the same libary... Here's a C++ example for Windows to use the built-in MP3 decoder library, assuming mingw has support (there's a good chance mingw does not have DirectShow support)
irrKlang This one is just bazaar. It is very cheap to use and they have options for "free", "cheap" and "hobbyist" projects, but I highly doubt they'd offer up a GPL version of the code. |
The option of opening a wave in audacity (or another program) sounds But I really like @tresf's idea of using the OS licenses if that turns out
|
How about a command line equivalent instead of having to use a GUI program such as Audacity. Openshot video editor uses Blender in the background ( i think through python scripts ) for rendering of animated titles. The problem would perhaps be making this cross platform? http://sox.sourceforge.net/soxformat.html << Sox looks interesting, but the original problem of damn mp3 patent is obviously still there. Same deps tho as many others. |
@mikobuntu great idea. It's pretty easy to execute something of the form
|
Unless we're doing batch conversion, I strongly disagree with this approach, at least for MP3 features topic... Here's why:
I just think it's a last-ditch effort to use the CLI to render something and I don't think this approach should be considered as it sounds like a Rube-Goldberg approach to a very simple problem.
I looked into this a bit more and it appears you are right @Wallacoloo and they are compatible, that the overwhelming response I'm reading. 👍 I do fear that the code links against Microsoft Headers (rather than MingW headers) which would be a snag when building windows binaries on Ubuntu. |
@tresf, keep digging 👍 libaudiodecoder: Allegro: Windows DirectShow: irrKlang, http://www.ambiera.com/irrklang/features.html:
|
@softrabbit here's something I read from a libaudiodecoder dev per https://plus.google.com/+RJRyan/posts/5QgqTsjJqXA.
Although I don't have the capacity to code this all in, I agree with this statement. Linux MP3 isn't really the problem as the user has to intentionally install the Bad/Ugly codecs which the OSs put up plenty of warnings against and it would be something we offer support for, but don't ship with in terms of potentially licensed binaries. |
What about making a US version (without MP3) and a rest-of-the-world version (with MP3)? |
The advantage of the "cli" approach is that it frees the developers of most responsibility for users breaking their local laws. That is, since such a feature wouldn't be targeted specifically at mp3 encoders or decoders, we are less liable if it gets used for illegal mp3 encoding. It's kind of like if a c++ compiler compiles a binary that is used to bypass DRM, the compiler writers aren't held accountable. But if the compiler specifically exposes functions to bypass DRM to programmers, then the compiler writers could be accountable. Similarly, if we just launch a user-defined program with user-defined arguments, we probably wouldn't be held accountable if the user uses that feature to aid them in encoding mp3s illegally. OTOH, if we specifically support LAME as a plugin, we might have some accountability. But of course, I am not a lawyer. |
libaudiodecoder looks like a good solution in terms of avoiding liabilities to me though. |
My vote is for Gstreamer. |
FL Studio use LAME!? |
Cooler name = My vote. |
I think this issue can be worked on now. The patents for mp3 have expired: https://www.iis.fraunhofer.de/en/ff/amm/prod/audiocodec/audiocodecs/mp3.html
So we're now completely free to use mp3 in LMMS |
Well... technically we've always been free to use mp3 in LMMS. Now we are potentially free to bundle mp3 libraries too. From wikipedia:
This is all good news. We should be able to offer LAME support on all platforms quite easily. |
I have found a CMake find script for lame here:
I guess it would be integrated quite similar to the Ogg Vorbis support. |
And here's a simple example on how to use the library: https://stackoverflow.com/questions/2495420/is-there-any-lame-c-wraper-simplifier-working-on-linux-mac-and-win-from-pure/2496831#2496831. |
Implement MP3 encoding for the song export when exporting via the GUI. The current implementation provides the following options to the user: * Setting the bit rate * Setting whether a variable bit rate should be used Using MP3 encoding for command line exports is currently not supported and it's also not possible to import MP3s as samples or for the Audio File Processor plugin. MP3 export is currently only enabled for Linux build, i.e. it is disabled for Windows and OS X builds. Technical changes: Add a new CMake module FindLame.cmake. Add the option for MP3/Lame to the CMakeLists.txt and adjust all other related CMakeLists.txt accordingly (adding include paths and libraries to link). Add a new class AudioFileMP3 which contains the Lame specific code. Register this new class in the list of export devices in ProjectRenderer. Add a new enum to ProjectRenderer::ExportFileFormats. Adjust ExportProjectDialog to show the appropriate widgets when MP3 is selected as the export format. To simplify this all widgets related to the sample rate have been put under a new parent widget which can then be hidden or shown (see changes in export_project.ui). Other changes which are not directly related to the MP3 functionality: Fix a bug where Ogg Vorbis was offered in the file selection dialog during export even if Ogg Vorbis has been disabled. Add a method FileEncodeDevice::isAvailable which abstracts away the checking for the factory method.
Implemented with #3615 for the export via the GUI. Export via the command line is not supported yet and might be covered by a new issue once #3615 is merged. MP3 import is also not covered by #3615 and should also go into a new issue. For now MP3 support is disabled for the Windows and OS X build because I assume that Lame will first have to be added to these environments. Edit: Added the info about the Windows and OS X build. |
Add libmp3lame-dev to the list of packages that are installed before the build.
|
@tresf The windows build is not disabled completely, it's just always building without MP3 support. I guess once @tobydox has added lame to the PPA we can simply adjust the |
I know, I'm asking you to stop doing that. Cmake is smart enough to know if it's there. Forcing off is pointless. |
mingw[32|64]-x-lame is now available at https://launchpad.net/~tobydox/+archive/ubuntu/mingw-x-trusty - might take a few minutes until package has been published |
Command line export is implemented via #3641. |
I have checked the second box for "Export song to mp3 via CLI" because #3641 has been integrated into stable-1.2. |
Done. Using libmpg123. |
@gi0e5b06 when you say 'done', you are referring to export -right? |
@musikBear What @gi0e5b06 says is he/she have implemented the import feature on the fork( FYI, I'm willing to write my own code for importing mp3, if @gi0e5b06's one turns out to be inappropriate. |
https://github.com/lieff/minimp3 looks like another good candidate. |
It looks the library is suitable for decoding, but it can't parse ID3 metadata tags. It supports skipping ID3 tags while detecting MP3 frames, though. One more news: |
It would be great to get import support for mp3 nowadays most audio files are in mp3 format and it would make it a much better experience |
No! MP3 is a sc Lossy format. It means that if you use MP3 as sample, you do not get the full dynamic sound, you get a 'subset' of that sound, because MP3 is compressed! |
@PhysSong why do we need ID3 parsing for import? |
I understand that other file formats are better but mp3 is the most used format and supporting it in lmms would make it easier to use and help new producers have better experiences. When I first was making beats on LMMS I would get samples from packs and alot of them are in mp3 and also downloading samples from YouTube. |
could you add #6750 here? |
Hello. This thingy with 7k stars still has no mp3? |
It's in the works. #6750 |
edited @tresf, added checklist
The MP3 patents have finally expired. Since LAME is available on all platforms, LAME will be used and bundled to provide this functionality.
The discussion on #1471 recently led to some talk over the possibility of supporting the mp3 file format (specifically in decoding samples, but it also has use as an export option).
For those that don't know, there are a variety of patents associated with encoding and decoding mp3's. In order to do either option, you must obtain a license. These patents are all scheduled to expire in the U.S. sometime before 2018 (the last one expires 30/Dec/2017), according to this source. Other sources (liftarn's comment) indicate that September 2015 is the month that mp3-related patents expire in the U.S. However, the patents have already expired in most other countries, and may have never applied to some countries.
LAME
Now, there is a non-commercial (LGPL-licensed) mp3 encoder/decoder, LAME. According to Wikipedia, distributing LAME in compiled form along with LMMS would likely be in violation of the US patents. A popular open source tool, Audacity, is able to provide mp3 encoding through LAME by detecting its presence on the system at runtime instead of shipping precompiled binaries. They explain the reasoning briefly at the top of this page. This appears to remove responsibility from the developers of Audacity over patent licensing, instead pushing that responsibility to the users that are affected (i.e. U.S. users who download LAME). Additionally, that same page says that Thomson (the patent enforcer) permits mp3 encoding for "personal" use, which a decent portion of LMMS users do.
So if we want mp3 support before the patents expire, we could go with a similar approach to Audacity if all the developers are comfortable with it. I sure am not a lawyer, so I can only judge based upon prior projects, of which Audacity is a relevant one to reference.
Gstreamer
Another option to supporting mp3's is through gstreamer. gstreamer is essentially a plugin-based audio routing library. As such, it provides plugins for both encoding and decoding a variety of audio formats, including mp3.
Historically, I think Gstreamer has been more linux-oriented, as it was adopted by the gnome project fairly early. But it claims to support OS X and Windows plus mobile.
I wish I knew more about this option. All I can say is that it seems like a more generalized approach to encoding and decoding that happens to support mp3's.
Anyways, feel free to discuss your opinions or concerns about mp3 support in lmms, whether you think it's worth adding now or best to wait for the patents to completely expire, and which implementation approach might be the best. Also, clarifications on the expiration dates or legal issues are much appreciated if you have that knowledge.
The text was updated successfully, but these errors were encountered: