video2gif 0.0.17 → 0.0.18
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/ffmpeg.rb +29 -20
- 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: 201a683929c71a4f1f0857fc4b0316762742695d78986682dfef5ac547fcac8a
|
4
|
+
data.tar.gz: fbd96ac1341097ef254ce3ea85512d1f3c7b856d6bbadf20938ae315fd639a6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33d191ea91ae9ab24e9248b5e3701e05dd8b3f194da3d4b66bddce6518e622866f65e06271dcab6b6ac7051af40abd30cfd132022e7a3c394ec71e4eaa09f486
|
7
|
+
data.tar.gz: c05bfff2d92dd4ce23d6240469aa4d0db718a86f27f0810b47a91ce05c8ed0d1e16d57cb96bc34fb30ffa9cc21599e791d0c54f902d986b1026562ca6a75d4f9
|
data/Gemfile.lock
CHANGED
data/lib/video2gif/ffmpeg.rb
CHANGED
@@ -28,18 +28,17 @@ module Video2gif
|
|
28
28
|
].join(':')
|
29
29
|
end
|
30
30
|
|
31
|
-
#
|
32
|
-
# 'scale' filter is preferred (if we're resizing at all). Scale
|
33
|
-
# here before other filters to avoid unnecessary processing.
|
34
|
-
if options[:width] && !options[:tonemap]
|
35
|
-
filtergraph << "scale=flags=lanczos:sws_dither=none:width=#{options[:width]}:height=-1"
|
36
|
-
end
|
37
|
-
|
38
|
-
# If we're attempting to convert HDR to SDR, use a set of 'zscale'
|
39
|
-
# filters, 'format' filters, and the 'tonemap' filter. The
|
40
|
-
# 'zscale' will do the resize for us as well.
|
31
|
+
# Scale here before other filters to avoid unnecessary processing.
|
41
32
|
if options[:tonemap]
|
42
|
-
|
33
|
+
# If we're attempting to convert HDR to SDR, use a set of
|
34
|
+
# 'zscale' filters, 'format' filters, and the 'tonemap' filter.
|
35
|
+
# The 'zscale' will do the resize for us as well.
|
36
|
+
filtergraph << 'zscale=' + %W[
|
37
|
+
dither=none
|
38
|
+
filter=lanczos
|
39
|
+
width=#{options[:width]}
|
40
|
+
height=trunc(#{options[:width]}/dar)
|
41
|
+
] if options[:width]
|
43
42
|
filtergraph << 'zscale=transfer=linear:npl=100'
|
44
43
|
filtergraph << 'zscale=npl=100'
|
45
44
|
filtergraph << 'format=gbrpf32le'
|
@@ -47,6 +46,15 @@ module Video2gif
|
|
47
46
|
filtergraph << "tonemap=tonemap=#{options[:tonemap]}:desat=0"
|
48
47
|
filtergraph << 'zscale=transfer=bt709:matrix=bt709:range=tv'
|
49
48
|
filtergraph << 'format=yuv420p'
|
49
|
+
else
|
50
|
+
# If we're not attempting to convert HDR to SDR, the standard
|
51
|
+
# 'scale' filter is preferred (if we're resizing at all).
|
52
|
+
filtergraph << 'scale=' + %W[
|
53
|
+
flags=lanczos
|
54
|
+
sws_dither=none
|
55
|
+
width=#{options[:width]}
|
56
|
+
height=trunc(#{options[:width]}/dar
|
57
|
+
].join(':') if options[:width] && !options[:tonemap]
|
50
58
|
end
|
51
59
|
|
52
60
|
# Perform any desired equalization before we overlay text so that
|
@@ -71,14 +79,14 @@ module Video2gif
|
|
71
79
|
.gsub(/\B"\b([^"\u201C\u201D\u201E\u201F\u2033\u2036\r\n]+)\b?"\B/, "\u201C\\1\u201D")
|
72
80
|
.gsub(/\B'\b([^'\u2018\u2019\u201A\u201B\u2032\u2035\r\n]+)\b?'\B/, "\u2018\\1\u2019")
|
73
81
|
|
74
|
-
filtergraph << 'drawtext=' + [
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
+
filtergraph << 'drawtext=' + %W[
|
83
|
+
x='#{ options[:xpos] || '(main_w/2-text_w/2)' }'
|
84
|
+
y='#{ options[:ypos] || "(main_h-line_h*1.5*#{count_of_lines})" }'
|
85
|
+
fontsize='#{ options[:textsize] || 32 }'
|
86
|
+
fontcolor='#{ options[:textcolor] || 'white' }'
|
87
|
+
borderw='#{ options[:textborder] || 3 }'
|
88
|
+
fontfile='#{ options[:textfont] || 'Arial'}'\\\\:style='#{options[:textvariant] || 'Bold' }'
|
89
|
+
text='#{text}'
|
82
90
|
].join(':')
|
83
91
|
end
|
84
92
|
|
@@ -101,7 +109,8 @@ module Video2gif
|
|
101
109
|
|
102
110
|
def self.ffmpeg_command(options, executable: 'ffmpeg')
|
103
111
|
command = [executable]
|
104
|
-
command << '-y'
|
112
|
+
command << '-y'
|
113
|
+
command << '-hide_banner'
|
105
114
|
command << '-analyzeduration' << '2147483647' << '-probesize' << '2147483647'
|
106
115
|
command << '-loglevel' << 'verbose'
|
107
116
|
command << '-ss' << options[:seek] if options[:seek]
|
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.18
|
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-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|