9e28782e6d5ac921d10b747f9b52a48ba557e641
6 # Create the mlt system
9 # Get and check the argument
13 size
= "192x144" if size
.nil?
14 raise
"Usage: thumbs.rb file name [ size ]" if file
.nil? || name
.nil?
17 producer
= Mltpp
::Producer.new( file )
18 raise
"Unable to load #{file}" if !producer
.is_valid
20 # Construct the playlist
21 playlist
= Mltpp
::Playlist.new( )
24 out
= producer
.get_int( "out" )
;
26 # Calculate position of frames
27 [ 0, 0.25, 0.5, 0.75, 1 ].each
{ |x
| playlist
.append( producer
, x
*out
, x
*out )
}
29 # Create the thumb nail generator
30 generator
= Mltpp
::Consumer.new( "avformat", "#{name}%d.jpg" )
31 generator
.set( "real_time", "0" )
32 generator
.set( "progressive", "1" )
33 generator
.set( "size", size )
35 # Connect the consumer
36 generator
.connect( playlist )
;