How to Overlay a video?!

1,432 views
Skip to first unread message

Heitor Meira

unread,
Nov 14, 2009, 6:44:21 PM11/14/09
to gstreamer-java
How to overlay a video with a text, like subtitles?!

Lucas Alberto

unread,
Nov 15, 2009, 9:33:11 PM11/15/09
to gstreamer-java

Hi,
Use the textoverlay element:
http://gstreamer.freedesktop.org/data/doc/gstreamer/0.10.1/gst-plugins-base-plugins/html/gst-plugins-base-plugins-textoverlay.html
The text string can be dinamicaly changed.

lucasa

Heitor Meira

unread,
Nov 21, 2009, 2:23:17 PM11/21/09
to gstreamer-java
Hi Lucas,
Sorry about the late.

I'm using Java. So, pango (Plugin that offers suport to text overlay)
is not disponible.

Do you have any other idea?

Heitor Meira

unread,
Nov 21, 2009, 2:23:59 PM11/21/09
to gstreamer-java
I have about the Pads... Somebodey knows if I can do it using Pads?!

Roberto Faga

unread,
Nov 21, 2009, 3:46:46 PM11/21/09
to gstream...@googlegroups.com
Hi heitor,

You'll need to use gobjects anyway, so a default windows install can't
run Java-gst until you install gstreamer, and gstreamer requires
gobject. To run my app in windows I install this package:

http://code.google.com/p/ossbuild/

Then I can run Gstreamer and textoverlay rightly. An example of how to
use textoverlay in a playbin2 (how I'm using in my test):

Element playbin = ElementFactory.make("playbin2", "playbin2");
playbin.set("uri", "file:///C:\\video.avi");
VideoComponent videoComponent = new VideoComponent();

Element videosink = videoComponent.getElement();
Element textoverlay = ElementFactory.make("textoverlay", "textoverlay");
Bin bin = new Bin("myBin");

bin.add(textoverlay);
Pad pad = textoverlay.getPad("video_sink");
GhostPad ghostpad = new GhostPad("sink", pad);
bin.addPad(ghostpad);
bin.add(videosink);

textoverlay.set("text", "Welcome to the Jungle!");
textoverlay.set("valign", "top");
textoverlay.set("halign", "right");
textoverlay.set("shaded-background", "yes");
textoverlay.set("font-desc", "Sans Bold 16");

Element.linkMany(textoverlay, videosink);

playbin.set("video-sink", bin);
playbin.setState(State.PLAYING);

but I think you could add this created bin as a videoSink in any other
class. I ran this code in windows and linux succesfully.

Roberto

On Sat, Nov 21, 2009 at 17:23, Heitor Meira <htrm...@gmail.com> wrote:
> I have about the Pads... Somebodey knows if I can do it using Pads?!
>
> --
>
> You received this message because you are subscribed to the Google Groups "gstreamer-java" group.
> To post to this group, send email to gstream...@googlegroups.com.
> To unsubscribe from this group, send email to gstreamer-jav...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/gstreamer-java?hl=.
>
>
>

Heitor Meira

unread,
Nov 22, 2009, 7:05:32 AM11/22/09
to gstream...@googlegroups.com
Hi Roberto, Thank you for the example...
It works perfectly here...

I was just using PlayBin, and I think that it's kind of high level part of the framework.

Roberto Faga

unread,
Nov 22, 2009, 8:09:13 AM11/22/09
to gstream...@googlegroups.com
I think this code will work with PlayBin too, just change the
video-sink to the custom bin. I'll try later with VideoPlayer (Swing
component) which is the most high level component in gst-java to play
videos.

Roberto
Reply all
Reply to author
Forward
0 new messages