Class: Kithe::FfmpegExtractJpg
- Inherits:
-
Object
- Object
- Kithe::FfmpegExtractJpg
- Defined in:
- app/derivative_transformers/kithe/ffmpeg_extract_jpg.rb
Overview
Creates a JPG screen capture using ffmpeg, by default with the ‘thumbnail` filter to choose a representative frame from the first minute or so.
Instance Attribute Summary collapse
-
#frame_sample_size ⇒ Object
readonly
Returns the value of attribute frame_sample_size.
-
#start_seconds ⇒ Object
readonly
Returns the value of attribute start_seconds.
-
#width_pixels ⇒ Object
readonly
Returns the value of attribute width_pixels.
Instance Method Summary collapse
- #call(input_arg) ⇒ Object
-
#initialize(start_seconds: 0, frame_sample_size: false, width_pixels: nil) ⇒ FfmpegExtractJpg
constructor
A new instance of FfmpegExtractJpg.
Constructor Details
#initialize(start_seconds: 0, frame_sample_size: false, width_pixels: nil) ⇒ FfmpegExtractJpg
Returns a new instance of FfmpegExtractJpg.
32 33 34 35 36 |
# File 'app/derivative_transformers/kithe/ffmpeg_extract_jpg.rb', line 32 def initialize(start_seconds: 0, frame_sample_size: false, width_pixels: nil) @start_seconds = start_seconds @frame_sample_size = frame_sample_size @width_pixels = width_pixels end |
Instance Attribute Details
#frame_sample_size ⇒ Object (readonly)
Returns the value of attribute frame_sample_size.
13 14 15 |
# File 'app/derivative_transformers/kithe/ffmpeg_extract_jpg.rb', line 13 def frame_sample_size @frame_sample_size end |
#start_seconds ⇒ Object (readonly)
Returns the value of attribute start_seconds.
13 14 15 |
# File 'app/derivative_transformers/kithe/ffmpeg_extract_jpg.rb', line 13 def start_seconds @start_seconds end |
#width_pixels ⇒ Object (readonly)
Returns the value of attribute width_pixels.
13 14 15 |
# File 'app/derivative_transformers/kithe/ffmpeg_extract_jpg.rb', line 13 def width_pixels @width_pixels end |
Instance Method Details
#call(input_arg) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'app/derivative_transformers/kithe/ffmpeg_extract_jpg.rb', line 46 def call(input_arg) if input_arg.kind_of?(Shrine::UploadedFile) if input_arg.respond_to?(:url) && input_arg.url&.start_with?(/https?\:/) _call(input_arg.url) else Shrine.with_file(input_arg) do |local_file| _call(local_file.path) end end elsif input_arg.respond_to?(:path) _call(input_arg.path) else _call(input_arg.to_s) end end |