|
|
|
@ -144,13 +144,14 @@ public class FFmpegUtil { |
|
|
|
|
/** |
|
|
|
|
* 使用ffmpeg命令行进行视频截图 |
|
|
|
|
* @param srcFile 源文件 |
|
|
|
|
* @param time 截图开始时间 |
|
|
|
|
* @param size 图片尺寸大小 |
|
|
|
|
* @param targetFile 目标文件 |
|
|
|
|
* @return 截图后的文件 |
|
|
|
|
*/ |
|
|
|
|
public static String[] screenShot(String srcFile, String size, String targetFile){ |
|
|
|
|
String screenShotCmd = "ffmpeg -i %s -f image2 -t 0.001 -s %s %s"; |
|
|
|
|
screenShotCmd = String.format(screenShotCmd, srcFile, size, targetFile); |
|
|
|
|
public static String[] screenShot(String srcFile, int time, String size, String targetFile){ |
|
|
|
|
String screenShotCmd = "ffmpeg -i %s -f image2 -ss %d -s %s %s"; |
|
|
|
|
screenShotCmd = String.format(Locale.getDefault(), screenShotCmd, srcFile, time, size, targetFile); |
|
|
|
|
return screenShotCmd.split(" ");//以空格分割为字符串数组
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|