Skip to content
Create a gist now

Instantly share code, notes, and snippets.

2 consumers 1 playlist
#!/usr/bin/env ruby
# Import required modules
require 'pry'
require 'mlt'
# Create the mlt system
# Establish the mlt profile
profile1 ="atsc_1080i_50")
profile2 ="dv_pal_wide")
profile =
# 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 =
# 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.repeat(0, 2)
# Create the consumer
consumer1 = profile1, "decklink:0" )
consumer2 = profile2, "decklink:1" )
#consumer = 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), { |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
# Connect the producer to the consumer
consumer1.connect( pls )
consumer2.connect( pls )
# Wait until the user stops the consumer
#consumer.wait_for( event )
# Clean up consumer
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.