Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Seeking with Multi consumer

View multi-consumer-seek
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
From: /home/app/playlist.rb @ line 60 :
 
55: consumer.start
56:
57: # Connect the producer to the consumer
58: consumer.connect( pls )
59:
=> 60: binding.pry
61: # Wait until the user stops the consumer
62: #consumer.wait_for( event )
63:
64:
65: # Clean up consumer
 
[1] pry(main)> pls.position
=> 200
[2] pry(main)> consumer.position
=> 279
[3] pry(main)> pls.seek(2000)
=> 0
[4] pry(main)> consumer.position
=> 620
[5] pry(main)> pls.position
=> 2028
[6] pry(main)> pls.position
=> 2028
[7] pry(main)> consumer.position
=> 620
[8] pry(main)> pls.get_speed
=> 1.0
[9] pry(main)> consumer.get_speed
NoMethodError: undefined method `get_speed' for #<Mlt::Consumer:0x000000024be130>
from (pry):9:in `<main>'
[10] pry(main)> consumer.is_stopped
=> false
[11] pry(main)> pls.get_speed
=> 1.0
[12] pry(main)> consumer.position
=> 2336
[13] pry(main)> pls.position
=> 2548
[14] pry(main)> pls.seek(500)
=> 0
[15] pry(main)> pls.position
=> 1232
[16] pry(main)> consumer.position
=> 1681
[17] pry(main)> consumer.position
=> 2247
[18] pry(main)> consumer.position
=> 2476
[19] pry(main)> pls.position
=> 2990
[20] pry(main)> pls.position
=> 3274
[21] pry(main)> consumer.position
=> 3346
[22] pry(main)> pls.seek(500)
=> 0
[23] pry(main)> consumer.position
=> 783
[24] pry(main)> consumer.position
=> 1191
[25] pry(main)> pls.position
=> 1633
[26] pry(main)> pls.position
=> 1861
[27] pry(main)> consumer.position
=> 2223
View multi-consumer-seek
1 2 3 4
- mlt_service: decklink:0
mlt_profile: atsc_1080i_50
- mlt_service: decklink:1
mlt_profile: dv_pal_wide
View multi-consumer-seek
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
#!/usr/bin/env ruby
 
# Import required modules
require 'pry'
require 'mlt'
 
# Create the mlt system
Mlt::Factory::init
 
# profile for decklink consumer
#profile = Mlt::Profile.new("atsc_1080i_50")
 
#profile for multi consumer
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
#consumer = Mlt::Consumer.new( profile, "decklink:0" )
consumer = Mlt::Consumer.new( profile, "multi:/root/multi.yml" )
raise "Unable to open multi consumer" if !consumer.is_valid
 
# rescaling for decklink
#consumer.set( "rescale", "bilinear" )
# no rescaling for multi
consumer.set( "rescale", "none" )
#consumer.set("volume", 0.1)
#consumer.set("terminate_on_pause", 0)
 
#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
consumer.start
 
# Connect the producer to the consumer
consumer.connect( pls )
 
binding.pry
# Wait until the user stops the consumer
#consumer.wait_for( event )
 
 
# Clean up consumer
consumer.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.