be.hogent.tarsos.util
Class AudioTranscoder

java.lang.Object
  extended by be.hogent.tarsos.util.AudioTranscoder

public final class AudioTranscoder
extends java.lang.Object

Transcodes audio. Uses ffmpeg: a vast number of formats are supported. A compiled ffmpeg binary is provided for Windows and Linux (32bit). If support on another platform is required check the documentation of JAVE or disable transcoding (trough configuration) and perform it manually .

Author:
Joren Six

Field Summary
static be.hogent.tarsos.transcoder.DefaultAttributes TARGET_ENCODING
          Defines the target codec: signed 16 bit little endian pcm.
 
Method Summary
static void transcode(java.lang.String source, java.lang.String target)
          Transcode the source file to target using the requested number of channels and sampling rate.
static void transcode(java.lang.String source, java.lang.String target, be.hogent.tarsos.transcoder.Attributes attributes)
          Transcode the source file to target using the requested number of channels and sampling rate.
static boolean transcodingRequired(java.lang.String transcodedPath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TARGET_ENCODING

public static final be.hogent.tarsos.transcoder.DefaultAttributes TARGET_ENCODING
Defines the target codec: signed 16 bit little endian pcm.

Method Detail

transcode

public static void transcode(java.lang.String source,
                             java.lang.String target)
                      throws be.hogent.tarsos.transcoder.ffmpeg.EncoderException
Transcode the source file to target using the requested number of channels and sampling rate.

Parameters:
source - The path of the source file.
target - The path of the target file. A stereo stream can be down mixed to a mono stream. Converting a mono stream to a stereo stream results in a file with two channels with the same data.
Throws:
be.hogent.tarsos.transcoder.ffmpeg.EncoderException - If FFMPEG fails to transcode the audio an UnsupportedAudioFileException is generated.
java.lang.IllegalArgumentException - if the source file can not be read or the target file is not writable.

transcode

public static void transcode(java.lang.String source,
                             java.lang.String target,
                             be.hogent.tarsos.transcoder.Attributes attributes)
                      throws be.hogent.tarsos.transcoder.ffmpeg.EncoderException
Transcode the source file to target using the requested number of channels and sampling rate.

Parameters:
source - The path of the source file.
target - The path of the target file.
attributes - Defines the attributes of the audio e.g. The sampling rate the target file should have; The number of channels target should have. A stereo stream can be down mixed to a mono stream.
Throws:
be.hogent.tarsos.transcoder.ffmpeg.EncoderException - When the transcoder yields an error.

transcodingRequired

public static boolean transcodingRequired(java.lang.String transcodedPath)