0

I recorded slo-mo video on an iPhone SE (2) by mistake instead of timelapse.

I know there's a lot of answers to this question here, but I'm trying again and again and always something's wrong (like a video that has a correct total no. of frames, but lasts 3 hours and is basically a freeze :D ) My recent command was

ffmpeg -i IMG_2174.MOV -vf framestep=1440,setpts=N/120/TB -c:v libx264 -preset slow -crf 22 -an -r 30 IMG_2174.timelapse.MOV

but it resulted in a one-second-long video, so way over-timelapsed. Should be several seconds IINM. The source video is 30 minutes long @240fps, 17GB. Thx.

baskak
  • 1
  • Is 240 actual fps of the input or the recording fps? If the latter, what's the playback fps (=input fps)? – kesh Mar 29 '22 at 13:16
  • I guess I understand what you're asking about, but where can I get this info? Should MediaInfo tell me this? It shows `Frame rate mode : Variable Frame rate : 240.188 FPS Minimum frame rate : 120.000 FPS Maximum frame rate : 266.667 FPS` – baskak Mar 30 '22 at 07:55
  • However, I seem to find the right parameters, see below. – baskak Mar 30 '22 at 07:56
  • OK, when you say "slo-mo" I was expecting the playback rate to be lower than the recording rate (The vfr of the file is the playback rate) and I thought you might be interested in getting 1/6 fps wrt to the recording rate. But, never mind – kesh Mar 30 '22 at 17:15

2 Answers2

0

This command seems to do the trick:

ffmpeg -i IMG_2174.MOV -vf framestep=1440,setpts=N/30/TB -c:v libx264 -preset slow -crf 22 -an -r 30 IMG_2174.timelapse.MOV

baskak
  • 1
0

Here is the explanation for OP's self-answer.

ffmpeg -i IMG_2174.MOV 
       -vf framestep=1440,setpts=N/30/TB 
       -r 30 -c:v libx264 -preset slow -crf 22 -an IMG_2174.timelapse.MOV

Given input video at 240 fps cfr:

  1. framestep=1440 keep every 1440th frame, yielding 240/1440 = 1/6 fps
  2. setpts=N/30/TB speeds up the video by x180 (30 / 1/6)
  3. -r 30 output option: match the new pts interval set above

For a vfr video, framestep=1440 likely results in incorrect timing (though on the average correct). For such video, replace the framestep filter with fps=1/6 filter so it picks the frames based on pts rather than frame count.

[edit note: iPhone's slo-mo recording does keep 240fps cfr so the OP's solution is 100% correct, edited down just to mention a vfr-correct approach]

kesh
  • 4,515
  • 2
  • 12
  • 20
  • Thanks, I've given it a try. However, the result of your command is as follows: https://pastebin.com/tdTT7rNr, and it's not as expected. While the MediaInfo for the result of my (framestep) command is: https://pastebin.com/Kx8Yh7wz – baskak Apr 04 '22 at 08:47
  • You're absolutely correct. My bad. As the edited post suggests, your solution is 100% correct because iPhone does record at 240 fps cfr. – kesh Apr 04 '22 at 15:10