java – How to fix video slowdown via FFmpeg?
I have a command for FFmpeg that is designed to create a video from an image.
When you play a video, it plays very fast at first, and towards the end, the playback speed slows down to one image per second.
I need to show, for example, 3 images per second with a uniform playback speed. Here is my code (Android Java):
int size = imagePaths.size();
for (int i = 0; i < size; i++) {
strCommand += "-framerate 300 -i '" + imagePaths.get(i) + "' ";
}
strCommand += "-filter_complex \"";
for (int i = 0; i < size; i++) {
strCommand += "[" + i + ":v]setpts=PTS-STARTPTS+" + i + "[v" + i + "];";
}
strCommand += "[v0]";
for (int i = 1; i < size; i++) {
strCommand += "[v" + i + "]";
}
strCommand += "concat=n=" + size + ":v=1:a=0,format=yuv420p\" -r 30 -b:v 4M -preset veryfast '" + outputVideoPath+"'";
Log.d("IPRIPR", strCommand);
Read more here: Source link
