Module: VideoTranscoding::FFmpeg

Extended by:
FFmpeg
Included in:
FFmpeg
Defined in:
lib/video_transcoding/ffmpeg.rb

Constant Summary collapse

COMMAND_NAME =
'ffmpeg'

Instance Method Summary collapse

Instance Method Details

#aac_encoderObject



43
44
45
# File 'lib/video_transcoding/ffmpeg.rb', line 43

def aac_encoder
  Tool.properties(COMMAND_NAME)[:aac_encoder]
end

#command_nameObject



39
40
41
# File 'lib/video_transcoding/ffmpeg.rb', line 39

def command_name
  Tool.use(COMMAND_NAME)
end

#setupObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/video_transcoding/ffmpeg.rb', line 13

def setup
  Tool.provide(COMMAND_NAME, ['-version']) do |output, status, properties|
    fail "#{COMMAND_NAME} failed during execution" unless status == 0

    unless output =~ /^ffmpeg version ([0-9.]+)/
      Console.debug output
      fail "#{COMMAND_NAME} version unknown"
    end

    version = $1
    Console.info "#{$MATCH} found..."

    unless version =~ /^([0-9]+)\.([0-9]+)/ and (($1.to_i * 100) + $2.to_i) >= 205
      fail "#{COMMAND_NAME} version 2.5.0 or later required"
    end

    if output =~ /--enable-libfdk-aac/
      properties[:aac_encoder] = 'libfdk_aac'
    elsif output =~ /--enable-libfaac/
      properties[:aac_encoder] = 'libfaac'
    else
      properties[:aac_encoder] = 'aac'
    end
  end
end