lib/abrizer/ffmpeg_processor.rb in abrizer-0.3.0 vs lib/abrizer/ffmpeg_processor.rb in abrizer-0.4.0
- old
+ new
@@ -1,9 +1,11 @@
module Abrizer
+ # Creates the fMP4 files that are then packaged
class FfmpegProcessor
include FilepathHelpers
+ include DebugSettings
def initialize(filename, output_dir=nil)
@filename = filename
@output_directory = output_dir
@adaptation_finder = Abrizer::AdaptationFinder.new(@filename)
@@ -16,11 +18,11 @@
process_second_passes
process_audio
end
def make_directory
- FileUtils.mkdir output_directory unless File.exist? output_directory
+ FileUtils.mkdir_p output_directory unless File.exist? output_directory
end
def first_pass_adaptation
adaptations = Abrizer::AdaptationFinder.new(@filename).adaptations
sorted = adaptations.sort_by do |adaptation|
@@ -48,10 +50,10 @@
FileUtils.rm adaptation.filepath(@filename, output_directory)
end
end
def process_audio
- `ffmpeg -y -i #{@filename} -c:a libfdk_aac -b:a 128k -vn #{audio_filepath}`
+ `ffmpeg -y #{debug_settings} -i #{@filename} -c:a libfdk_aac -b:a 128k -vn #{audio_filepath}`
`mp4fragment #{audio_filepath} #{audio_filepath_fragmented}`
FileUtils.rm audio_filepath
end
end