Skip to content

Instantly share code, notes, and snippets.

@kimadactyl
Created February 18, 2016 19:22
Show Gist options
  • Save kimadactyl/a6e8954030d663cf36f9 to your computer and use it in GitHub Desktop.
Save kimadactyl/a6e8954030d663cf36f9 to your computer and use it in GitHub Desktop.
Video previewer. Outputs 10 evenly spaced frames for a directory of videos.
Dir.glob('/YOUR_VIDEOS/*.mp4') do |f|
name = File.basename(f, ".*")
len = `ffprobe #{f} -show_entries format=duration -v quiet -of csv="p=0"`
for n in (1..10)
l = len.to_f / 10 * n
`ffmpeg -i #{f} -ss #{l} -v quiet -vframes 1 './preview/#{name}_#{n}.png'`
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment