Skip to content

Instantly share code, notes, and snippets.

@jalessio
Created February 14, 2019 16:11
Show Gist options
  • Save jalessio/6ccbc203fc80540c24b984600831b644 to your computer and use it in GitHub Desktop.
Save jalessio/6ccbc203fc80540c24b984600831b644 to your computer and use it in GitHub Desktop.
Rough notes while trying to figure out how to create geotagged images created by Waylens Horizon camera

Waylens Studio Exports Exploration

I see in the CSV file with have a "PlayTime(s)" column. I suspect that is the time in the video where I should grab a still and then the data in that CSV row will be valid for it.

I found some info on extracting a still image at a specific time here: https://trac.ffmpeg.org/wiki/Seeking

But maybe I don't want that? Maybe I want to use the "Frame Index" column instead? https://stackoverflow.com/a/20411464

I have the CSV 20180714-16.28.03.csv

I'm starting at row 400

  • PlayTime(s): 11.73
  • Frame Index: 251

Extract from a specific time (using "PlayTime(s)" column)

export FILENAME=20180714-162803.ts
export TIME_INDEX=795.515
ffmpeg -ss $TIME_INDEX -i $FILENAME -frames:v 1 time_$TIME_INDEX.jpg

Extract a specific frame (using "Frame Index" column)

export FILENAME=20180714-162803.ts
export FRAME_INDEX=251
ffmpeg -i $FILENAME -vf "select=gte(n\,$FRAME_INDEX)" -vframes 1 frame_$FRAME_INDEX.png

hmmm... this didn't work at all. Produced no png files.... "Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)"

ffprobe explanations: https://stackoverflow.com/questions/2017843/fetch-frame-count-with-ffmpeg

Good stuff here: https://www.bugcodemaster.com/article/extract-images-frame-frame-video-file-using-ffmpeg

Extract an image every second

export FILENAME=20180714-162803.ts
export FPS=1
ffmpeg \
	-i $FILENAME \
	-vf fps=$FPS \
	image_%03d.jpg

Extract all keyframes

time ffmpeg \
	-hide_banner \
	-ss 0 \
	-i $FILENAME \
	-t 60 \
	-q:v 1 \
	-vf select="eq(pict_type\,PICT_TYPE_I)" \
	-vsync 0 frame%03d.jpg

All of them?

time ffmpeg \
	-hide_banner \
	-i $FILENAME \
	-q:v 0 \
	-vf select="eq(pict_type\,PICT_TYPE_I)" \
	-vsync 0 \
	frame%03d.jpg

Removing -vsync to see what happens....

time ffmpeg \
	-hide_banner \
	-i $FILENAME \
	-q:v 0 \
	-vf select="eq(pict_type\,PICT_TYPE_I)" \
	frame%03d.jpg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment