<p>Assuming you want a 30 fps 2.5m GIF, use</p>

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

<p>and</p>

<pre><code>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
</code></pre>

CC BY-SA 4.0
2018-11-05T05:53:03.110Z
2018-11-05T05:53:03.110Z
Gyan
<p>I have a 30fps video that is 234 minutes long and want to shrink it down to 2 minutes.  <code>1-(234-2)/234)</code> gives me 0.0085 which I use </p>

<p><code>ffmpeg -i source.mp4 -vf setpts=PTS*0.0085,palettegen palette.png</code> </p>

<p>followed by </p>

<p><code>ffmpeg -i source.mp4 -i palette.png --filter_complex setpts=PTS*0.0085,paletteuse survey.gif</code></p>

<p>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 <code>convert</code> into a gif.  Aside from my main question, it doesn't seem like ImageMagick's convert supports user supplied palette files.</p>

<p>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.  </p>

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

<p>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.</p>

CC BY-SA 4.0
2018-11-04T18:25:26.917Z
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
CC BY-SA 4.0
2018-11-04T21:43:24.413Z
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
<ffmpeg><time-lapse>
ffmpeg alternative to setpts for making a survey gif
David
# ffmpeg alternative to setpts for making a survey gif

(Asked by: username_0 on 2018-11-04)

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.

**Tags:** ffmpeg, time-lapse

> **Comments:**
> **username_1**: 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.  
> **username_0**: 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.  

---

## 1 answers

### Answer by username_1 on 2018-11-05. Score: 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


---

