java 调用ffmpeg执行dos命令
import java.io.File; import java.io.IOException; public class TestMencoder { public static void main(String[] args) { String cmd2="cmd /c start "+"D:\\MPlayer\\mencoder "+"E:\\478.rmvb"+" -o "+"E:\\478_mencoder.flv"+" -of lavf -oac lavc -vf pullup,pp=md -ovc lavc -lavcopts vcodec=flv:vbitrate=528:mbd=2:mv0:trell:v4mv:cbp:last_pred=3:acodec=libmp3lame:abitrate=56 -srate 22050 -ofps 15 "; String cmd=" D:\\foresee\\workspace3.2\\rr\\ffmpeg\\ffmpeg.exe -i"+" e:\\74.2.mpg"+" -y -ab 32 -ar 11025 -b 400000 -s 320*240 "+"e:\\74.2_bat.flv "; try { Process pr=Runtime.getRuntime().exec(cmd2); pr.getInputStream(); System.out.println(cmd); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
D:\\MPlayer\\mencoder是mencoder.exe的文件路径
D:\\foresee\\workspace3.2\\rr\\ffmpeg\\是ffmpeg.exe的文件路径
在出现说ffmpeg不是外部执行命令时已经这个没有写对的原因了
至于ffmpeg的参数问题就看另一篇文章了相关推荐
dingwun 2020-11-16
wangdaren 2020-08-15
wqiaofujiang 2020-07-05
PGzxc 2020-07-04
ShoppingChen 2020-06-25
cherayliu 2020-06-17
83096129 2020-06-08
83096129 2020-06-08
PGzxc 2020-06-01
ShoppingChen 2020-05-29
cherayliu 2020-05-11
ShoppingChen 2020-05-11
83096129 2020-05-10
PGzxc 2020-05-07
cherayliu 2020-04-27
cherayliu 2020-04-11