[gst-devel] Using gnonlin to shift stream times of videos

David Liu davel at itee.uq.edu.au
Thu Oct 14 04:16:02 CEST 2010


Hi,

I'm trying to use gnonlin to timeshift media playback within a pipeline. For
example, instead of playing a 60 sec video clip normally, I want the output to be
black for 10 sec, play the 60 sec clip, and then play another 10 sec black screen - 
for a new stream duration of 80 sec. In short, I want to shift the video's stream 
time range from 0->60 sec to 10->70 sec.

In the Java example below (using gstreamer-java), I've added two gnlsource bins 
to a gnlcomposition and set the start/duration properties accordingly. 

The first videotestsrc will play as expected for 2 secs, but then the pipeline just 
stops. I would have expected it to switch over to the second videotestsrc for 1 sec 
and then switch back to the original videotestsrc for the final 2 secs. 

If the second gnlsource is removed from the code, the test source plays fine for 
the full 5 secs.

Does anyone know what I'm doing wrong? Thanks!


Cheers,

- Dave L


Pipeline pipe = new Pipeline("pipeline0");

final Bin composition = NativeObject.objectFor(
    ElementFactory.make("gnlcomposition", null).getNativeAddress(), Bin.class);
pipe.add(composition);

Bin source1 = Bin.objectFor(ElementFactory.make("gnlsource", null)
    .getNativeAddress(), Bin.class);
source1.set("start", 0);
source1.set("duration", 5000000000L);
source1.set("media-start", 0);
source1.set("media-duration", 5000000000L);
source1.set("priority", 1);
final Element videotestsrc1 = ElementFactory.make("videotestsrc", null);
videotestsrc1.set("pattern", 0);
source1.add(videotestsrc1);
composition.add(source1);

Bin source2 = Bin.objectFor(ElementFactory.make("gnlsource", null)
    .getNativeAddress(), Bin.class);
source2.set("start", 2000000000L);
source2.set("duration", 1000000000L);
source2.set("media-start", 0);
source2.set("media-duration", 1 * 1000000000L);
source2.set("priority", 0);
final Element videotestsrc2 = ElementFactory.make("videotestsrc", null);
videotestsrc2.set("pattern", 1);
source2.add(videotestsrc2);
composition.add(source2);

final Bin videobin = Bin.launch("identity single-segment=true ! " + 
    "ffmpegcolorspace ! ximagesink", true);
pipe.add(videobin);

composition.connect(new Element.PAD_ADDED() {
	public void padAdded(Element element, Pad pad) {
		PadLinkReturn res = pad.link(videobin.getStaticPad("sink"));
	}
});

pipe.setState(State.PLAYING);
Gst.main();







More information about the gstreamer-devel mailing list