Class: Abrizer::ProgressiveMp4
- Inherits:
-
Object
- Object
- Abrizer::ProgressiveMp4
show all
- Includes:
- FilepathHelpers
- Defined in:
- lib/abrizer/progressive_mp4.rb
Instance Method Summary
collapse
#adaptations_filepath, #all_media_paths, #audio_filepath, #audio_filepath_fragmented, #basename, #canvas_filepath, #canvas_partial_filepath, #captions_filepath, #data_filepath, #data_partial_filepath, #ffprobe_filepath, #filename_directory, #first_image_filepath, #hlsts_aac_filepath, #hlsts_aac_partial_filepath, #hlsts_filepath, #hlsts_partial_filepath, #mp3_filepath, #mp3_partial_filepath, #mp4_filepath, #mp4_partial_filepath, #mpd_filepath, #mpd_partial_filepath, #output_directory, #output_directory_basename, #poster_filepath, #poster_image_filepath, #poster_partial_filepath, #sprites_filepath, #sprites_partial_filepath, #vp9_filepath, #vp9_partial_filepath, #webvtt_input_filepath
Constructor Details
Returns a new instance of ProgressiveMp4.
6
7
8
9
|
# File 'lib/abrizer/progressive_mp4.rb', line 6
def initialize(output_dir)
@output_directory = output_dir
find_adaptation
end
|
Instance Method Details
#create ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/abrizer/progressive_mp4.rb', line 11
def create
if File.exist? input_video_filepath
`#{ffmpeg_cmd}`
else
raise Mp4AdaptationNotFoundError
end
end
|
#ffmpeg_cmd ⇒ Object
31
32
33
34
35
|
# File 'lib/abrizer/progressive_mp4.rb', line 31
def ffmpeg_cmd
"ffmpeg -y -i #{input_video_filepath} -i #{audio_filepath_fragmented} -c:v copy -c:a copy #{mp4_filepath} -movflags faststart"
end
|
#find_adaptation ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/abrizer/progressive_mp4.rb', line 19
def find_adaptation
adaptations = Abrizer::AdaptationFinder.new(output_directory: @output_directory).adaptations
sorted = adaptations.sort_by do |adaptation|
adaptation.width
end
@adaptation = sorted[-2]
end
|
27
28
29
|
# File 'lib/abrizer/progressive_mp4.rb', line 27
def input_video_filepath
@adaptation.filepath_fragmented(@output_directory)
end
|