Extract frames from video and set timestamp on images

0

2

I want to extract frames every 10 seconds from a video and geotag these frames using a GPX track.

On my Windows 8 computer I have tools to extract the frames (FFMPEG), set image timestamps (ExifTool) and geotag the images (GeoSetter).

However, I do not know how to copy the timestamp from the video over to the timestamp of the captured frame.

Peter

Posted 2015-02-20T21:00:48.790

Reputation: 113

See this answer. But it's for Linux.

– slhck – 2015-02-21T20:56:50.357

@slhck: Also, that example creates a textfile with filenames and timestamps. It doesn't assign the timestamps to the files. – Peter – 2015-02-22T13:12:56.657

That'd be a simple matter of iterating through the lines and renaming the files based on that pattern. But I don't even know if that works for you, since you mention Windows 8. Did you already try something? – slhck – 2015-02-22T13:17:37.620

Answers

1

That batch file extract frames every X seconds and then geotags it: https://gist.github.com/Krzysiu/345c37b08d79d5f47971167e33bb2bd3

It requires ffmpeg and exiftool. All settings have to be filled out manually (lines 28-68).

How does it work internally?

  1. At first it extracts frames using ffmpeg filter with proper options (default ones won't do the trick)
  2. It sets the same timestamp to all extracted frames*. Timestamp might be manually provided timestamp or any tag/file modify&create time from video file
  3. The time shift for every image is applied. I used that method, as there seems to be no easy way to shift time in case of manual timestamp.
  4. Frames are geotagged using gpx file.

* in fact to the all files matching %output_directory%\%frame_prefix%*.jpg, so if you've extracted at first 150 frames and then 100 to the same directory and with same prefix, it will process all 150 frames, including 101-150 from earlier pass.

Possibly it can be done much faster - expression in Exiftool which would multiply file index by X from "frame every X seconds". I'm not that good with Perl expressions and Exiftool, so I made it this way.

Krzysiu

Posted 2015-02-20T21:00:48.790

Reputation: 206