I’m trying to create a video from a single image with a very specific duration of 0.09375 seconds using FFmpeg. I’ve tried various commands, but I can’t seem to get the exact duration I need. The closest I’ve gotten is 0.080000 seconds. It doesn’t always have to be something like 0.09375, but I wanted to have an example for it.
I’ve also tried trimming a video, but from what I’ve read so far, the encoding of the video can be a problem. Even after trying different FFmpeg commands or using MoviePy directly, I’ve never arrived at the desired result.
Initial Attempt:
Here are the steps I’ve taken so far:
ffmpeg -loop 1 -i frame_00001.png -c:v libx264 -t 0.09375 -r 240 -pix_fmt yuv420p -vf scale=1920:1080 output.mp4
Resulting duration: 0.080000 seconds
Adjusted Frame Rate:
ffmpeg -y -loop 1 -i frame_00001.png -c:v libx264 -t 0.09375 -r 160 -pix_fmt yuv420p -vf scale=1920:1080 output.mp4
Resulting duration: 0.081250 seconds
I’ve also tried using the setpts
filter, but I didn’t get anything satisfying.
Creating a video from a single image or trimming an existing video were my two ideas, but if anyone has another method to create a video with such a precise duration, I’m all ears!
Any guidance or suggestions would be greatly appreciated.
aas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.