Module: FFmpegProgress::Utils
- Included in:
- FFmpeg
- Defined in:
- lib/ffmpeg_progress/utils.rb
Overview
Helper methods.
Constant Summary collapse
- BELL =
The bell file to be used to signal completion.
"#{File.('../../..', __FILE__)}/" \ 'assets/LucasGonze_StLouisWaltz.ogg'
Instance Method Summary collapse
-
#bell ⇒ Integer
Play the bell sound.
-
#parse_ffmpeg_time(time_string) ⇒ Integer
Parse a time string in the
ffmpegHH:MM:SS.msformat and return seconds.
Instance Method Details
#bell ⇒ Integer
Play the bell sound.
11 12 13 14 15 16 |
# File 'lib/ffmpeg_progress/utils.rb', line 11 def bell ffplay = spawn "ffplay -nodisp -autoexit '#{BELL}' &> /dev/null" Process.detach(ffplay) ffplay end |
#parse_ffmpeg_time(time_string) ⇒ Integer
Parse a time string in the ffmpeg HH:MM:SS.ms format and return seconds.
23 24 25 26 27 |
# File 'lib/ffmpeg_progress/utils.rb', line 23 def parse_ffmpeg_time(time_string) array = time_string.rpartition('.').first.split(':').map(&:to_i) array[0] * 3600 + array[1] * 60 + array[2] end |