Pure alpha Video + Text
Angel Martin
amartin at vicomtech.org
Fri Apr 29 03:48:55 PDT 2011
Dear all,
I want to mix (videomixer) a multimedia source (video or image) with a text
(textoverlay) with gnlcomposition to insert the text in the proper time.
1) At the beginning I used a gnloperation to insert the textoverlay inside a
bin with a textoverlay. But problems arised when I had a lot of images and
texts. It was not possible to get a desired layout. Because to get a correct
functionality the priority has to be low and unique (according to my tests).
2) So, I am trying to insert each text as a video with an alpha channel.
I achieved it with a gnlsource with a bin that contains a videotestsrc with
green pattern and an alpha element to remove the green part with an alpha
channel but in some borders of the image there is a residual line.
videotestsrc pattern=5 ! ffmpegcolorspace ! textoverlay text="HELLOWORLD" !
*alpha prefer-passthrough=TRUE method=1* ! video/x-raw-yuv,
framerate=\(fraction\)25/1, format=\(fourcc\)AYUV, width=640, height=480 !
ffmpegcolorspace
And for example in this case: textoverlay text="HELLOWORLD" color=4278255360
(0xff00ff00) The text is also "alphaed". So not completely solved yet.
Moreover, the alpha module inserts a residual line and computational waste.
3) So I want a pure alpha video with a text to mix it with an image.
This is a test pipeline where the videotestsrc has directly a 0x00000000
(ARGB value = pure alpha black = transparent) with a text overlay with color
0xff00ff00 (ARGB value = solid green).
gst-launch videomixer name=mix sink_0::zorder=3 sink_1::zorder=2 !
ffmpegcolorspace ! timeoverlay ! autovideosink videotestsrc pattern=17
foreground-color=0 ! textoverlay text="HELLOWORLD" color=4278255360
shaded-background=TRUE ! video/x-raw-yuv, framerate=\(fraction\)25/1,
format=\(fourcc\)AYUV, width=640, height=480 ! ffmpegcolorspace ! mix.sink_0
filesrc location=~/image.jpg ! decodebin ! queue ! ffmpegcolorspace !
videoscale ! imagefreeze2 ! alpha prefer-passthrough=TRUE ! video/x-raw-yuv,
framerate=\(fraction\)25/1, format=\(fourcc\)AYUV, width=640, height=480 !
ffmpegcolorspace ! mix.sink_1
However the textoverlay plugin doesn't overwrite its alpha value and the
text doesn't appear anyplace. It seems the text inherits the alpha value of
the videotestsrc.
If a change the videotestsrc to get semitransparent color=2147483648
(0x80000000) (ARGB semitransparent black) the text appears but again It
seems the text inherits the alpha value of the videotestsrc.
gst-launch videomixer name=mix sink_0::zorder=3 sink_1::zorder=2 !
ffmpegcolorspace ! timeoverlay ! autovideosink videotestsrc pattern=17
foreground-color=2147483648 ! textoverlay text="HELLOWORLD" color=4278255360
shaded-background=TRUE ! video/x-raw-yuv, framerate=\(fraction\)25/1,
format=\(fourcc\)AYUV, width=640, height=480 ! ffmpegcolorspace ! mix.sink_0
filesrc location=~/image.jpg ! decodebin ! queue ! ffmpegcolorspace !
videoscale ! imagefreeze2 ! alpha prefer-passthrough=TRUE ! video/x-raw-yuv,
framerate=\(fraction\)25/1, format=\(fourcc\)AYUV, width=640, height=480 !
ffmpegcolorspace ! mix.sink_1
I tryed to insert alphacolor elements and introduce different schemes of
ffmpegcolorspaces and capsfilter, and I also checked that the zorder of the
videomixer is right, but I haven't achieved the expected result.
Any ideas?
Thank you in advance.
Best Regards.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110429/366d8e41/attachment.htm>
More information about the gstreamer-devel
mailing list