cutcut 1.1.0 → 1.2.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75111491536a777f1518aa51a025c2bb87356ef9
4
- data.tar.gz: 70b2fc148ed07dd389e27c39e68f0d8d1e0fedab
3
+ metadata.gz: 9b5396d2a88c481c1c92a4034cd29f4a8cb041b0
4
+ data.tar.gz: 0257647416668aac8c4f0e947f96b904a295ebd9
5
5
  SHA512:
6
- metadata.gz: 4ac1b04f0962ae62ddca62be5cce326a5c8de92500cc842244ae7c760ade07494aae97dcb582202ec76eb5422b72a834dd68b91cbe43d2449e5fcc29162dc037
7
- data.tar.gz: 539a48f89ff804c4372005a62e41b9e2e2a5eb5d6752f508415d51cf8bd66a1887005eb0736f272a8f578b8aade8cf97f4b8dd950bbabbbd537297b460531307
6
+ metadata.gz: b23972d77396536dd13fc70a04becfd0b71fc903891713b1d4e39658774f1fbc30d50c47ee75a4ea655c55aac76843cb9a273b0d5aac422f32f6621484764cad
7
+ data.tar.gz: 2380715822adf6dcf5fa0fc67c52433b9a133425842eb8b6614a50d5d1a99c909b3e0b180ff70101d2f92dcf19f2dec2df4e993f785ee7ef5657aabb6ee421ea
data/CHANGELOG.md CHANGED
@@ -1,6 +1,24 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ Version 1.2.2 (April 20, 2016)
5
+ -----------------------------
6
+
7
+ * Remove invalid progressbar increment
8
+ * Escape folders containing spaces
9
+
10
+ Version 1.2.1 (April 10, 2016)
11
+ -----------------------------
12
+
13
+ * Fix --scale option
14
+ * Fix timelapse conversion when folder include space
15
+
16
+ Version 1.2.0 (April 8, 2016)
17
+ -----------------------------
18
+
19
+ * Add --remove-audio option
20
+ * Fix progressbar increment
21
+
4
22
  Version 1.1.0 (March 17, 2016)
5
23
  -----------------------------
6
24
 
data/README.md CHANGED
@@ -1,19 +1,22 @@
1
1
  # cutcut
2
2
 
3
- Trim/Cut/Screenshot videos
3
+ * Trim/Cut/Scale videos
4
+ * Change video playback speed
5
+ * Extract video screenshots based on an interval
6
+ * Create timelapses based on sequential images
4
7
 
5
8
  # Usage
6
9
 
7
10
  ```
8
- gem install cutcut git: git@github.com:stjhimy/cutcut.git
11
+ gem install cutcut
9
12
  ```
10
13
 
