video2gif 0.0.30 → 0.0.31
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 +9 -2
- data/lib/video2gif/options.rb +11 -0
- data/lib/video2gif/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2bb6223bd87603ba92ca6bcb93c3a01b60b4d9c40e0b9389fd47913cf618a6ae
|
4
|
+
data.tar.gz: cdb5efabe21d6ffd7fd2d90d3c7fcfe32946241a70ee6ec9b0122456d56678ef
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71eea53100d93c48dfee4e5fe633fd4a322750c0bf078f3ee1c593c9657ef4911956537a8c74be5dbe31a94d0314fa4168035ea6352271287c61f3839d9a28ce
|
7
|
+
data.tar.gz: 793cb47a931b5326deef087f599fc6d2d00eafdfe74cb5ee4e1c485ee208745d9cb4de69936b5b662caa6f881a64e0864d426f54612533a6dbfddb7177bf4c2e
|
data/Gemfile.lock
CHANGED
data/lib/video2gif/ffmpeg.rb
CHANGED
@@ -123,13 +123,20 @@ module Video2gif
|
|
123
123
|
# generate a palette from the stream using the specified number of
|
124
124
|
# colors and optimizing for moving objects in the stream. Label
|
125
125
|
# this stream's output as "palette."
|
126
|
-
filtergraph <<
|
126
|
+
filtergraph << '[palettegen]palettegen=' + %W[
|
127
|
+
#{options[:palette] || 256}
|
128
|
+
stats_mode=#{options[:palettemode] || 'diff'}
|
129
|
+
].join(':') + '[palette]'
|
127
130
|
|
128
131
|
# Using a copy of the stream from the 'split' filter and the
|
129
132
|
# generated palette as inputs, apply the final palette to the GIF.
|
130
133
|
# For non-moving parts of the GIF, attempt to reuse the same
|
131
134
|
# palette from frame to frame.
|
132
|
-
filtergraph <<
|
135
|
+
filtergraph << '[paletteuse][palette]paletteuse=' + %W[
|
136
|
+
dither=#{options[:dither] || 'floyd_steinberg'}
|
137
|
+
diff_mode=rectangle
|
138
|
+
#{options[:palettemode] == 'single' ? 'new=1' : ''}
|
139
|
+
].join(':')
|
133
140
|
end
|
134
141
|
|
135
142
|
def self.ffprobe_command(options, logger, executable: 'ffprobe')
|
data/lib/video2gif/options.rb
CHANGED
@@ -57,6 +57,17 @@ module Video2gif
|
|
57
57
|
options[:palette] = p
|
58
58
|
end
|
59
59
|
|
60
|
+
parser.on('--palette-mode MODE',
|
61
|
+
'--palettemode MODE',
|
62
|
+
'Configure a custom palette statistics mode, using either',
|
63
|
+
'"full" (single full-frame palette for the whole GIF),',
|
64
|
+
'"diff" (single palette emphasizing movement against a',
|
65
|
+
'static background across frames), or',
|
66
|
+
'"single" (individual palette per frame, adds to file size)',
|
67
|
+
'(default "diff")') do |p|
|
68
|
+
options[:palettemode] = p
|
69
|
+
end
|
70
|
+
|
60
71
|
parser.on('-d [ALGORITHM]',
|
61
72
|
'--[no-]dither [ALGORITHM]',
|
62
73
|
'Set the dithering algorithm for the palette generation',
|
data/lib/video2gif/version.rb
CHANGED