QAudioCoder - Qt audio decoding, encoding and conversion
-
For a while now a lot of people requested a feature for audio decoding, encoding and conversion. Projects like GStreamer and FFMpeg offer these functionalities, but are often very difficult to use. For this reason and personal bad experience with the stability of FFMpeg, I’ve decided to create a Qt based library for this - QAudioCoder.
This library is aimed at novice users with an easy-to-use interface (QAudioCoder). I do not claim that this library is in any way the best one out there, but it provides a quick solution for people who are not familiar with all the other external libraries and codecs. QAudioCoder automatically searches for the required libraries during runtime and only provides the codec if found. I’ve added numerous default search paths (mainly for Linux – Ubuntu and Fedora), but additional paths can easily be added.
The library currently requires CMake 2.8.8 and Qt 5, but with a few changes to CMakeLists.txt, QAudioCoder will fully function with older CMake and Qt versions. Due to the lack of “official” support for the new Qt and CMake versions on most operating systems, no binaries and installers will be released yet. Once everything is fully supported, I’ll release installers (.sh, .deb, .rpm) and the binaries (.dll, .so, .dylib)
- Name: QAudioCoder
- Developer: Christoph Stallmann
- Parent project: Visore ("http://www.visore.org":http://www.visore.org)
- Current release: 0.1.0 (20 July 2012)
- License: LGPLv3
- GitHub: "http://github.com/visore/QAudioCoder":http://github.com/visore/QAudioCoder
- SourceForge: "http://sourceforge.net/p/qaudiocoder":http://sourceforge.net/p/qaudiocoder
- Homepage: "http://www.visore.org":http://www.visore.org
- Email: qaudiocoder < at > visore.org or qaudiocoder < at > gmail.com
- Supported formats:
WAVE (always), MP3 (only if Lame is installed), FLAC (only if Flac is installed).
8bit, 16bit and 32bit sample sizes.
Mono and stereo.
-
Really like this library. It will probably be very useful for an application I am working on. I have already made a wrapper to the codec2 format which I am using but would like to add other format support and your library will be very useful. It would more sense for me to adopt this and then contribute wrappers for the formats I want.
Can I make a suggestion? Why don't you extend QIODevice rather than just QObject and that way you can let users write too the converter using more standard Qt. An example of this is in the wrapper I wrote http://gitorious.org/virtual-voice-net/virtual-voice-net/blobs/master/encodedev.cpp
I like this as you can then chain either a file device or something like a QAudioInputDevice on to the encoder and then to a file or out to a QAudioOutputDevice. Could still support your existing API but just inherit QIODevice and Re-implement the needed methods.
Over the next few weeks I will look at changing my app to use your library and then implement a codec2 wrapper. I also would be wanting a speex wrapper as well. My app is all about voice so less interested in the music type codecs.
Would like to see this submitted upstream maybe as a plugin.
Well done on this.
-
Didn't think anyone would use it. :-)
I currently extract the code from my main project (Visore), that's why most classes inherit from QObject. I'm currently working on a new middle-process. The codecs and the main interface (facade) won't change, but the middle processing chain is currently (according to my standards) very poorly implemented (was under time pressure).
I'll keep your ideas in mind when doing this. There were some thread-related issues that caused problems when directly using QIODevice, but there is definitely a very clean solution to this.Just let me know when you implement a wrapper for any other codec. I'll then incorporate it directly into QAudioCoder and if anything small changes I'll just adapt it. I'll hope I get a proper development guide out sometime, but for now: the coders use the strategy and template design patterns so you only have to implement isolate functions. There are currently individual functions for 8bit, 16bit and 32bit encoding/decoding. I want one universal function for this, but it caused some more issues with cross-compatibility. Just the Lame and Flac encoders are totally different which makes generic coding very difficult
I will work on my project for at least another 2 years. If you really want to use this, I’ll put a little bit more effort into this (eg: clean code, proper thread management, QIODevice instead of QObject, proper documentation, etc). I probably update QAudioCoder every week, but I never push it to the public SourceForge/Github repositories since I assumed no one will use it any way. So if you really want to use it, I’ll do some regular pushes to the main repo. -
Hey there,
I just found your project. I am looking for a way to encode audio data using Qt. I have tried to get along with ffmpeg, but i feel like getting into it is not for beginners. There is rarely information about how to get it working. So i would like to give your project a try.
Is there an (easy) way to get it running with Qt 4.8? -
The project was built with Qt5. The library itself should run with Qt 4.6 or higher. I can't remember using anything that is new in Qt 5. You might however not be able to build the example programs with older versions of Qt (but you can give it a try). Also, if you are not using CMake, you should still be able to (easily) build the library). There is nothing special during compiling of the library, just make sure you include the "external" headers and do the necessary moc-ing.
The library as-is should work, I’ve done a lot of testing. The middle layer is however not as efficient as it could be. Let me know if you are able to do your tasks with the library. If there are a couple of people interested in it, I’ll optimize and clean the library and create a “better” version.
-
And I will be changing the license to GPL soon, enforcing open-source use. If you want to use it for commercial applications, please contact me first.
-
Yes, it is actually there, but it is not part of the "public" API. I'm not sure why they don't try to make it public. If you struggle, let me know.
-
Originally it was all toLatin1(), but then for some reason they removed that function in Qt 5.0 and added a toAscii() function. Now it seems they've changed it back in 5.1.
It might take a while until I make a new release, but you could simply to a grep search and replace all instances of toAscii() with toLatin1(). It should then compile and run. -
And make sure you get the latest checkout from GitHub, I rarely update SourceForge.