0

I have a large group (tens of thousands) of images which were captured to an SSD at the max speed possible, which was therefore not a constant frame rate. Because of this, when using FFMPEG to turn these into a constant frame-rate video it seems to speed up and slow down when it shouldn't.

Is there a way to tell FFMPEG to time the images based on the timestamp in the filename rather than a constant framerate?

For example, consider the following (contrived) list of files:

2019-01-28-08-00-28-000-000.tiff
2019-01-28-08-00-28-700-000.tiff
2019-01-28-08-00-28-900-000.tiff

These should be three sequential frames, but should have varying times between them. Then I can use the minterpolate filter to make it a smooth transition.

  • Which OS are you using? – Gyan Jan 28 at 13:28
  • I can use Windows or CentOS or Ubuntu if that somehow changes how FFMPEG works. – Kevin Rak Jan 28 at 13:34
  • The image2 reader in ffmpeg can assign timestamps based on the modification time of the file, with nanosecond precision. Not possible on Win, AFAICT. So, on a linux box, you can parse the filename and generate a timestamp and touch the mtime of the file. The absolute timestamps don't matter, just need to make sure the deltas in the mtimes correspond to the desired deltas. Then rename or symlink the images to form a smooth numbered sequence. Once done, read as follows: ffmpeg -f image2 -ts_from_file 2 -i images%d.jpg -vf minterpolate=... – Gyan Jan 28 at 13:52
  • Awesome! Thanks! I'll give it a try! Can you post this as an answer so I can mark the question resolved if it works? – Kevin Rak Jan 28 at 17:03
0

The below answer was provided as a comment on the question by Gyan. I've reposted it as an answer so this question can be marked as solved.


The image2 reader in ffmpeg can assign timestamps based on the modification time of the file, with nanosecond precision. Not possible on Win, AFAICT. So, on a linux box, you can parse the filename and generate a timestamp and touch the mtime of the file. The absolute timestamps don't matter, just need to make sure the deltas in the mtimes correspond to the desired deltas. Then rename or symlink the images to form a smooth numbered sequence. Once done, read as follows: ffmpeg -f image2 -ts_from_file 2 -i images%d.jpg -vf minterpolate=... – Gyan


This worked for me! I was able to use the touch -d command to set the timestamp on each file based on the filename, then use ffmpeg -f image2 -ts_from_file 2 -i %d.png out.mp4 to create the video. Interpolation ended up being time-prohibitive, but shouldn't really be necessary in my final video.

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.