Reputation: 462
I am using yahoo gifshot library to create gifs from videos. A user can upload a video and, afterwards, I dynamically create a gif from that video. The problem is, that user uploads a two-second duration video but the gif is only saved as one second duration...
here is code :
gifshot.createGIF({
'video': [U + 'Content/convertedVideos/bla.mp4'],
'gifWidth': 800,
'gifHeight': 400,
...
i've added numframes property which works fine but another problem is it repeats both first shows one second duration gif and then two second gif
code :
'video': [U + 'Content/convertedVideos/bla.mp4],
'gifWidth': 800,
'gifHeight': 400,
'numFrames': 20,
look at first load one sec gif and after two sec gif how can i save only two second duration gif? please help sorry for my English
Upvotes: 1
Views: 338
Reputation: 1188
I had the same problem like you. I solved it by reducing 1 or 2 frames. Video duration: 2s => 2000 ms => 20 frames (it's theory). numFrames should be 20 - 2 = 18 frames.
More info:
// The number of frames to use to create the animated GIF
// Note: Each frame is captured every 100 milleseconds of a video and every ms for existing images
'numFrames': 10,
Upvotes: 1