Class: Vimeo::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/vimeo/utils.rb

Class Method Summary collapse

Class Method Details

.duration(file) ⇒ Object



17
18
19
20
21
# File 'lib/vimeo/utils.rb', line 17

def self.duration(file)
  check_file_exists(file, :video)
  movie = FFMPEG::Movie.new(file)
  movie.duration
end

.insert_logo(file_path, logo_path, new_file_path = nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/vimeo/utils.rb', line 6

def self.(file_path, logo_path, new_file_path = nil)
  check_file_exists(file_path, :video)
  check_file_exists(logo_path, :logo_image)

  new_file_path ||= file_with_logo_path(file_path)
  File.remove(new_file_path) if File.exist?(new_file_path)

  `ffmpeg -i #{file_path} -i #{logo_path} -filter_complex "[0:v][1:v]overlay" -codec:a copy #{new_file_path}`
  new_file_path
end