11
14
  ```ruby
12
15
  media = CutCut::Media.new(input: 'path_to_file.mp4')
13
16
  media.convert(scale: '1280:720')
14
17
  media.convert(scale: '1280:720', copy_metadata: true)
18
+ media.convert(speed: 2)
15
19
  media.extract_screenshots
16
- media.cut(start: '00:00', time: 10)
17
20
 
18
21
  timelapse = CutCut::Timelapse.new(input: 'path_to_folder')
19
22
  media.convert(scale: '1280:720')
data/bin/cutcut CHANGED
@@ -8,13 +8,16 @@ options = {}
8
8
  OptionParser.new do |opt|
9
9
  opt.on('--convert', 'Convert all videos in a folder') { options[:convert] = true }
10
10
  opt.on('--copy-metadata', 'Copy original video metadata') { options[:copy_metadata] = true }
11
- opt.on('--scale', 'SCALE_RESOLUTION') { |e| options[:scale] = e }
12
- opt.on('--timelapse-fps FPS', 'Timelapse FPS') { |e| options[:timelapse_fps] = e }
13
11
  opt.on('--extract-screenshots NUMBER', 'Screenshots per second') { |e| options[:extract_screenshots] = e }
12
+ opt.on('--input INPUT', 'Input') { |e| options[:input] = e }
13
+ opt.on('--remove-audio', 'Video speed') { options[:remove_audio] = true }
14
+ opt.on('--scale SCALE_RESOLUTION', 'Resolution to scale eg: 1280:720') { |e| options[:scale] = e }
15
+ opt.on('--speed NUMBER', 'Video speed') { |e| options[:speed] = e }
16
+ opt.on('--timelapse-fps FPS', 'Timelapse FPS') { |e| options[:timelapse_fps] = e }
14
17
  end.parse!
15
18
 
16
19
  pwd = ENV['PWD']
17
- options[:input_dir] ||= pwd
20
+ options[:input_dir] ||= options[:input] || pwd
18
21
  options[:copy_metadata] ||= false
19
22
 
20
23
  files = Dir[File.join(options[:input_dir], '/*.mp4')]
@@ -26,13 +29,15 @@ puts "#{files.count + folders.count} files found"
26
29
  files.each do |file|
27
30
  media = CutCut::Media.new(input: file)
28
31
  scale = options[:scale] || '1920:1080'
29
- media.convert(copy_metadata: options[:copy_metadata], scale: scale)
32
+ speed = options[:speed]
33
+ remove_audio = options[:remove_audio]
34
+ media.convert(copy_metadata: options[:copy_metadata], scale: scale, speed: speed, remove_audio: remove_audio)
30
35
  media.extract_screenshots(fps: options[:extract_screenshots], copy_metadata: true) if options[:extract_screenshots]
31
36
  progressbar.increment
32
37
  end
33
38
 
34
39
  folders.each do |folder|
35
- timelapse = CutCut::Timelapse.new(input: folder, output: File.join(options[:input_dir], File.basename(folder) + '.mp4'))
40
+ timelapse = CutCut::Timelapse.new(input: Regexp.escape(folder), output: Regexp.escape(File.join(options[:input_dir], File.basename(folder).gsub(/\s+/, '_') + '.mp4')))
36
41
  scale = options[:scale] || '1920:1080'
37
42
  timelapse.convert(fps: options[:timelapse_fps] || 30, scale: scale)
38
43
  progressbar.increment
data/cutcut.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
6
6
  s.license = 'MIT'
7
7
  s.summary = 'Trim/Cut/Screenshot videos'
8
8
  s.description = 'CLI for working with videos'
9
- s.version = '1.1.0'
9
+ s.version = '1.2.2'
10
10
 
11
11
  s.executables = ['cutcut']
12
12
  s.files = `git ls-files`.split("\n")
@@ -13,7 +13,7 @@ module CutCut
13
13
  end
14
14
 
15
15
  def self.copy_metadata(origin, target)
16
- exif = MiniExiftool.new(target)
16
+ exif = MiniExiftool.new(target.delete('\\'))
17
17
  exif.copy_tags_from(origin, '*')
18
18
  end
19
19
  end
data/lib/cutcut/media.rb CHANGED
@@ -10,18 +10,22 @@ module CutCut
10
10
  end
11
11
 
12
12
  def convert(options = {})
13
- scale = options[:scale]
14
- speed = "-filter:v \"setpts=#{options[:speed]}*PTS\"" if options[:speed]
15
13
  copy_metadata = options[:copy_metadata] || false
16
-
17
14
  output = options[:output] || @output || File.join(@output_path, '__' + File.basename(@input))
18
- raw_options = "-movflags +faststart -vf scale=#{scale} -c:v libx264 -crf 20 -preset ultrafast #{speed}"
19
- execute_ffmpeg_command(input: @input, output: output, raw_options: { output: raw_options })
15
+
16
+ execute_ffmpeg_command(input: @input, output: output, raw_options: { output: extract_output_raw_options(options) })
20
17
 
21
18
  Helpers.copy_metadata(@input, output) if copy_metadata
22
19
  output
23
20
  end
24
21
 
22
+ def extract_output_raw_options(options = {})
23
+ scale = options[:scale]
24
+ speed = "-filter:v \"setpts=#{options[:speed]}*PTS\"" if options[:speed]
25
+ remove_audio = options[:remove_audio] == true ? '-an' : nil
26
+ "-movflags +faststart -vf scale=#{scale} -c:v libx264 -crf 20 -preset ultrafast #{speed} #{remove_audio}"
27
+ end
28
+
25
29
  def extract_screenshots(options = {})
26
30
  fps = options[:fps] || 1
27
31
  basename = options[:basename] || File.basename(@input, '.MP4') + '_screenshot'
data/lib/cutcut.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'active_support/all'
2
2
  require 'cutcut/base'
3
3
  require 'cutcut/helpers'
4
- require 'cutcut/timelapse'
5
4
  require 'cutcut/media'
5
+ require 'cutcut/timelapse'
6
6
  require 'mini_exiftool'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cutcut
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jhimy Fernandes Villar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-27 00:00:00.000000000 Z
11
+ date: 2016-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport