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