Skip to content

Instantly share code, notes, and snippets.

@DanGe42
Created July 13, 2018 07:46
Show Gist options
  • Save DanGe42/40a0964f57e3ddb50db572255a21138a to your computer and use it in GitHub Desktop.
Save DanGe42/40a0964f57e3ddb50db572255a21138a to your computer and use it in GitHub Desktop.
60fps timelapse scripts
ffmpeg \
-framerate 60 \ # input framerate = 60fps
-start_number 0000 \ # start at frame_0000.JPG
-i frame_%04d.JPG \ # image filename template
-s 2560x1440 \ # resolution
-r 60 \ # output framerate = 60fps
-crf 17 \ # constant rate factor (17-28 is a "sane" range; lower is less lossy)
-vcodec libx264 \
-pix_fmt yuv420p \ # Support Quicktime playback
timelapse.mp4
#!/usr/bin/env ruby
require 'pathname'
input_dir = ARGV[0]
prefix = ARGV[1]
output_dir = ARGV[2]
if !input_dir || !prefix || !output_dir
abort "Usage: renumber_files.rb directory prefix out_directory"
end
input_dir = Pathname.new(input_dir)
output_dir = Pathname.new(output_dir)
files = Dir.glob(input_dir + "*.JPG")
digits = files.size.to_s.size
files.each_with_index do |file, index|
padded_index = "#{index}".rjust(digits, '0')
destination = output_dir + "#{prefix}#{padded_index}.JPG"
File.symlink(file, destination)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment