public class PipeDecoder
extends java.lang.Object
Decode audio files to PCM, mono, 16bits per sample, at any sample rate using
an external program. By default avconv, provided by libav is used. Other
command line programs that are able to decode audio and pipe binary PCM
samples to STDOUT are possible as well (ffmpeg, mplayer). On Debian: apt-get install libav-tools
This adds support for a lot of audio formats and video container formats with relatively little effort. Depending on the program used also http streams, rtpm streams, ... are supported as well.
To see which audio decoders are supported, check
avconv -decoders | grep -E "^A" | sort
avconv version 9.8, Copyright (c) 2000-2013 the Libav developers
built on Aug 26 2013 09:52:20 with gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)
A... 8svx_exp 8SVX exponential
A... 8svx_fib 8SVX fibonacci
A... aac AAC (Advanced Audio Coding)
A... aac_latm AAC LATM (Advanced Audio Coding LATM syntax)
A... ac3 ATSC A/52A (AC-3)
A... adpcm_4xm ADPCM 4X Movie
...
Constructor and Description |
---|
PipeDecoder() |
PipeDecoder(java.lang.String pipeEnvironment,
java.lang.String pipeArgument,
java.lang.String pipeCommand,
java.lang.String pipeLogFile,
int pipeBuffer) |
Modifier and Type | Method and Description |
---|---|
javax.sound.sampled.AudioInputStream |
getDecodedStream(java.lang.String resource,
int targetSampleRate) |
static javax.sound.sampled.AudioFormat |
getTargetAudioFormat(int targetSampleRate)
Constructs the target audio format.
|
public PipeDecoder()
public PipeDecoder(java.lang.String pipeEnvironment, java.lang.String pipeArgument, java.lang.String pipeCommand, java.lang.String pipeLogFile, int pipeBuffer)
public javax.sound.sampled.AudioInputStream getDecodedStream(java.lang.String resource, int targetSampleRate)
public static javax.sound.sampled.AudioFormat getTargetAudioFormat(int targetSampleRate)
targetSampleRate
- The sample rate to convert to.