0

I have a 30fps video that is 234 minutes long and want to shrink it down to 2 minutes. 1-(234-2)/234) gives me 0.0085 which I use

ffmpeg -i source.mp4 -vf setpts=PTS*0.0085,palettegen palette.png

followed by

ffmpeg -i source.mp4 -i palette.png --filter_complex setpts=PTS*0.0085,paletteuse survey.gif

Actually making the gif is excruciatingly slow compared to extracting the desired frames into a massive directory of png's which I can then combine with convert into a gif. Aside from my main question, it doesn't seem like ImageMagick's convert supports user supplied palette files.

I understand that PTS is just adjusting how long a single frame is shown in a video but setpts has felt like the only reliably precise way of cutting the source.mp4 down.

I looked at framestep and it is much better for speed but I couldn't figure out an ideal value for framestep that wouldn't make the resulting gif step from one frame to the next like what I would get from using convert and a delay of 0.5 between frames.

Aside from above, these survey are meant to quickly scan through hours of video for various points of concern in a gif format able to be uploaded privately to imgur or giphy so others on my team could review them remotely and without ftp/dropbox/etc.

2
  • Do you wish to retain all frames and cycle through them in 2 mins, or pick just enough frames to have a 2 min 30 fps GIF? You mention 0.5 delay in relation to convert - is that 0.5 seconds per frame - which would indicate 240 frames to be selected from the video.
    – Gyan
    Commented Nov 4, 2018 at 18:25
  • I just want to select enough to cover 2.5 minutes. I have made these another way and they are epilepsy inducing but consistent enough to go back to the original minute in question. As for the delay it is a bit confusing as that affects ticks per second and not frames per second.
    – David
    Commented Nov 4, 2018 at 21:43

1 Answer 1

1

Assuming you want a 30 fps 2.5m GIF, use

ffmpeg -i source.mp4 -vf "select='not(mod(n,trunc(234/2.5)))',palettegen" palette.png

and

ffmpeg -i source.mp4 -i palette.png -filter_complex "[0]select='not(mod(n,trunc(234/2.5)))',setpts=N/30/TB[v];[v][1]paletteuse" survey.gif

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.