我试图使用调用ffmpeg的JAVE将*.mov文件转码为*.mp4文件.输入文件和输出文件都是InputStream和OutputStream形式.这意味着我需要将InputStream和OutputStream作为-f和-y parematers传递给ffmpeg.我怎么做 ?
//Read a movfile.mov converted into a FileInputStream
InputStream fileInputStream = getFileInputStream();
OutputStream fileOutputStream = new FileOutputStrea(outputMP4File) //Output
Process p = Runtime.exec("ffmpeg -i - -y -");
InputStream pInStrm = p.getInputStream();
OutputStream pOutStrm = p.getOutputStream();
int vin = 0, vout = 0;
Thread read = new Thread() {
byte[] buff = new byte[4096];
void run() {
while ((vin=fileInputStream.read(buf))!=-1) {
pOutStrm.write(buf, 0, vin);
}
}
}; read.start();
Thread write = new Thread() {
byte[] buff = new byte[4096];
void run() …Run Code Online (Sandbox Code Playgroud)