Sha256: 1307eec5e09cccf1786860394d3627eafca7b099687bd9de0d52acfa3d4f3d80

Contents?: true

Size: 807 Bytes

Versions: 6

Compression:

Stored size: 807 Bytes

Contents

module SimplePvr
  class Ffmpeg
    def self.create_thumbnail_for(path)
      thumbnail_file_name = path + '/thumbnail.png'
      log_file_name = path + '/thumbnail.png.log'

      pid = Process.spawn("ffmpeg -i \"#{path}/stream.ts\" -ss 00:05:00.000 -f image2 -vframes 1 -vf scale=300:ih*300/iw \"#{thumbnail_file_name}\" > \"#{log_file_name}\" 2>&1")
      Process.detach(pid)
    end

    def self.transcode_to_webm(path)
      stream_file_name = path + '/stream.ts'
      webm_file_name = path + '/stream.webm'
      log_file_name = path + '/stream.webm.log'

      unless File.exists?(webm_file_name)
        pid = Process.spawn("ffmpeg -i \"#{stream_file_name}\" -b 64k -vf scale=640:ih*640/iw \"#{webm_file_name}\" > \"#{log_file_name}\" 2>&1")
        Process.detach(pid)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
simple_pvr-1.1.0 lib/simple_pvr/ffmpeg.rb
simple_pvr-1.0.0 lib/simple_pvr/ffmpeg.rb
simple_pvr-0.0.4 lib/simple_pvr/ffmpeg.rb
simple_pvr-0.0.3 lib/simple_pvr/ffmpeg.rb
simple_pvr-0.0.2 lib/simple_pvr/ffmpeg.rb
simple_pvr-0.0.1 lib/simple_pvr/ffmpeg.rb