Yang Chen
Yang Chen

Reputation: 55

How to make ffmpeg automatically fill frames?

I want to use ffmpeg to convert a sequence of images to a video, the images are got in realtime, the interval of getting image is changeable, maybe i get next image in 1 second or even 1 millisecond. I want the target video in a special fps(like 100), now my implement is creating a loop, which fade ffmpeg last image then sleep(like 10ms).

Do you guys know some options could let ffmpeg fill frames automatically?

If that option do exist, i wonder is that possible to make video real fps is half of it is claimed.

My ffmpeg command likes follow:

ffmpeg -f image2pipe -r 100 -i pipe:0 -f flv -r 100 pipe:1

Upvotes: 1

Views: 2309

Answers (1)

Gyan
Gyan

Reputation: 92928

You can use

ffmpeg -f image2pipe -use_wallclock_as_timestamps 1 -i pipe:0 -f flv -vsync cfr -r 100 pipe:1

FFmpeg will set each incoming frame's timestamp to the time it is received. SInce the output rate is set and mode is constant frame rate, ffmpeg will duplicate the last frame till next input frame is received, or drop if two frames are less than 10ms apart. Change -r to 1000 to keep frames only a millisecond apart.

Upvotes: 2

Related Questions