Hi,
I found the way to use the colour service in c# with mono.
The purpose was to play a video file, fade it to black, and fade it from
black colour to another video file.
here is the exemple function, which work fine :
private void MultitrackMixPlayWithColour(string file1, string file2)
{
Factory.init();
Profile profile = new Profile("atsc_720p_30");
Producer p0 = new Producer(profile,"colour","black");
Producer p1 = new Producer( profile,file1,null);
Producer p2 = new Producer( profile,file2,null);
Playlist playlist1 = new Playlist();
playlist1.append(p1);
Playlist playlist0 = new Playlist();
playlist0.blank(playlist1.get_length()-1 -50);
playlist0.append(p0);
Playlist playlist2 = new Playlist();
playlist2.blank(playlist1.get_length()-1 );
playlist2.append(p2);
Tractor tr = new Tractor();
Field field = tr.field();
Multitrack multi = tr.multitrack();
multi.connect(playlist1,0);
multi.connect(playlist0,1);
multi.connect(playlist2,2);
Transition t = new Transition(profile,"luma");
t.set("in",playlist1.get_length()-1 -50);
t.set("out",playlist1.get_length()-1);
field.plant_transition(t,0,1);
Transition t2 = new Transition(profile,"luma");
t2.set("in",playlist1.get_length()-1 );
t2.set("out",playlist1.get_length()-1 + 50);
t2.set("reverse",1);
field.plant_transition(t2,2,1);
if (tr.is_valid())
{
tr.set("length",playlist2.get_length());
System.Console.WriteLine(string.Format("length : {0}",
tr.get_length()));
Consumer c = new Consumer(profile, "sdl", null);
c.set("rescale", "none");
c.connect(tr);
c.start();
while (!c.is_stopped())
{
Thread.Sleep(300);
System.Console.WriteLine(string.Format("position : {0}",
tr.position()));
if (tr.position() >= tr.get_length()-1)
break;
}
c.stop();
}
}
There is one thing I don't understand : Why the transition from colour
producer to video producer (t2 in my exemple) need to be code this way ?
I explain : Firstly, I didn't put the property "reverse", and set the
transition "t2" like that :
field.plant_transition(t2,1,2);
"1" is the colour playlist
"2" is the video file file2 playlist.
But this code didn't work ! The transition didn't run.
I would be happy to understand why ?
Regards
Steeve
|