Here you can find the source of convertUrlToMp3Cmd(final String url)
public static File convertUrlToMp3Cmd(final String url) throws IOException, InterruptedException
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.io.InputStreamReader; import java.net.URLEncoder; import java.util.UUID; public class Main { public static File convertUrlToMp3Cmd(final String url) throws IOException, InterruptedException { final String mp3Filename = UUID.randomUUID().toString() + ".mp3"; final String escFilename = URLEncoder.encode(url.substring(url.lastIndexOf("/") + 1), "UTF-8"); final String escUrl = url.substring(0, url.lastIndexOf("/") + 1) + escFilename; // ffmpeg -i https://s3.amazonaws.com/io.klerch.alexa.translator/en-GB/Marlene/good_morning.mp3 -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 -af volume=10dB sample.mp3 final String cmd = "ffmpeg -i " + escUrl + " -ac 2 -codec:a libmp3lame -b:a 48k -ar 16000 -af volume=10dB " + mp3Filename;/* www . jav a 2s . co m*/ System.out.println(cmd); final Process p = Runtime.getRuntime().exec(cmd); p.waitFor(); final BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); String line = ""; while ((line = reader.readLine()) != null) { System.out.println(line); } return new File(mp3Filename); } }