public class VideoProcess {
public static boolean processTransToImg2(String toolPath,String oldfilepath, String newimg) {
try {
Runtime.getRuntime().exec(toolPath+" -i "+oldfilepath+" -y -f image2 -ss 2 -t 0.001 -s 300x200 "+newimg);
D:/ffp/ffmpeg.exe -i F:/javaweb/nSurety/WebRoot/shipin/chengpinwushe.flv -y -f image2 -ss 2 -t 0.001 -s 300x200 d:/ffp/3.jpg
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
public static void main(String[] args) {
String toolPath = "D://ffp//ffmpeg.exe";
String oldfilepath = "F://javaweb//nSurety//WebRoot//shipin//chengpinwushe.flv";
String newimg = "d://ffp//3.jpg";
processTransToImg2(toolPath,oldfilepath, newimg);
System.out.println("over");
}
}
本文介绍了一段Java代码,该代码使用FFmpeg工具将视频文件转换为指定尺寸的静态图片。通过调用Runtime.getRuntime().exec()方法执行FFmpeg命令行工具,实现了从视频中截取特定时间点的画面。
1087

被折叠的 条评论
为什么被折叠?



