Re: [Mlt-devel] [PATCH] use sse2 instruction for line compositing

2012-02-14 Thread Maksym Veremeyenko

10.02.12 07:41, Dan Dennedy написав(ла):

2012/2/2 Maksym Veremeyenkove...@m1stereo.tv:

Hi,

attached patch perform line compositing for SSE2+ARCH_X86_64 build. It works
for a case where luma is not defined...


Hi Maksym, did some more testing and ran into a couple of image
quality problems. First, alpha blending seems poor, mostly noticeable
with a text with curvy typeface over video:

melt clip1.dv -filter dynamictext:Hello size=200 outline=2
olcolour=white family=elegante bgcolor=0x0020

The first time you run that you will see that the alpha of bgcolour
(black with 12.5% opacity) is not honored and the background is black.
Set bgcolour=0 to make it completely transparent and look along curved
edges to see the poor blending.

The second problem is that key-framing opacity causes a repeating
cycle of 100% A frame, A+B blended, and 100% B frame. The below
reproduces it:

melt color:red -track color:blue -transition composite out=99
geometry=0=0/0:100%x100%:0; 99=0/0:100%x100%:100



i wrongly assumed weight range in 0..255 - updated patch attached...


--

Maksym Veremeyenko
From e8c8a1dde7883f203f609f364a27ea6c1a77104f Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko ve...@m1stereo.tv
Date: Tue, 14 Feb 2012 13:34:12 +0200
Subject: [PATCH] use sse2 instruction for line compositing

---
 src/modules/core/composite_line_yuv_sse2_simple.c |  164 +
 src/modules/core/transition_composite.c   |   12 ++-
 2 files changed, 174 insertions(+), 2 deletions(-)
 create mode 100644 src/modules/core/composite_line_yuv_sse2_simple.c

