sihrc
sihrc

Reputation: 2828

ffmpeg missing image frames in generated video from images

Similar question here, but not yet answered.

Problem:

I'm combining images (.png) of same resolution/size (they all came from the same matplotlib.pyplot), but the resulting video is missing several frames.

Command:

ffmpeg -f image2 -r 1 -i .\\images\\image%02d.png -c:v libx264 -r 30 .\\images\\output.mp4

Resulting Video

Images

Notes:

I followed examples from here. I'm new to using ffmpeg, so I may not be completely sure of what each of the command line options I've used means, though I have a pretty good idea.

Thanks, any help/advice/suggestions will be greatly appreciated. I am also perfectly willing to provide further information that may help resolve this issue.

Upvotes: 0

Views: 2627

Answers (2)

sihrc
sihrc

Reputation: 2828

I saved my images as:

Images

.\images
    image00.png
    image01.png
    image02.png
    image03.png
    image04.png
    image05.png
    image06.png
    image08.png
    image09.png
    image010.png #<---- crap. all hells gone loose now.
    image011.png
    image012.png
    image013.png
    image014.png
    image015.png

Because I saved them in a for loop and tried to do some fancy name generating script that failed miserably. For reference though, this is the code that works:

for i in range(len(frames)):
    fig.savefig('images\\' + 'image'+ ('{0:0'+str(len(str(len(frames))))+'}').format(i)+'.png')

Upvotes: 1

David Elliman
David Elliman

Reputation: 1389

Sometimes this happens if the images are not all exactly the same size. Your command looks fine to me.

Upvotes: 3

Related Questions