Closed LittleLiByte closed 6 years ago
解决了,输入之前设置输入帧率为1,输入之后再次设置输出帧率为需要的帧率即可
@LittleLiByte 請問再次设置输出帧率 是再次調用 EpEditor.pic2video? 帧率是否就是影片長度? 如不是 那應該調用那一個 謝謝
@wayne811 直接改命令行就行了,不需要再次调用EpEditor.pic2video,图片张数/帧率=影片时长 pic2video我自己改了下,提供参考
public static void pic2video(String imageInput, String out, int w, int h, float rate, OnEditorListener onEditorListener) {
if (w < 0 || h < 0) {
Log.e("ffmpeg", "width and height must greater than 0");
onEditorListener.onFailure();
return;
}
if (rate <= 0) {
Log.e("ffmpeg", "rate must greater than 0");
onEditorListener.onFailure();
return;
}
CmdList cmd = new CmdList();
cmd.append("ffmpeg").append("-y").append("-f").append("image2").append("-r").append(1).append("-i").append(imageInput)
.append("-vcodec").append("libx264");
if (w > 0 && h > 0) {
cmd.append("-s").append(w + "x" + h);
}
cmd.append("-r").append(rate);
cmd.append("-threads").append("2");
cmd.append(out);
long d = VideoUitls.getDuration(imageInput);
execCmd(cmd, d, onEditorListener);
}
图片转视频输出帧率设置无效,一直都是25,请问在哪里修改