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 ffmpeg is used. Other
command Line programs that are able to decode audio and pipe binary PCM
samples to STDOUT are possible as well (avconv, mplayer).
To install ffmpeg on Debian: apt-get install ffmpeg
.
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
ffmpeg -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 |
---|---|
java.io.InputStream |
getDecodedStream(java.lang.String resource,
int targetSampleRate,
double timeOffset,
double numberOfSeconds) |
double |
getDuration(java.lang.String resource) |
static TarsosDSPAudioFormat |
getTargetAudioFormat(int targetSampleRate)
Constructs the target audio format.
|
void |
printBinaryInfo() |
public PipeDecoder()
public PipeDecoder(java.lang.String pipeEnvironment, java.lang.String pipeArgument, java.lang.String pipeCommand, java.lang.String pipeLogFile, int pipeBuffer)
public java.io.InputStream getDecodedStream(java.lang.String resource, int targetSampleRate, double timeOffset, double numberOfSeconds)
public double getDuration(java.lang.String resource)
public void printBinaryInfo()
public static TarsosDSPAudioFormat getTargetAudioFormat(int targetSampleRate)
targetSampleRate
- The sample rate to convert to.