video2gif 0.0.22 → 0.0.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/video2gif/cli.rb +5 -5
- data/lib/video2gif/ffmpeg.rb +4 -4
- data/lib/video2gif/options.rb +2 -2
- data/lib/video2gif/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ae887ec3dbdd0ead6c363292ab6b90ee975646d053e130a17e36899f778446a
|
4
|
+
data.tar.gz: 1c35d1d4f1694faeb8e9cbdd692b4819002172aaa20d60a17382577ab9a145b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25c4b8b6d9bd4063dd192ff74b1223f6795ea55dbc4796f79fcd76b2c04270046ef71bf37d8f361876cff06c42fb1c4a9c1d0158a26b5eb83127d69aeca1e3eb
|
7
|
+
data.tar.gz: 036d26b295bd119b9dd5f8fb202b3a2cee1799175f5cc378a006b11e500ff549e3b817ce85f264547c93c5782575faf6ded923fd7da7b0832180995592b67673
|
data/Gemfile.lock
CHANGED
data/lib/video2gif/cli.rb
CHANGED
@@ -10,12 +10,12 @@ module Video2gif
|
|
10
10
|
module CLI
|
11
11
|
def self.start
|
12
12
|
logger = Logger.new(STDOUT)
|
13
|
-
options =
|
13
|
+
options = Options.parse(ARGV)
|
14
14
|
|
15
15
|
if options[:subtitles]
|
16
16
|
lines = []
|
17
17
|
|
18
|
-
Open3.popen2e(*
|
18
|
+
Open3.popen2e(*FFmpeg.ffprobe_command(options, logger)) do |stdin, stdout_stderr, thread|
|
19
19
|
stdin.close
|
20
20
|
stdout_stderr.each do |line|
|
21
21
|
logger.info(line.chomp) if options[:verbose] unless options[:quiet]
|
@@ -39,12 +39,12 @@ module Video2gif
|
|
39
39
|
end
|
40
40
|
|
41
41
|
if options[:autocrop]
|
42
|
-
Open3.popen2e(*
|
42
|
+
Open3.popen2e(*FFmpeg.cropdetect_command(options, logger)) do |stdin, stdout_stderr, thread|
|
43
43
|
stdin.close
|
44
44
|
stdout_stderr.each do |line|
|
45
45
|
logger.info(line.chomp) if options[:verbose] unless options[:quiet]
|
46
46
|
if line.include?('Parsed_cropdetect')
|
47
|
-
options[:autocrop] = line.match(
|
47
|
+
options[:autocrop] = line.match(FFmpeg::CROP_REGEX)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
stdout_stderr.close
|
@@ -56,7 +56,7 @@ module Video2gif
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
Open3.popen2e(*
|
59
|
+
Open3.popen2e(*FFmpeg.gif_command(options, logger)) do |stdin, stdout_stderr, thread|
|
60
60
|
stdin.close
|
61
61
|
stdout_stderr.each do |line|
|
62
62
|
logger.info(line.chomp) if options[:verbose] unless options[:quiet]
|
data/lib/video2gif/ffmpeg.rb
CHANGED
@@ -14,11 +14,11 @@ module Video2gif
|
|
14
14
|
video_info = options[:probe_infos][:streams].find { |s| s[:codec_type] == 'video' }
|
15
15
|
subtitle_info = options[:probe_infos][:streams].find_all { |s| s[:codec_type] == 'subtitle' }[options[:subtitle_index]]
|
16
16
|
|
17
|
-
if
|
18
|
-
filtergraph << "setpts=PTS+#{
|
17
|
+
if Subtitles::KNOWN_TEXT_FORMATS.include?(subtitle_info[:codec_name])
|
18
|
+
filtergraph << "setpts=PTS+#{Utils.duration_to_seconds(options[:seek])}/TB"
|
19
19
|
filtergraph << "subtitles='#{options[:input_filename]}':si=#{options[:subtitle_index]}"
|
20
20
|
filtergraph << 'setpts=PTS-STARTPTS'
|
21
|
-
elsif
|
21
|
+
elsif Subtitles::KNOWN_BITMAP_FORMATS.include?(subtitle_info[:codec_name])
|
22
22
|
filtergraph << "[0:s:#{options[:subtitle_index]}]scale=" + %W[
|
23
23
|
flags=lanczos
|
24
24
|
sws_dither=none
|
@@ -146,7 +146,7 @@ module Video2gif
|
|
146
146
|
command = [executable]
|
147
147
|
command << '-y'
|
148
148
|
command << '-hide_banner'
|
149
|
-
command << '-analyzeduration' << '2147483647' << '-probesize' << '2147483647'
|
149
|
+
# command << '-analyzeduration' << '2147483647' << '-probesize' << '2147483647'
|
150
150
|
command << '-loglevel' << 'verbose'
|
151
151
|
command << '-ss' << options[:seek] if options[:seek]
|
152
152
|
command << '-t' << options[:time] if options[:time]
|
data/lib/video2gif/options.rb
CHANGED
@@ -154,7 +154,7 @@ module Video2gif
|
|
154
154
|
'resulting GIF. Takes an optional integer value to',
|
155
155
|
'choose the subtitle stream (defaults to the first',
|
156
156
|
'subtitle stream, index 0)') do |s|
|
157
|
-
unless
|
157
|
+
unless Utils.is_executable?('ffprobe')
|
158
158
|
puts 'ERROR: Requires FFmpeg utils to be installed (for ffprobe)!'
|
159
159
|
exit 1
|
160
160
|
end
|
@@ -242,7 +242,7 @@ module Video2gif
|
|
242
242
|
|
243
243
|
parser.parse!
|
244
244
|
|
245
|
-
unless
|
245
|
+
unless Utils.is_executable?('ffmpeg')
|
246
246
|
puts 'ERROR: Requires FFmpeg to be installed!'
|
247
247
|
exit 1
|
248
248
|
end
|
data/lib/video2gif/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: video2gif
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.23
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emily St.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|