public class Encoder
extends java.lang.Object
Constructor and Description |
---|
Encoder()
It builds an encoder using a locator instance to
locate the ffmpeg executable to use.
|
Modifier and Type | Method and Description |
---|---|
static void |
addFFMPEGLocator(FFMPEGLocator locator) |
void |
encode(java.io.File source,
java.io.File target,
Attributes attributes)
Re-encode a multimedia file.
|
Attributes |
getInfo(java.io.File source)
Returns a set informations about a multimedia file, if its format is
supported for decoding.
|
static javax.sound.sampled.AudioFormat |
getTargetAudioFormat(Attributes attributes)
Constructs the target audio format.
|
static boolean |
hasLocators() |
javax.sound.sampled.AudioInputStream |
stream(java.lang.String source,
Attributes attributes) |
public Encoder()
public static void addFFMPEGLocator(FFMPEGLocator locator)
public static boolean hasLocators()
public Attributes getInfo(java.io.File source) throws InputFormatException, EncoderException
source
- The source multimedia file.InputFormatException
- If the format of the source file cannot be recognized and
decoded.EncoderException
- If a problem occurs calling the underlying ffmpeg executable.public void encode(java.io.File source, java.io.File target, Attributes attributes) throws EncoderException
source
- The source multimedia file. It cannot be null. Be sure this
file can be decoded.target
- The target multimedia re-encoded file. It cannot be null. If
this file already exists, it will be overwrited.attributes
- A set of attributes for the attributes process.java.lang.IllegalArgumentException
- If both audio and video parameters are null.EncoderException
- If a problems occurs during the attributes process.public javax.sound.sampled.AudioInputStream stream(java.lang.String source, Attributes attributes) throws EncoderException
EncoderException
public static javax.sound.sampled.AudioFormat getTargetAudioFormat(Attributes attributes)
attributes
- The audio format (sample rate, format, bit depth, channels,...) to convert to.