Class: Thwomp::Renderers::FFMPEG
- Inherits:
-
Object
- Object
- Thwomp::Renderers::FFMPEG
- Includes:
- Helper
- Defined in:
- lib/thwomp/renderers/ffmpeg.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Instance Method Summary collapse
- #executable ⇒ Object
- #frames ⇒ Object
-
#initialize(url) ⇒ FFMPEG
constructor
A new instance of FFMPEG.
Methods included from Helper
Constructor Details
#initialize(url) ⇒ FFMPEG
Returns a new instance of FFMPEG.
10 11 12 |
# File 'lib/thwomp/renderers/ffmpeg.rb', line 10 def initialize(url) @filename = Downloader.new(url).filename end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
8 9 10 |
# File 'lib/thwomp/renderers/ffmpeg.rb', line 8 def filename @filename end |
Instance Method Details
#executable ⇒ Object
23 24 25 |
# File 'lib/thwomp/renderers/ffmpeg.rb', line 23 def executable Thwomp.ffmpeg_path || "ffmpeg" end |
#frames ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/thwomp/renderers/ffmpeg.rb', line 14 def frames = Time.now.to_i output_file_name = "#{Dir.tmpdir}/frame_#{}_%d.png" Command.exec("#{executable} -i #{filename} -f image2 -r 1 -vf scale=128:-1 #{output_file_name} &> /dev/null") sort Dir.glob("#{Dir.tmpdir}/frame_#{}_*.png") end |