Skip to content

@trickkiste /gist:3804892
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
2 consumers 1 playlist
#!/usr/bin/env ruby
# Import required modules
require 'pry'
require 'mlt'
# Create the mlt system
Mlt::Factory::init
# Establish the mlt profile
profile1 = Mlt::Profile.new("atsc_1080i_50")
profile2 = Mlt::Profile.new("dv_pal_wide")
profile = Mlt::Profile.new()
# Get and check the argument
file = ARGV.shift
raise "Usage: test.rb file1 file2" if file.nil?
file2 = ARGV.shift
raise "Usage: test.rb file1 file2" if file2.nil?
pls = Mlt::Playlist.new()
# Create the producer
producer = Mlt::Factory::producer( profile, file )
raise "Unable to load #{file}" if !producer.is_valid
producer2 = Mlt::Factory::producer( profile, file2 )
raise "Unable to load #{file2}" if !producer2.is_valid
pls.append(producer)
#pls.repeat(0, 2)
pls.append(producer2)
# Create the consumer
consumer1 = Mlt::Consumer.new( profile1, "decklink:0" )
consumer2 = Mlt::Consumer.new( profile2, "decklink:1" )
#consumer = Mlt::Consumer.new( profile, "multi:/home/app/multi.yml" )
raise "Unable to open decklink:0 consumer" if !consumer1.is_valid
raise "Unable to open decklink:1 consumer" if !consumer2.is_valid
# Turn off the default rescaling
consumer1.set( "rescale", "bilinear" )
consumer2.set( "rescale", "bilinear" )
#consumer.set( "rescale", "none" )
consumer1.set( "realtime", 4 )
consumer2.set( "realtime", 4 )
#consumer.set( "buffer", 0 )
#consumer.set( "prefill", 0 )
consumer1.set( "terminate_on_pause", 0)
consumer2.set( "terminate_on_pause", 0)
#consumer.set("volume", 0.1)
#Mlt::PlaylistNextListener.new(pls, Proc.new { |i|
# info = pls.clip_info(i)
# puts "finished playing #{info.resource}\n"
#})
# Set up a 'wait for' event
#event = consumer.setup_wait_for( "consumer-stopped" )
# Start the consumer
consumer1.start
consumer2.start
# Connect the producer to the consumer
consumer1.connect( pls )
consumer2.connect( pls )
binding.pry
# Wait until the user stops the consumer
#consumer.wait_for( event )
# Clean up consumer
consumer1.stop
consumer2.stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.