class VideoBlur::Blur
Public Class Methods
new(video:, box:)
click to toggle source
# File lib/video_blur/blur.rb, line 3 def initialize(video:, box:) @video = video @box = box end
Public Instance Methods
perform()
click to toggle source
# File lib/video_blur/blur.rb, line 8 def perform command = "ffmpeg -y -i '#{@video.input}' -filter_complex " \ "'[0:v]split=2[v0][v1]; " \ "[v0]crop=#{@box.width}:#{@box.height}:#{@box.x}:#{@box.y},boxblur=4[fg]; " \ "[v1][fg]overlay=#{@box.x}:#{@box.y}[v]' " \ "-map '[v]' -map 0:a -c:v libx264 -c:a copy -movflags +faststart '#{@video.output}'" blur_ok = system(command) unless blur_ok abort("An error occured while blurring the video, see ffmpeg output for more details") end end