make-me-a-gif 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1393de64d97bc84edc30a8bd45cbf748a68dae86
4
+ data.tar.gz: b2c9d67687f78b81e0edca65ca63b1fab2858f50
5
+ SHA512:
6
+ metadata.gz: 31a5c8abf36a2d4f01a6cb98a40f0c565c8d3426904d5bcb9235cb1a91f4e093b96f7195f2487c116167eed8aeb45381cabd229a4415a7c7a2ebca7fd6ba8a1c
7
+ data.tar.gz: eea74a5e5f961c571b2a486021faff6961a5ef5ad2772d9fcc198bfa6cd3b7f15a3f9b49d94960cd0b13c18b55a849fd680e89a1fd28f866bd806d592ccd4f45
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in make-me-a-gif.gemspec
4
+ gemspec
@@ -0,0 +1,27 @@
1
+ # Make Me A Gif!
2
+
3
+ This is a crude script intended mainly to turn a video captured using Quicktime's Record Screen function and turn it into a gif (allowing for aspect-ratio retaining downscaling).
4
+
5
+ ## Requirements
6
+
7
+ You must have ffmpeg and gifsicle installed
8
+
9
+ $ brew install ffmpeg
10
+ $ brew install gifsicle
11
+
12
+
13
+ ## Usage
14
+
15
+ Usage: make-me-a-gif [options]
16
+ -p, --path [PATH] Path to mov file
17
+ -g, --gif-path [PATH] Full path to save the gif to (including file name)
18
+ -s, --scale [SCALE] How to scale the movie down. A value of 2 would scale a 400x300 video to 200x150 (defaults to 2)
19
+
20
+
21
+ ## Contributing
22
+
23
+ 1. Fork it ( https://github.com/[my-github-username]/make-me-a-gif/fork )
24
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
25
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
26
+ 4. Push to the branch (`git push origin my-new-feature`)
27
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'mini_exiftool'
4
+ require 'optparse'
5
+
6
+ system_dependencies = {
7
+ ffmpeg: `which ffmpeg`,
8
+ gifsicle: `which gifsicle`
9
+ }
10
+
11
+ system_dependencies.each do |name, dependency|
12
+ if dependency.empty?
13
+ raise Exception.new("\"#{name}\" does not appear to be in the load path. Please install it.")
14
+ end
15
+ end
16
+
17
+
18
+ options = {scale: 2}
19
+ OptionParser.new do |opts|
20
+ opts.banner = "Usage: make-me-a-gif [options]"
21
+
22
+ opts.on("-p [PATH]", "--path [PATH]", String, "Path to mov file") do |path|
23
+ options[:path] = path
24
+ end
25
+
26
+ opts.on("-g [PATH]", "--gif-path [PATH]", "Full path to save the gif to (including file name)") do |gif_path|
27
+ options[:gif_path] = gif_path
28
+ end
29
+
30
+ opts.on("-s [SCALE]", "--scale [SCALE]", "How to scale the movie down. A value of 2 would scale a 400x300 video to 200x150 (defaults to 2)") do |scale|
31
+ options[:scale] = scale
32
+ end
33
+
34
+ end.parse!
35
+
36
+ raise OptionParser::MissingArgument unless options[:path]
37
+
38
+ exif_data = MiniExiftool.new(options[:path])
39
+
40
+ scaled_height = exif_data[:imageHeight] / options[:scale].to_i
41
+ scaled_width = exif_data[:imageWidth] / options[:scale].to_i
42
+
43
+ gif_name = File.basename(options[:path], '.mov')
44
+ options[:gif_path] ||= "#{File.dirname(options[:path])}/#{gif_name}.gif"
45
+
46
+
47
+ system("ffmpeg -i #{options[:path]} -s #{scaled_width}x#{scaled_height} -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > #{options[:gif_path]}")
@@ -0,0 +1,20 @@
1
+ # coding: utf-8
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "make-me-a-gif"
5
+ spec.version = "0.0.1"
6
+ spec.authors = ["Jessie Keck"]
7
+ spec.email = ["jkeck@stanford.edu"]
8
+ spec.summary = %q{A crude script to turn a video captured using Quicktime's Record Screen function and turn it into a gif.}
9
+ spec.homepage = ""
10
+
11
+ spec.files = `git ls-files -z`.split("\x0")
12
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
13
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
14
+ spec.require_paths = ["lib"]
15
+
16
+ spec.add_dependency "mini_exiftool"
17
+
18
+ spec.add_development_dependency "bundler", "~> 1.7"
19
+ spec.add_development_dependency "rake", "~> 10.0"
20
+ end
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: make-me-a-gif
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jessie Keck
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-01-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: mini_exiftool
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description:
56
+ email:
57
+ - jkeck@stanford.edu
58
+ executables:
59
+ - make-me-a-gif
60
+ extensions: []
61
+ extra_rdoc_files: []
62
+ files:
63
+ - ".gitignore"
64
+ - Gemfile
65
+ - README.md
66
+ - Rakefile
67
+ - bin/make-me-a-gif
68
+ - make-me-a-gif.gemspec
69
+ homepage: ''
70
+ licenses: []
71
+ metadata: {}
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ requirements: []
87
+ rubyforge_project:
88
+ rubygems_version: 2.2.2
89
+ signing_key:
90
+ specification_version: 4
91
+ summary: A crude script to turn a video captured using Quicktime's Record Screen function
92
+ and turn it into a gif.
93
+ test_files: []