Module: SamveraHls::Derivatives::Processors::Media
Instance Method Summary collapse
Instance Method Details
#encode_file(file_suffix, options) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/samvera_hls/derivatives/processors/media.rb', line 16 def encode_file(file_suffix, ) return super(file_suffix,) unless file_suffix.include?("hls") Dir::mktmpdir(['sufia', "_#{file_suffix}"], Hydra::Derivatives.temp_file_base){ |temp_dir| encode_hls(source_path, , temp_dir.to_s) SamveraHls::HlsOutputFileService.call(directives, temp_dir) } end |
#encode_hls(input_path, options, output_dir) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/samvera_hls/derivatives/processors/media.rb', line 6 def encode_hls(input_path, , output_dir) segment_base = File.join(output_dir, [:format]) segment_list = segment_base + ".m3u8" segment_files = segment_base + "_%05d.ts" inopts = [Hydra::Derivatives::Processors::Ffmpeg::INPUT_OPTIONS] ||= "-y" outopts = [Hydra::Derivatives::Processors::Ffmpeg::OUTPUT_OPTIONS] output_files = "-segment_list #{segment_list} #{segment_files}" self.class.execute "#{Hydra::Derivatives.ffmpeg_path} #{inopts} -i \"#{input_path}\" #{outopts} #{output_files}" end |