FFMPEG – Image Sequence to Video with Date Overlay Based on Timestamps

Need to convert an image sequence into a playable video, with a time-overlay printed onto the images?

Here is the best solution I’ve been able to cobble together, hoping it helps someone out there.

There are a few tools at play here:

  1. FFMPEG — The end all, be all, video processing tool. A single EXE with unlimited power. Actually crunches the image sequence into a playable video.
    1. https://www.ffmpeg.org/download.html
  2. Nirsoft’s Bulk File Changer — Allows modifying timestamps, specifically copying Created to Modified.
    1. https://www.nirsoft.net/utils/bulk_file_changer.html
  3. FastStone Image Viewer — Used to rename files as an image sequence based on the Date Modified timestamp, and overlay a timestamp onto the images.
    1. http://www.faststone.org/FSViewerDetail.htm

 

Step 1 – Renaming based on timestamps (Optional)

This may not apply to your situation, if your date modified time-stamps are accurate. If so, feel free to skip this step.

Below is a photo showing the timestamps on the sample images.

The names are semi-random, date created is reliable, and date modified is from my copy/paste — not reliable.

Since FastStone viewer, which will overlay a timestamp onto the images only uses Date Modified, we have to overwrite Date Modified with the Date Created timestamp.

Enter: Bulk File Changer, provided by the amazing developer at Nirsoft: https://www.nirsoft.net/utils/bulk_file_changer.html

Go ahead and download it, no installer, runs portable, awesome. Perform the following.

  • File > Add > Select your images > Select All (Ctrl+A)
  • Actions > Change time/attributes
  • Copy Time From: Created > To: Check Modified
  • Do it (run)

Step 2 – FastStone Batch Image Rename

Most Image Sequence processors except an incremental input of some kind. The simplest is a filename followed by a number. E.g. filename-0001.jpg, filename-0002.jpg. A more complex form of input is a text file, that references the images to an incrementing number.

We are going to use the first option, by renaming the images with FastStone.

Open FastStone Image Viewer (Download at: http://www.faststone.org/FSViewerDetail.htm)

Browse to your folder > Select All (Ctrl+A) > Tools > Batch Convert Selected Images

Batch Rename Tab

Click “Date Modified” column header, to sort by date. Select All (Ctrl+A) > Add All

Adjust your template as desired, e.g. Image##### would become Image00001, Image00002, etc

Convert

 

Step 3 – FastStone Batch Image Overlay

Time to overlay a printed timestamp onto the images, based on Date Modified timestamp.

Open FastStone Image Viewer

Browse to your folder > Select All (Ctrl+A) > Tools > Batch Convert Selected Images

Batch Convert Tab

Check: Advance Options > Advanced Options > Text Tab > Check: Add Text > Insert a Variable > File Date/Time > Date and Time (D1) > Position: Bottom-Right > OK

Change your Output Folder to wherever you would like>  Convert.

 

Step 4 – Convert Image Sequence to Video with FFMPEG

Obtain FFMPEG.exe, download at: https://www.ffmpeg.org/download.html

This is the easy part, finally. A few things to note:

  • -r = frame rate. The 3 in this example is 3 frames per second. Standard video is 24fps or 30fps
  • -i = input. The folder and file-name variable of the image sequence.
    • %05d means, 5 digits, 0-padded. E.g. 00004, 00005, 00006.
    • Adjust as needed.
  • -vcodec = Video codec, what video processing system to use, x264 is popular for MP4 videos.

ffmpeg -r 3 -i “C:\SourceFolder\Image%05d.jpg” -vcodec libx264 “C:\TargetFolder\Video.mp4”

 

You should end up with a playable MP4 video, with timestamps burned into the images. Hoping that is helpful, enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *