>> Only the kdenlivetitle producer loads kdenlivetitle xml, but you
>> created a color producer.

Ok I didn't know that. Finally I couldn't fint out how kdenlive add text to
a video, but I think I alsmot understood how open shot does.
Now I created an svg image with text and a transparent background and I
load it with a producer. I just have a problem with the composite
transition. I have been able to mix a movie with a text. But I don't get
the expected results : either I just see the text or with the geometry
property I see the text with transparence.
Here is my code :

void MainWindow::openVideo(){
QString fileName = QFileDialog::getOpenFileName(this);
 if(!fileName.isNull()){
Mlt::Producer *producer = new Mlt::Producer(*m_profile,
fileName.toUtf8().constData());
 if(producer->is_valid()){
m_playlist = new Mlt::Playlist();
Mlt::Producer *subTitleProducer = new Mlt::Producer(*m_profile,
"cedric_01.svg");
 Mlt::Transition *transition = Mlt::Factory::transition(*m_profile,
"composite", NULL);
                        //I tried to change some propertie according to
what I can see in the kdenlive or open shot xml when I add a composition.
 Mlt::Properties *prop = new Mlt::Properties(transition->get_properties());
//prop->set("start", "0,0:100%x100%");
//prop->set("factory", "loader");
//prop->set("aligned", "1");
//prop->set("deinterlace", 0);
//prop->set("geometry", "0%,0%:100%x100%:100");
//prop->set("operator", "over");
//prop->set("softness", 0);
//prop->set("luma_invert", 0);
//prop->set("progressive", 1);
//prop->set("halign", "centre");
//prop->set("valign", "centre");
prop->set("geometry", "0=0%/0%:100%x100%:50");
prop->set("distort", 1);
prop->set("fill", 1);
m_playlist->append(*subTitleProducer, 0, 400);
m_playlist->append(*producer, 0);
m_playlist->mix(0, 400, transition);
m_consumer->stop();
m_consumer->connect(*m_playlist);
delete m_producer;
m_producer = producer;
/*
m_consumer->start();
 play();
}
}
 m_consumer->set ("refresh", 1);
}

So when I open a video, I hear the sound directly. If I remove the geometry
propertie, from the frame 0 to 400 I only see my svg image (my image is
some text over a transparent background but I got a black background)  and
then I see the movie that already started playing. I feel that the
transparence of the svg file is not take into account.
Otherwise with the geometry propertie, I can see the movie and the text but
the text is with 50% of transparence and the movie seems a little more
darker.

May be someone know how I could do that properly ?

Thank you,

Cédric

2012/1/31 Dan Dennedy <[email protected]>

> On Sun, Jan 29, 2012 at 10:30 AM, bettinger cédric <[email protected]>
> wrote:
> > Hello,
> >
> > I am trying to figure out how I could add some text to a video I am
> playing
> > in a qt widget. I am trying to add some text to a video I am reading from
> > the frame 100 to 324.
> > Here is a part of my code :
> > void MainWindow::openVideo(){
> > QString fileName = QFileDialog::getOpenFileName(this);
> > if(!fileName.isNull()){
> > Mlt::Producer *producer = new Mlt::Producer(*m_profile,
> > fileName.toUtf8().constData());
> > if(producer->is_valid()){
> > m_playlist = new Mlt::Playlist();
> > m_playlist->append(*producer);
> > m_consumer->stop();
> > m_consumer->connect(*m_playlist);
> > delete m_producer;
> > m_producer = producer;
> >
> > //*//Adding subtitle
> > Mlt::Producer *subTitleProducer = new Mlt::Producer(*m_profile,
> "color:");
> > char* subTitleData = "<kdenlivetitle width=\"1920\" height=\"1080\"
>
> Only the kdenlivetitle producer loads kdenlivetitle xml, but you
> created a color producer.
>
>
> > out=\"324\"><item z-index=\"0\" type=\"QGraphicsTextItem\"><position
> > x=\"220\" y=\"105.5555555555556\">
> <transform>1,0,0,0,1,0,0,0,1</transform>
> > </position> <content font-color=\"255,0,0,255\"
> > font-outline-color=\"0,0,0,255\" font-pixel-size=\"100\"
> font-italic=\"0\"
> > font-underline=\"0\" font-weight=\"50\" font=\"Sans Serif\"
> > font-outline=\"0\">SOME TEXT THAT WILL BE SUBTITLES</content> </item>
> > <startviewport rect=\"0,0,1920,1080\"/> <endviewport
> > rect=\"0,0,1920,1080\"/> <background
> color=\"0,0,0,0\"/></kdenlivetitle>\"";
> > subTitleProducer->set("xmldata", subTitleData);
> > Mlt::Transition *transition = new Mlt::Transition(*m_profile,
> "Composite");
> > transition->connect(*m_playlist, 1, 0);
> > m_playlist->insert_at(100, subTitleProducer);
> > //*///End adding subtitle
> > m_consumer->start();
> > play();
> > }
> > fps = m_producer->get_fps();
> > }
> > // If file invalid, then on some platforms the dialog messes up SDL.
> > m_consumer->set ("refresh", 1);
> > }
> >
> > You can see my entire code here :
> >
> http://code.google.com/p/testqtmlt/source/browse/trunk/08subtitleAndEncodage?spec=svn21&r=21
> >
> > What I don't understand is how to connect a transition and especially
> what
> > are the integers a_track and b_track and if m_playlist->insert_at(100,
> > subTitleProducer); is the right thing to do.
> >
> > Someone know how I could do it right ?
>
> You need to learn how to prototype compositions with melt and/or xml
> possibly using the demos and other tools like OpenShot or Kdenlive to
> see how they compose things. Then, you may want to look at the code of
> producer_melt.c to see how it uses the API to "connect a transition."
> Even I do these things; I do not do everything from memory.
>
>
> --
> +-DRD-+
>
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Mlt-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mlt-devel

Reply via email to