cutcut 1.1.0 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/README.md +6 -3
- data/bin/cutcut +10 -5
- data/cutcut.gemspec +1 -1
- data/lib/cutcut/helpers.rb +1 -1
- data/lib/cutcut/media.rb +9 -5
- data/lib/cutcut.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b5396d2a88c481c1c92a4034cd29f4a8cb041b0
|
4
|
+
data.tar.gz: 0257647416668aac8c4f0e947f96b904a295ebd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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/
|
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
|
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
|
-
|
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
data/lib/cutcut/helpers.rb
CHANGED
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
|
-
|
19
|
-
execute_ffmpeg_command(input: @input, output: output, raw_options: { output:
|
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
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.
|
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-
|
11
|
+
date: 2016-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|