Java audio converter api - audio

I am looking for a comprehensive API in Java that can convert audio across various formats and bitrates.
For example
WAV (6kHz to 48kHz) L16/audio ---TO--- WAV (RIFF header) 8KHz 8-bit mono A-law/U-law
AIFF (6kHz to 48kHz) L16/audio ---TO--- WAV (RIFF header) 8KHz 8-bit mono A-law/U-law
and other voice audio formats.
Any other suggestions about similar Java libraries on audio conversion are also entertained.

I was able to solve this problem by using Tritonus : Open Source Java Sound API and its wide range of sound convertor plugins.
Specifically the Tritonus miscellaneous plugins was very useful in my context.

Related

Platform support for arbitrary codecs in HEIF

Apparently, the hip way to define a new image format is to combine the ISO base media file format with an existing image or intra-frame video codec, generalized in HEIF / MIAF with existing explicit HEVC, AVC and AV1 adaptations. JPEG 2000 employs ISOBMMF in a different way.
Can I expect platforms (i.e. operating systems, browsers, ...) that support HEIF in general and a random codec in general to support the specific combination of both as well? or does every codec need custom boxes/atoms?
For instance, could I simply put VP8 or VP9 streams, as known from WebM and WebP, into a HEIF container? or more ancient, exotic or futuristic video codecs like MPEG-1/2, ASP, Ogg Theora, Daala, Thor, Dirac, Cineform, VVC, EVC? What about JPEG XL/XR/XT/LS/2K, PNG or even BMP/RLE still images?

MIME type of mp3 file using Speech to Text

I am using speech to text API of Watson. Initially I used a .wav file but I want to use a mp3 file. So I want know the MIME type of mp3 file for specifying the content type?
You can see within official documentation the Audio formats support is:
Audio formats: Transcribes Free Lossless Audio Codec (FLAC), Linear 16-bit Pulse-Code Modulation (PCM), Waveform Audio File Format (WAV), Ogg format with the Opus or Vorbis codec, Web Media (WebM) format with the Opus or Vorbis codec, mu-law (or u-law) audio data, or basic audio.
Check: MIME Types for Speech to Text.
One good idea to use your mp3 audio is to convert before sending for the API.
And, depends on what you want, you can use this article. In this article, Jason shows how to use mp3 with Asterisk to send the voice audio for Speech to Text. I'm not sure if works yet.
EDIT: [10/2017]
A few days ago, Watson Speech to Text release one new version that supports mp3 input features.
Check the audio formats supported now:
Audio formats: Transcribe Free Lossless Audio Codec (FLAC), MP3 (Motion Picture Experts Group, or MPEG) format, Linear 16-bit Pulse-Code Modulation (PCM), Waveform Audio File Format (WAV), Ogg format with the Opus or Vorbis codec, Web Media (WebM) format with the Opus or Vorbis codec, mu-law (or u-law) audio data, and basic audio.
See the Official documentation talking about here.

How do I create an mp4 file from a collection of H.264 frames and audio frames?

I have a program that captures and stores H.264 encoded video as well as audio into a proprietary format file. I need to be able to export that video and audio to an mp4 file. I prefer C# but will use C++ if necessary. Any suggestions?
To produce MPEG-4 Part 14 .MP4 file you need a multiplexer. There is a choice of multiplexers out there:
FFmpeg (libavformat)
DirectShow filters (free and open source from GDCL, commercial)
Windows 7+ Media Foundation file sink
API and complexity might vary because some of multiplexers are expected to be a part of pipeline, they are not completely standalone classes. You might want to check respective samples (and license agreements, perhaps, too) to see what is best for you.
Take a look at libmp4v2. Fairly straightforward to use..
http://code.google.com/p/mp4v2/

Does MPMoviePlayerController support AVI format in iOS?

I'm able to play .mp4, .m4v formats using MPMoviePlayerController, but its not playing .avi format. MPMoviePlayerController internally would use QuickTimePlayer and this QuicktimePlayer would support AVI format, then y not MPMoviePLayerController API?
Thank You,
Suse
AVI is a container format. It can contain many different audio/video formats internally, most of which iOS does not support natively.
You may be able to decode the contents of your .AVI using the ffmpeg library. Note, however, that decoding video using ffmpeg will drain the battery considerably faster than normal, as it cannot take advantage of the hardware acceleration that MPEG4 decoding uses, and using ffmpeg may subject your application to software licensing complications (as ffmpeg is licensed under LGPL, with some GPL and non-free components).

Decode G711(PCM u-law)

Please bear with me as my understanding of audio codec is limited.
I have this audio source from a IPCAM (through a htto//... CGI interface).
I am trying to write several client programs to play this audio source on Windows, MAC, as well as Android phone. The audio is encoded in G711 (PCM ulaw).
Do I need to decode the PCM audio data to a raw audio data before I could pass it to the audio engine to play? If so, is there some sample code on how to decode it?
I am confused as somehow I believe PCM is already RAW. Could I just feed it directly to the audio engine on Android for example?
thanks much in advance
It depends on what API you are using to play sound, but most require linear PCM and you have µ-law PCM, so unless your API supports µ-law playback you will need to convert the µ-law sample values to linear.
With G.711 the compressed µ-law samples are 8 bits and these will be converted to 14 bit linear values which you will store in a buffer as 2 bytes per sample. There is a brief description of the µ-law encoding on the G.711 Wikipedia page.
You may find this useful:
u-Law companding algorithm in C

Resources