Skip to content

Instantly share code, notes, and snippets.

@Michcioperz
Created May 27, 2013 20:22
Show Gist options
  • Save Michcioperz/5658906 to your computer and use it in GitHub Desktop.
Save Michcioperz/5658906 to your computer and use it in GitHub Desktop.
Simple music converting Java thing
import java.io.IOException;
public class Musiconvert {
public static void main(String[] args) {
String ffmpeguri = "J:\\droidqemu\\FFMPEG\\ffmpeg.exe"; //path to FFmpeg goes here
String targetcodec = "libmp3lame"; //target codec goes here
String targetextension = ".mp3"; //target file extension goes here
String[] uris = new String[] {
/* source files paths go here */
};
for (String uri: uris) {
try {
Process process = new ProcessBuilder(ffmpeguri, "-i", uri, "-acodec", targetcodec, uri + targetextension).start();
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment