venus_video 0.2.0 → 0.3.0
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 +4 -4
- data/lib/venus.rb +49 -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: c5baf63783ab590a23d4a88870cd42ed127c50614141eb17ad5d29f5783e55e1
|
4
|
+
data.tar.gz: e72d5df9e471aab1d7e0d05a9326bb00fc4e45b23d40723e4dba9e81402f59d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f01d55ad8f331500548384d86b454808618072bad24d5d79d6eda20bf5987bfe7c7b2bb4cfc75ecb342822e9a733a716b845eeb79e3dd22a9d615fcf23b1b82
|
7
|
+
data.tar.gz: 6d4737b9d4fe43fdd9731d04b203e39f8c14ca5c48738b3dd2d84df94b88f857a80971f8f153f7fba22c885571579253a84946d2bc9e6caaab93d3cb37598a94
|
data/lib/venus.rb
CHANGED
@@ -136,4 +136,52 @@ module Venus
|
|
136
136
|
[input_file1, input_file2, output_file]
|
137
137
|
end
|
138
138
|
end
|
139
|
-
|
139
|
+
|
140
|
+
class BlurVideo
|
141
|
+
def self.blur_video(input_file, output_file, path: nil, blur_intensity: 20)
|
142
|
+
unless File.exist?(input_file)
|
143
|
+
puts "File not found: #{input_file}"
|
144
|
+
exit 1
|
145
|
+
end
|
146
|
+
|
147
|
+
# Проверка на допустимость blur_intensity
|
148
|
+
unless blur_intensity.is_a?(Numeric) && blur_intensity >= 0
|
149
|
+
puts "Invalid blur intensity. It should be a non-negative number."
|
150
|
+
exit 1
|
151
|
+
end
|
152
|
+
|
153
|
+
output_file = "#{output_file}.mp4" unless output_file.end_with?('.mp4')
|
154
|
+
|
155
|
+
output_path = path ? File.join(path, output_file) : File.join(Dir.pwd, output_file)
|
156
|
+
|
157
|
+
command = "ffmpeg -i #{input_file} -vf 'boxblur=#{blur_intensity}:1' -c:a copy #{output_path}"
|
158
|
+
|
159
|
+
Open3.popen3(command) do |_stdin, _stdout, stderr, wait_thr|
|
160
|
+
while line = stderr.gets
|
161
|
+
puts line
|
162
|
+
end
|
163
|
+
|
164
|
+
exit_status = wait_thr.value
|
165
|
+
unless exit_status.success?
|
166
|
+
puts "Error executing command: #{command}"
|
167
|
+
exit 1
|
168
|
+
end
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def self.process_arguments(args_string)
|
173
|
+
args = args_string.split
|
174
|
+
|
175
|
+
# Проверяем количество аргументов
|
176
|
+
if args.length < 2 || args.length > 4
|
177
|
+
puts 'Usage: ruby main.rb <input_file> <output_file> [path] [blur_intensity]'
|
178
|
+
exit 1
|
179
|
+
end
|
180
|
+
|
181
|
+
input_file = args[0]
|
182
|
+
output_file = args[1]
|
183
|
+
|
184
|
+
[input_file, output_file]
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|