<p>For a H264/5 stream, this can be done in two steps:</p>

<pre><code>ffmpeg -discard nokey -i t1.mp4 -c copy t1.264

ffmpeg -r 30 -i t1.264 -c copy t1keys.mp4
</code></pre>

CC BY-SA 3.0
2017-07-23T05:27:32.187Z
2017-07-23T05:27:32.187Z
Gyan
<p>I have a 30 fps video with a GOP 30 (1 i-frame per second).
I'd like to create a version that is '30x faster', by dropping all frames except every 30th frame. I can do that as so:</p>

<pre><code>ffmpeg  -i t1.mp4 -filter:v "setpts=.033333*PTS" f6.mp4
</code></pre>

<p>It creates the desired output, but it runs slow, and uses a lot of CPU. I presume this is because it is stepping through all the frames and decoding each one before throwing away 29/30 of them.</p>

<p>Is there a way to instruct ffmpeg to create a '[GOP]x faster' video using only the key frames, so that it need only decode the i-frames?</p>

<p>I'd also like it to do no transcode of the iframes - same size, etc. I don't mind what the GOP of the output video is. </p>

<p>thanks</p>

<ffmpeg>
Speed up a video 30x using only key frames with ffmpeg?
tom
# Speed up a video 30x using only key frames with ffmpeg?

(Asked by: username_0 on 2017-07-23)

I have a 30 fps video with a GOP 30 (1 i-frame per second).
I'd like to create a version that is '30x faster', by dropping all frames except every 30th frame. I can do that as so:
ffmpeg  -i t1.mp4 -filter:v "setpts=.033333*PTS" f6.mp4

It creates the desired output, but it runs slow, and uses a lot of CPU. I presume this is because it is stepping through all the frames and decoding each one before throwing away 29/30 of them.
Is there a way to instruct ffmpeg to create a '[GOP]x faster' video using only the key frames, so that it need only decode the i-frames?
I'd also like it to do no transcode of the iframes - same size, etc. I don't mind what the GOP of the output video is. 
thanks

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2017-07-23. Score: 10

For a H264/5 stream, this can be done in two steps:
ffmpeg -discard nokey -i t1.mp4 -c copy t1.264

ffmpeg -r 30 -i t1.264 -c copy t1keys.mp4


---

