Sha256: 43c9f120d2c6b50f05255e6ce187ab0cb52426f83e362017b9df45fe99122864
Contents?: true
Size: 1005 Bytes
Versions: 1
Compression:
Stored size: 1005 Bytes
Contents
module EDL # When initialized with a file and passed an EDL, will generate thumbnail images # of the first frame of every event. It is assumed that the movie file starts at the same # frame as the first EDL event. class Grabber attr_accessor :ffmpeg_bin, :offset def initialize(with_file) @source_path = with_file end def ffmpeg_bin @ffmpeg_bin || 'ffmpeg' end def grab(edl) edl.from_zero.events.each do | evt | grab_frame_tc = evt.rec_start_tc + (offset || 0 ) to_file = File.dirname(@source_path) + '/' + evt.num + '_' + File.basename(@source_path).gsub(/\.(\w+)$/, '') generate_grab(evt.num, grab_frame_tc, to_file) end end def generate_grab(evt, at, to_file) # cmd = "#{ffmpeg_bin} -i #{@source_path} -an -ss #{at} -vframes 1 -r #{at.fps} -y #{to_file}%d.jpg" cmd = "#{ffmpeg_bin} -i #{@source_path} -an -ss #{at} -vframes 1 -y #{to_file}%d.jpg" `#{cmd}` end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
edl-0.0.1 | lib/edl/grabber.rb |