On Tue, Feb 14, 2012 at 7:56 AM, bettinger cédric <[email protected]> wrote:
>>> 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
For the application you described, do you really want to generate SVG
for each text item? Same thing could be said for kdenlivetitle. Even
if you can embed the XML within MLT XML, it seems a rather bloated
approach. I would suggest looking at Brian's dynamictext filter, but
it may take some additional effort to get the gdk/pango thing working
across platforms. For the new vqm transition, I am using Qt to draw on
the video image. Also, it does not need a composite transition, but
the text for that is very specific to that effect. (Just thinking
aloud here about best approach for you.)
> 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.
Text with transparency sounds like a good thing.
> 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("geometry", "0=0%/0%:100%x100%:50");
The "50" at the end of that property value means 50% opacity.
> prop->set("distort", 1);
FYI, distort=1 is a dangerous approach. It depends on how you generate
the SVG, but the name "distort" is intentionally dangerous sounding.
> 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.
I suppose the composite transition does not have a good default here.
I will look into it soon.
> 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 ?
Change the 50 to 100.
> 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