diff --git a/src/modules/core/composite_line_yuv_sse2_simple.c b/src/modules/core/composite_line_yuv_sse2_simple.c
new file mode 100644
index 000..f202828
--- /dev/null
+++ b/src/modules/core/composite_line_yuv_sse2_simple.c
@@ -0,0 +1,164 @@
+const static unsigned char const1[] =
+{
+0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x00
+};
+
+__asm__ volatile
+(
+pxor   %%xmm0, %%xmm0  \n\t   /* clear zero register */
+movdqu (%4), %%xmm9\n\t   /* load const1 */
+movd   %0, %%xmm1  \n\t   /* load weight and decompose */
+movlhps%%xmm1, %%xmm1  \n\t
+pshuflw$0, %%xmm1, %%xmm1  \n\t
+pshufhw$0, %%xmm1, %%xmm1  \n\t
+
+/*
+xmm1 (weight)
+
+00  W 00  W 00  W 00  W 00  W 00  W 00  W 00  W
+*/
+loop_start:\n\t
+movq   (%1), %%xmm2\n\t   /* load source alpha */
+punpcklbw  %%xmm0, %%xmm2  \n\t   /* unpack alpha 8 8-bits alphas to 8 16-bits values */
+
+/*
+xmm2 (src alpha)
+xmm3 (dst alpha)
+
+00 A8 00 A7 00 A6 00 A5 00 A4 00 A3 00 A2 00 A1
+*/
+pmullw %%xmm1, %%xmm2  \n\t   /* premultiply source alpha */
+psrlw  $8, %%xmm2  \n\t
+
+/*
+xmm2 (premultiplied)
+
+00 A8 00 A7 00 A6 00 A5 00 A4 00 A3 00 A2 00 A1
+*/
+
+
+/*
+DSTa = DSTa + (SRCa * (0xFF - DSTa))  8
+*/
+movq   (%5), %%xmm3\n\t   /* load dst alpha */
+punpcklbw  %%xmm0, %%xmm3  \n\t   /* unpack dst 8 8-bits alphas to 8 16-bits values */
+movdqa %%xmm9, %%xmm4  \n\t
+psubw  %%xmm3, %%xmm4  \n\t
+pmullw %%xmm2, %%xmm4  \n\t
+psrlw  $8, %%xmm4  \n\t
+paddw  %%xmm4, %%xmm3  \n\t
+packuswb   %%xmm0, %%xmm3  \n\t
+movq   %%xmm3, (%5)\n\t   /* save dst alpha */
+
+movdqu (%2), %%xmm3\n\t   /* load src */
+movdqu (%3), %%xmm4\n\t   /* load dst */
+movdqa %%xmm3, %%xmm5  \n\t   /* dub src */
+movdqa %%xmm4, %%xmm6  \n\t   /* dub dst */
+
+/*
+xmm3 (src)
+xmm4 (dst)
+xmm5 (src)
+xmm6 (dst)
+
+U8 V8 U7 V7 U6 V6 U5 V5 U4 V4 U3 V3 U2 V2 U1 V1
+*/
+
+punpcklbw  %%xmm0, %%xmm5  \n\t   /* unpack src low */
+punpcklbw  %%xmm0, %%xmm6  \n\t   /* unpack dst low */
+punpckhbw  %%xmm0, %%xmm3  \n\t   /* unpack src high */
+punpckhbw  %%xmm0, %%xmm4  \n\t   /* unpack dst high */
+
+/*
+xmm5 (src_l)
+xmm6 (dst_l)
+
+00 U4 00 V4 00 U3 00 V3 00 U2 00 V2 00 U1 00 V1
+
+xmm3 (src_u)
+xmm4 (dst_u)
+
+00 U8 00 V8 00 U7 00 V7 00 U6 00 V6 00 U5 00 V5
+*/
+
+movdqa 

Re: [Mlt-devel] Adding text to a video

2012-02-14 Thread bettinger cédric
 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 d...@dennedy.org

 On Sun, Jan 29, 2012 at 10:30 AM, bettinger cédric bced...@gmail.com
 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.6\
 transform1,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=svn21r=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 

[Mlt-devel] [PATCH] save converted image for next use

2012-02-14 Thread Maksym Veremeyenko

Hi,

data for overlay image converted from RGBA to YUV422 for each frame. 
attached patch save converted image of *pixbuf* producer to avoid 
converting it to profile format each time it require to produce 
resulting frame.


with that patch and previous SSE2 patches it possible to put full hd 
logo on video without dropped frame.


it is draft version with leak on exit but it could answer the question 
if it is a right approach for solving problem with image converted to 
desired format once per frame instead of once per load/format_change.


--

Maksym Veremeyenko
From 94f0d6dbd3141ea1461e92b0055de3dddf686583 Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko ve...@m1stereo.tv
Date: Tue, 14 Feb 2012 18:20:29 +0200
Subject: [PATCH 1/2] implement mlt_frame_get_image_data and
 mlt_frame_get_alpha_data

---
 src/framework/mlt_frame.c |   10 ++
 src/framework/mlt_frame.h |2 ++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/src/framework/mlt_frame.c b/src/framework/mlt_frame.c
index 6125929..d08c5cb 100644
--- a/src/framework/mlt_frame.c
+++ b/src/framework/mlt_frame.c
@@ -310,6 +310,11 @@ int mlt_frame_set_image( mlt_frame self, uint8_t *image, int size, mlt_destructo
 	return mlt_properties_set_data( MLT_FRAME_PROPERTIES( self ), image, image, size, destroy, NULL );
 }
 
+void* mlt_frame_get_image_data( mlt_frame self, int *size )
+{
+	return mlt_properties_get_data( MLT_FRAME_PROPERTIES( self ), image, size );
+}
+
 /** Set a new alpha channel on the frame.
   *
   * \public \memberof mlt_frame_s
@@ -325,6 +330,11 @@ int mlt_frame_set_alpha( mlt_frame self, uint8_t *alpha, int size, mlt_destructo
 	return mlt_properties_set_data( MLT_FRAME_PROPERTIES( self ), alpha, alpha, size, destroy, NULL );
 }
 
+void* mlt_frame_get_alpha_data( mlt_frame self, int *size )
+{
+	return mlt_properties_get_data( MLT_FRAME_PROPERTIES( self ), alpha, size );
+}
+
 /** Replace image stack with the information provided.
  *
  * This might prove to be unreliable and restrictive - the idea is that a transition
diff --git a/src/framework/mlt_frame.h b/src/framework/mlt_frame.h
index 144d867..4eaf0ce 100644
--- a/src/framework/mlt_frame.h
+++ b/src/framework/mlt_frame.h
@@ -118,8 +118,10 @@ extern mlt_position mlt_frame_get_position( mlt_frame self );
 extern int mlt_frame_set_position( mlt_frame self, mlt_position value );
 extern int mlt_frame_set_image( mlt_frame self, uint8_t *image, int size, mlt_destructor destroy );
 extern int mlt_frame_set_alpha( mlt_frame self, uint8_t *alpha, int size, mlt_destructor destroy );
+extern void* mlt_frame_get_alpha_data( mlt_frame self, int *size );
 extern void mlt_frame_replace_image( mlt_frame self, uint8_t *image, mlt_image_format format, int width, int height );
 extern int mlt_frame_get_image( mlt_frame self, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable );
+extern void* mlt_frame_get_image_data( mlt_frame self, int *size );
 extern uint8_t *mlt_frame_get_alpha_mask( mlt_frame self );
 extern int mlt_frame_get_audio( mlt_frame self, void **buffer, mlt_audio_format *format, int *frequency, int *channels, int *samples );
 extern int mlt_frame_set_audio( mlt_frame self, void *buffer, mlt_audio_format, int size, mlt_destructor );
-- 
1.7.7.6

From 815d08b838e84afbbb4f74a08af394e2240c37b0 Mon Sep 17 00:00:00 2001
From: Maksym Veremeyenko ve...@m1stereo.tv
Date: Tue, 14 Feb 2012 18:47:11 +0200
Subject: [PATCH 2/2] save converted image for next use

---
 src/modules/gtk2/producer_pixbuf.c |   80 +++
 1 files changed, 70 insertions(+), 10 deletions(-)

diff --git a/src/modules/gtk2/producer_pixbuf.c b/src/modules/gtk2/producer_pixbuf.c
index b7da50b..f2acc28 100644
--- a/src/modules/gtk2/producer_pixbuf.c
+++ b/src/modules/gtk2/producer_pixbuf.c
@@ -59,6 +59,13 @@ struct producer_pixbuf_s
 	uint8_t *image;
 	mlt_cache_item image_cache;
 	pthread_mutex_t mutex;
+	struct
+	{
+		uint8_t *image;
+		uint8_t *alpha;
+		mlt_image_format format;
+		int size[2];
+	} clone;
 };
 
 static void load_filenames( producer_pixbuf self, mlt_properties producer_properties );
@@ -391,6 +398,11 @@ static void refresh_image( producer_pixbuf self, mlt_frame frame, int width, int
 		int dst_stride = self-width * ( self-alpha ? 4 : 3 );
 		int image_size = dst_stride * ( height + 1 );
 		self-image = mlt_pool_alloc( image_size );
+		if( self-clone.image )
+		{
+			mlt_pool_release( self-clone.image );
+			self-clone.image = NULL;
+		};
 
 		if ( src_stride != dst_stride )
 		{
@@ -454,7 +466,8 @@ static void refresh_image( producer_pixbuf self, mlt_frame frame, int width, int
 static int producer_get_image( mlt_frame frame, uint8_t **buffer, mlt_image_format *format, int *width, int *height, int writable )
 {
 	int error = 0;
-	
+	mlt_image_format format_origin;
+
 	// Obtain properties of frame
 	mlt_properties properties = MLT_FRAME_PROPERTIES( frame );
 
@@ -472,20 +485,67 @@ 

Re: [Mlt-devel] Adding text to a video

2012-02-14 Thread Dan Dennedy
On Tue, Feb 14, 2012 at 7:56 AM, bettinger cédric bced...@gmail.com 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 d...@dennedy.org

 On Sun, Jan 29, 2012 at 10:30 AM, bettinger cédric bced...@gmail.com
 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.6\
  transform1,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
  

Re: [Mlt-devel] Adding text to a video

2012-02-14 Thread bettinger cédric
 I would suggest looking at Brian's dynamictext filter, but
 it may take some additional effort to get the gdk/pango thing working

Right now I can't try this plugin since I installed mlt with the ubuntu
synaptic manager...and my version of mlt is 0.6.2. But may be I should try
to compile the last version...I am just afraid of messing up and having no
mlt version working. I think I will try to compile the last version of
mlt++ on a virtual ubuntu machine with virtual box.

 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.

I am not sure of what you are talking about ? Are you saying that I could
draw every frame of a producer with Qt ? or I could draw onto the qt widget
?

 FYI, distort=1 is a dangerous approach. It depends on how you generate
 the SVG, but the name distort is intentionally dangerous sounding.

I took that from open shot xml. I don't really know what it is, but without
that the movie doesn't have the right size I want.

 Change the 50 to 100.

Yeah I tried that as I tried 0 but either I only see my text with a black
background or I only see the movie.
If I remove geometry I only see the text with a black background while the
movie is playing. I don't understand that since the image has a transparent
background.




2012/2/14 Dan Dennedy d...@dennedy.org

 On Tue, Feb 14, 2012 at 7:56 AM, bettinger cédric bced...@gmail.com
 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 d...@dennedy.org
 
  On Sun, Jan 29, 2012 at 10:30 AM, bettinger cédric bced...@gmail.com
  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 

Re: [Mlt-devel] Adding text to a video

2012-02-14 Thread Carl Karsten
On Tue, Feb 14, 2012 at 5:30 PM, bettinger cédric bced...@gmail.com wrote:
 Right now I can't try this plugin since I installed mlt with the ubuntu
 synaptic manager...and my version of mlt is 0.6.2. But may be I should try
 to compile the last version...I am just afraid of messing up and having no
 mlt version working. I think I will try to compile the last version of mlt++
 on a virtual ubuntu machine with virtual box.

This script installs the ubuntu deps you need and  wget/runs a script
that checks out all the sources and builds.  Hmm, and I see some other
stuff.

https://github.com/CarlFK/veyepar/blob/master/setup/pxe/shaz/var/www/lc/mkmlt.sh

I am guessing you can figure it out.

-- 
Carl K

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel


Re: [Mlt-devel] Adding text to a video

2012-02-14 Thread Dan Dennedy
On Tue, Feb 14, 2012 at 3:30 PM, bettinger cédric bced...@gmail.com wrote:
 I would suggest looking at Brian's dynamictext filter, but
 it may take some additional effort to get the gdk/pango thing working

 Right now I can't try this plugin since I installed mlt with the ubuntu
 synaptic manager...and my version of mlt is 0.6.2. But may be I should try
 to compile the last version...I am just afraid of messing up and having no
 mlt version working. I think I will try to compile the last version of mlt++
 on a virtual ubuntu machine with virtual box.

 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.

 I am not sure of what you are talking about ? Are you saying that I could
 draw every frame of a producer with Qt ? or I could draw onto the qt widget
 ?

There is a new transition in mlt. It uses Qt to draw text on the
frames. Something similar could be done, but not right now. I guess
continue on your current route.

 FYI, distort=1 is a dangerous approach. It depends on how you generate
 the SVG, but the name distort is intentionally dangerous sounding.

 I took that from open shot xml. I don't really know what it is, but without
 that the movie doesn't have the right size I want.

 Change the 50 to 100.

 Yeah I tried that as I tried 0 but either I only see my text with a black
 background or I only see the movie.
 If I remove geometry I only see the text with a black background while the
 movie is playing. I don't understand that since the image has a transparent
 background.

No, then image does not have a transparent background, or if it really
does the image loader is not supporting it. Send the SVG you are
using.




 2012/2/14 Dan Dennedy d...@dennedy.org

 On Tue, Feb 14, 2012 at 7:56 AM, bettinger cédric bced...@gmail.com
 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 

Re: [Mlt-devel] [PATCH] use sse2 instruction for line compositing

2012-02-14 Thread Dan Dennedy
2012/2/14 Maksym Veremeyenko ve...@m1stereo.tv:
 10.02.12 07:41, Dan Dennedy написав(ла):

 2012/2/2 Maksym Veremeyenkove...@m1stereo.tv:

 Hi,

 attached patch perform line compositing for SSE2+ARCH_X86_64 build. It
 works
 for a case where luma is not defined...


 Hi Maksym, did some more testing and ran into a couple of image
 quality problems. First, alpha blending seems poor, mostly noticeable
 with a text with curvy typeface over video:

 melt clip1.dv -filter dynamictext:Hello size=200 outline=2
 olcolour=white family=elegante bgcolor=0x0020

 The first time you run that you will see that the alpha of bgcolour
 (black with 12.5% opacity) is not honored and the background is black.
 Set bgcolour=0 to make it completely transparent and look along curved
 edges to see the poor blending.

 The second problem is that key-framing opacity causes a repeating
 cycle of 100% A frame, A+B blended, and 100% B frame. The below
 reproduces it:

 melt color:red -track color:blue -transition composite out=99
 geometry=0=0/0:100%x100%:0; 99=0/0:100%x100%:100


 i wrongly assumed weight range in 0..255 - updated patch attached...

OK, very close! But there is still one problem I noticed. On some
geometry widths, the right edge of the B frame image is chopped off.
This is reproduced in demo/mlt_my_name_is. On the first title that
reads My name is Inigo Montoya notice how the right side of 'a' is
cropped.

-- 
+-DRD-+

--
Virtualization  Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
___
Mlt-devel mailing list
Mlt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mlt-devel