Class: HLS::Video::Base
- Inherits:
-
Object
- Object
- HLS::Video::Base
- Defined in:
- lib/hls.rb
Constant Summary collapse
- PLAYLIST =
"index.m3u8".freeze
- Rendition =
Data.define(:width, :height, :bitrate)
Instance Attribute Summary collapse
-
#input ⇒ Object
Returns the value of attribute input.
-
#output ⇒ Object
Returns the value of attribute output.
-
#renditions ⇒ Object
Returns the value of attribute renditions.
Instance Method Summary collapse
- #command ⇒ Object
- #downscaleable_renditions ⇒ Object
-
#initialize(input:, output:) ⇒ Base
constructor
A new instance of Base.
- #rendition ⇒ Object
Constructor Details
Instance Attribute Details
#input ⇒ Object
Returns the value of attribute input.
42 43 44 |
# File 'lib/hls.rb', line 42 def input @input end |
#output ⇒ Object
Returns the value of attribute output.
42 43 44 |
# File 'lib/hls.rb', line 42 def output @output end |
#renditions ⇒ Object
Returns the value of attribute renditions.
42 43 44 |
# File 'lib/hls.rb', line 42 def renditions @renditions end |
Instance Method Details
#command ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/hls.rb', line 62 def command [ "ffmpeg", "-y", "-i", @input.path, "-filter_complex", filter_complex ] + \ video_maps + \ audio_maps + \ [ "-f", "hls", "-var_stream_map", stream_map, "-master_pl_name", PLAYLIST, "-hls_time", "4", "-hls_playlist_type", "vod", "-hls_segment_filename", segment, playlist ] end |
#downscaleable_renditions ⇒ Object
54 55 56 |
# File 'lib/hls.rb', line 54 def downscaleable_renditions @renditions.select { |r| r.width <= input.width } end |