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