convert high -speed video to normal by subsampling frames

7

3

I've found any number of commercial apps that can convert, e.g., 120fps "slow motion" videos to 30 fps by writing every n-th frame to a new video file. I was hoping that the usual freeware tools such as VLC or handbrake or ffmpeg could do this for me, but I admit to being unable to track down the commands to do so. I found any number of ways to export every n-th frame to a collection of image files, but I'd sure rather not have to do that and follow by merging hundreds or thousands of jpgs into a new video file.

I did find thistime-lapse answer which uses setpts so if that's all I need to do, please tell me (with or without the "you dope" part :-) ).

Carl Witthoft

Posted 2016-01-10T20:59:02.513

Reputation: 444

Answers

9

If you want to keep real-time i.e. 1 second of live action is played out in 1 second of video then

ffmpeg -i input.mp4 -r 30 output.mp4

This will drop 3 out of every 4 frames.

If you want to preserve all frames but cycle through them slowly then

ffmpeg -i input.mp4 -vf setpts=4*PTS -r 30 output.mp4

Gyan

Posted 2016-01-10T20:59:02.513

Reputation: 21 016

Thanks. Is this preferable to the long expression in http://superuser.com/questions/573747/drop-every-even-or-odd-frames-using-ffmpeg?rq=1 which uses a filter with select="mod(n-1\,2)" ?

– Carl Witthoft – 2016-01-11T12:22:58.920

Unless the source video is variable frame rate, I would prefer my commands. – Gyan – 2016-01-11T12:32:10.990

1Sadly, that first command line did not work - the output file was still in slo-motion - as you warned, it seems the input was considered to be variable frame rate, so the answer in your second line, but using setpts = PTS/4 converted my 120fps input to 30fps real-time output. – Carl Witthoft – 2016-01-17T16:06:31.900

For me, the second command doesn't preserve frames. I am trying to slowdown a 960fps video by encoding at 60fps, but I am getting a slow jerky video that clearly indicates that the frames are being dropped. – haridsv – 2016-10-31T14:33:10.613

Try ffmpeg -r 60 -i input.mp4 output.mp4 – Gyan – 2016-10-31T14:36:17.040