Class: HLS::Poster
- Inherits:
-
Object
- Object
- HLS::Poster
- Defined in:
- lib/hls.rb
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #command ⇒ Object
-
#initialize(input:, output:, width:, height:) ⇒ Poster
constructor
A new instance of Poster.
Constructor Details
#initialize(input:, output:, width:, height:) ⇒ Poster
Returns a new instance of Poster.
15 16 17 18 19 20 |
# File 'lib/hls.rb', line 15 def initialize(input:, output:, width:, height:) @input = input @output = output.join("poster.jpg") @width = width @height = height end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
13 14 15 |
# File 'lib/hls.rb', line 13 def height @height end |
#input ⇒ Object (readonly)
Returns the value of attribute input.
13 14 15 |
# File 'lib/hls.rb', line 13 def input @input end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
13 14 15 |
# File 'lib/hls.rb', line 13 def output @output end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
13 14 15 |
# File 'lib/hls.rb', line 13 def width @width end |
Instance Method Details
#command ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/hls.rb', line 22 def command [ # invoke ffmpeg "ffmpeg", # overwrite output files without confirmation "-y", # input video file "-i", input, # scale video to target resolution "-vf", "scale=w=#{width}:h=#{height}:force_original_aspect_ratio=decrease", # extract only one frame "-frames:v", "1", # output file path output ] end |