我正在设置一个用PHP构建的CMS,现在我需要添加一个用户可以将视频从FLV转换为MP4格式的部分。我搜索过脚本和解决方案,但没有任何作用。我准备支付软件费用,但“Aviberry”软件售价5000美元,而“sothinkmedia”在Linux服务器上无法正常运行。如果有人肯定会有所作为,我会很感激所有的建议。
答案 0 :(得分:2)
答案 1 :(得分:1)
在java代码中尝试ffmpeg命令,否则另一个解决方案使用Xuggler API,它会转换 任何扩展的视频文件。
/* Sample Code For converting Videos in server side */
import java.io.*;
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
public class Quality {
public static void main(String args[]) {
String s = null;
try {
// run the Unix "ps -ef" command
// using the Runtime exec method:
Process p = Runtime.getRuntime().exec("ffmpeg -i /home/praveen/videos/Oracle.mp4
-vcodec libvpx -acodec libvorbis -f webm /home/praveen/videos/Oracle.webm");
//Process p = Runtime.getRuntime().exec("ffmpeg -i /home/praveen/resize
images/Videos/RaymondMadetoMeasure.mp4 -vcodec libvpx -acodec libvorbis -f webm
/home/praveen/resize images/Videos/Raymond.webm");
BufferedReader stdInput = new BufferedReader(new
InputStreamReader(p.getInputStream()));
BufferedReader stdError = new BufferedReader(new
InputStreamReader(p.getErrorStream()));
// read the output from the command
System.out.println("Here is the standard output of the command:\n");
while ((s = stdInput.readLine()) != null) {
System.out.println(s);
}
// read any errors from the attempted command
System.out.println("Here is the standard error of the command (if any):\n");
while ((s = stdError.readLine()) != null) {
System.out.println(s);
}
System.exit(0);
}
catch (IOException e) {
System.out.println("exception happened - here's what I know: ");
e.printStackTrace();
System.exit(-1);
}
}
}