Good MP3 or OGG Decoder written in C - c

Hey, I was looking for a good MP3 or OGG decoder that use the BSD license or public domain and that is also light-weight (something that comes with sources without the need of platform specific configuration).

You're not likely to find one for mp3 as there are a handful of licensing issues.
OGG is simply a container format that can hold audio, video, and more. Perhaps you mean ogg vorbis. Check out stb_vorbis. It's a free, public-domain C vorbis codec.

Like this one?

The Xiph.org libvorbis is available in pretty much every distro, and satisfies your requirement for a BSD-3-Clause license. "Light" is always relative... Also from Xiph.org available is libtremor, a integer-only vorbis decoder.

As other answers have mentioned, there are Vorbis decoders. The Fluendo MP3 decoder is MIT (simplified BSD) licensed.

Related

Simple C audio library

I'm looking for a simple-ish library for outputting audio. I'd like it to meet these criteria:
Licensed under LPGL/zlib/MIT or something similar – i'm going to use it in an indie commercial application and i don't have the money for a license.
Written in C, but C++ is fine.
Cross-platform (Windows, Linux, maybe OSX)
Able to read from some sort of audio file (i'd prefer WAV or OGG but i will gladly use less popular formats if need be) in memory (i've seen the use of a memfile struct and user-defined I/O callbacks). I need the file to be in memory because i put all my resources into a .zip archive, and i use another library to load those archived files into memory.
Supports playing multiple sounds at the same time, having a max of 8 or so is ok.
I'd really like to either have the source code or a static library (MinGW/GCC lib???.a), but if nothing else is available i will use a shared library.
I must have come accross two dozen different audio libraries in my search, all of which haven't quite met these criteria...
I would recommend PortAudio + libsndfile. Very popular combo, meets your requirements. Used by many other software applications including audacity.
Some of the candidates that immediately spring to my mind are:
SDL (there is a tutorial that demonstrates how to play a .wav format sound)
libav
ffmpeg
libao
OpenAL Soft
Jack Audio
You may have already looked at these and eliminated them, though. Can you give some more detail about the libraries that you have eliminated from consideration and why? This will help narrow down our recommendations.
You might want to look into SDL and SDL_mixer. Here is a good tutorial.
I've used SDL_mixer and it makes it easy to play background sounds or music and play multiple simultaneous sounds without having a need to write your own sound sample mixer.
I ended up using PortAudio (very low-level, flexible license) and wrote a mixer myself. See this topic i made on the C++ forums for some other people's tips on writing a custom mixer. It's not hard at all, really; i'm surprised that there are so many mixer libraries out there. For a breakdown of the WAV format (ready-to-stream raw audio data with a 44-byte header) see this.

Silverlight 4 Audio Compression

Any suggestions on how to implement Compression of captured Audio in a Silverlight 4 Application? I'd prefer something lossy like MP3 or AAC but after my intial research only turned out one lonely pure C# FLAC encoder/decoder, anything better than this would be nice.
Please note that sending uncompressed audio to the server and compress it there is not an option because of a) traffic cost and b) the audio is additionally encrypted by the client so the server never sees the source material.
I don't know of any implementations of proprietary compression algorithms in C#. You pretty much would have to implement your own. ADPCM is silmple and offers 4:1 compression ratio. More on the subject: http://forums.silverlight.net/forums/p/145729/374278.aspx
Does it have to be C#? LAME is a pretty good, very configurable MP3 encoding library.
http://lame.sourceforge.net/

Is there simple way to play an rtp video/audio stream in WPF?

I need to create a WPF control that will play an rtp stream with the requirement that the latency needs to be as low as possible.
I've looked at the following two projects:
http://vlcdotnet.codeplex.com/
http://wpfmediakit.codeplex.com/
As far as I know, I can't use VLC because we're shipping a commercial application with a more restrictive license than GPL (i.e. we can't ship our source).
Wpf media kit is nice, but I can't seem to find a good/free rtp directshow source filter and I wanted to ask if there is a simpler solution out there that I'm missing before I jump into writing my own.
Any ideas?
VLC uses the LIVE555 library for the RTP/RTSP side of things so perhaps that will be useful to you, it's licensed under LGPL. It is a C++ library so you'd have to get out pinvoke and since I haven't ever used the library I can't say how difficult that would be.
There is pjsip.net but looks like it's GPL since that's what the underlying pjsip and pjmedia are.
Here's a handy list of RTP stacks.
There's not simple solution that I've come across. I have made RTSP filter's in the past using LIVE555, but I don't think that falls into the realm of "easy".
I did see this on source forge, but I read comments questioning if it even works.

How do I encode video in Visual C?

I have a video decrypter library that can decode an obsolete video format, and returns video frames in BMP and audio in WAV through callback functions. Now I need to encode a new video in any standard format under windows.
What might be the standard way to do this? I am using Win32/C. I guess Windows has its own encoding library and drivers and I don’t need to use FFMPEG. Any pointer to an example code or at least to a library to look at will be greatly helpful.
Edit: I accept. FFMPEG is the easiest way to do it.
On Windows, you have two native choices.
The old Windows Multimedia library which is too ancient to seriously consider, but does have the Video Compression Manager.
And then there's DirectShow.
It's certainly doable through DirectShow, but you better enjoy COM programming and the concepts of Filters, Graphs, and Monikers (oh my). See this tutorial for a crash course:
Recompressing an AVI File
And the MSDN documentation.
A simpler approach is indeed to use an library like FFMPEG or VLC.
To save yourself heartache, I echo Frank's suggestion of just using FFMPEG. Executing a separate FFMPEG process with the correct arguments will 100% be the easiest way to achieve your goals of encoding.
Your other options include:
libavcodec - The central library used in FFMPEG. I warn there don't appear to be many Windows binaries of libavcodec available, so you'd probably have to compile your own, which, at minimum, would require a Cygwin or MingW set up.
ffdshow-tryouts - A video codec library implemented as a DirectShow filter based on libavcodec. They do seem to have an API for manipulating it, but it's a .NET library.
I would suggest looking at the VirtualDub source code. It's a well known encoder that uses VFW. You may be able to get some ideas from that software.

How do I play an ogg vorbis file in Silverlight?

I'd like to play back ogg vorbis audio from http in Silverlight. What do I need to make this happen?
A better answer than "Silverlight doesn't support Ogg Vorbis" is to say that Silverlight doesn't support playing them natively. As one of the other commenters pointed out, a way to play them is described at http://veritas-vos-liberabit.com/monogatari/2009/03/moonvorbis.html, with the current source for CSVorbis available at https://github.com/mono/csvorbis. You would indeed need to implement a MediaStreamSource to play the resulting PCM stream, but that's not rocket science.
Silverlight does not support playing ogg vorbis files.
If you'd like Silverlight to play files already encoded in ogg vorbis, I suggest converting them. Either do a one time sweeping convert of all your files, or convert them on the fly while your server is serving them.
Alternatively, In Silverlight 4, assuming you know enough about Media Formats and Ogg vorbis is particular, you can implement MediaStreamSource to support ogg vorbis.
http://msdn.microsoft.com/en-us/library/system.windows.media.mediastreamsource(VS.96).aspx

Resources