I need to speed up video by a factor of 4x, but do not want to drop the frames and instead average them. I.e. each 4 frames are averaged, and produce 1 output frame. Target frame-rate stays the same, so video is now 4 times faster.

Is there a way to do so in ffmpeg?

  • 3
    Can you be more specific about how they should be "averaged"? What method do you want to use? – llogan Oct 5 '15 at 6:09
  • @LordNeckbeard (f1+f2+f3+f4)/4 - simple averaging. So each resulting frame have faint traces of the movement on all sub-frames. – BarsMonster Oct 5 '15 at 11:32
  • @BarsMonster I doubt ffmpeg can do this. Have you seen this effect done another way? Do you know what it actually looks like? – Jim Mack Oct 5 '15 at 15:08
  • @JimMack I currently did that manually in VirtualDub, they have interpolate filter, with 0.5x interpolation it does correctly average 2 frames. Here is the result : youtube.com/watch?v=8zrws5CGWsI One can see that each frame has movement of 2 subframes, so it is slightly smoother. But doing so in a cmdline would be much faster in the future. – BarsMonster Oct 5 '15 at 18:16
  • slowmoVideo may be worth a try, but I don't know if it has a cli. The FFmpeg framerate filter appears to perform interpolation, but it does not seem to fit your needs. – llogan Oct 5 '15 at 21:26

ffmpeg with this filterchain does it:

ffmpeg -i input -vf "tblend=average,framestep=2,tblend=average,framestep=2,setpts=0.25*PTS" -r srcfps -{encoding parameters} output

srcfps should be replaced with your input's framerate.

  • 2
    Also tried for x16 using "tblend=average,framestep=2,tblend=average,framestep=2,tblend=average,framestep=2,tblend=average,framestep=2,setpts=0.0625*PTS" – BarsMonster Oct 15 '16 at 15:31
  • so the multiplier to PTS is important to increase rate – genuinefafa Dec 12 '20 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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