Created
September 22, 2012 20:14
-
-
Save pauladam/3767668 to your computer and use it in GitHub Desktop.
movie -> gif89a
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/ruby | |
| # gif-it | |
| if ARGV.length < 3 | |
| puts "usage: gif-it <filename> <start-time> <duration>" | |
| end | |
| fn = ARGV.shift | |
| start_time = ARGV.shift | |
| duration = ARGV.shift | |
| basename = File.basename(fn) | |
| outputfn = "%s.gif" % basename | |
| cmd = "ffmpeg -i \"%s\" -pix_fmt rgb24 -s cif -loop_output 0 -ss %s -t %s -r 6 -y \"%s\"" | |
| args = [fn, start_time, duration, basename] | |
| cmd_w_args = cmd % args | |
| puts cmd_w_args | |
| `#{cmd_w_args}` | |
| convert_cmd = "convert -depth 8 %s %s" % [outputfn, outputfn] | |
| puts convert_cmd | |
| `#{convert_cmd}` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment