Skip to content

Instantly share code, notes, and snippets.

@ChangJoo-Park
Created November 1, 2013 06:37
Show Gist options
  • Save ChangJoo-Park/7261658 to your computer and use it in GitHub Desktop.
Save ChangJoo-Park/7261658 to your computer and use it in GitHub Desktop.
Using JAVE(Java Audio Video Encoder) example add external library jave 1.0.2 version
package jave_example;
import it.sauronsoftware.jave.AudioAttributes;
import it.sauronsoftware.jave.Encoder;
import it.sauronsoftware.jave.EncoderException;
import it.sauronsoftware.jave.EncodingAttributes;
import it.sauronsoftware.jave.InputFormatException;
import java.io.File;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
File source = new File("1.mp4");
File target = new File("target.mp3");
AudioAttributes audio = new AudioAttributes();
audio.setCodec("libmp3lame");
audio.setBitRate(new Integer(128000));
audio.setChannels(new Integer(2));
audio.setSamplingRate(new Integer(44100));
EncodingAttributes attrs = new EncodingAttributes();
attrs.setFormat("mp3");
attrs.setAudioAttributes(audio);
Encoder encoder = new Encoder();
try {
encoder.encode(source, target, attrs);
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InputFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (EncoderException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
@TheRiotJoker
Copy link

4 years later, same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment