How to do video transitions with gnonlin?

Rory McCann rory at technomancy.org
Wed Jul 27 14:29:37 PDT 2011


Hi all,

I've been trying to combine 2 videos together with gstreamer with a
short transition (like smpte) between them. Since I can't get it working
with ges-launch, I'm trying to do raw gnonlin stuff in python.

I want to make a video programme/script that takes a list of short
videos, and combines them all into one big long video with ~2sec video
transition between them. Now I'm trying to get a video transition
working with 2 files.

Below is my attempt. I want it to play the first 4 sec of one file, and
at 2 sec to start doing a smpte transition (that lasts for 2 seconds) to
another file. (so the second file will start playing 2 seconds into the
whole thing), and after the transition play 2 sec of the 2nd file on
it's own.

It only plays 2 sec of the first file and then freezes, doing nothing
for ages until i manually kill it.

If I don't add the operation to the gnlcomposition (i.e. I comment out
the line "comp.add(op)"), then it works. It plays 2 sec of first file,
then a few seconds of the second, then stops and the programme exits
normally.

I get no output on the command line (until I have to close the window),
I get no output if I run it with GST_DEBUG=1 or GST_DEBUG=2. (with
GST_DEBUG=3 I get about 1300 lines of output, do you want that?)

Is there anything I'm doing wrong? I'm quite new to gstreamer.

Thanks for your help,

Rory McCann.

The files can be downloaded from:
http://www.technomancy.org/download/vshort01.mov
http://www.technomancy.org/download/vshort02.mov

===== BEGIN SCRIPT ====
#! /usr/bin/python
import gst, gobject
gobject.threads_init()

comp  = gst.element_factory_make("gnlcomposition", "composition")

gsrc1 = gst.element_factory_make("gnlfilesource")
gsrc1.props.location = "file:///home/rory/helmetcam/dingle-tom/vshort01.mov"
gsrc1.props.start          = 0
gsrc1.props.duration       = 4 * gst.SECOND
gsrc1.props.media_start    = 0
gsrc1.props.media_duration = 4 * gst.SECOND
gsrc1.props.priority       = 4
comp.add(gsrc1)


gsrc2 = gst.element_factory_make("gnlfilesource")
gsrc2.props.location = "file:///home/rory/helmetcam/dingle-tom/vshort02.mov"
gsrc2.props.start          = 2 * gst.SECOND
gsrc2.props.duration       = 6 * gst.SECOND
gsrc2.props.media_start    = 0
gsrc2.props.media_duration = 2 * gst.SECOND
gsrc2.props.priority       = 2
comp.add(gsrc2)

wipe = gst.element_factory_make("smpte")
wipe.props.type = 234
wipe.props.duration = 2 * gst.SECOND
op = gst.element_factory_make("gnloperation")
op.add(wipe)
op.props.start          = 2 * gst.SECOND
op.props.duration       = 2 * gst.SECOND
op.props.media_start    = 0
op.props.media_duration = 2 * gst.SECOND
op.props.priority       = 1
comp.add(op)

# create the backend
color= gst.element_factory_make("ffmpegcolorspace")
sink = gst.element_factory_make("autovideosink")
pipeline = gst.Pipeline()
pipeline.add(comp, color, sink)
color.link(sink)

def on_pad(comp, pad, elements):
    print "pad added"
    convpad = elements.get_compatible_pad(pad, pad.get_caps())
    pad.link(convpad)
comp.connect("pad-added", on_pad, color)

# now run the pipeline
loop = gobject.MainLoop(is_running=True)
bus = pipeline.get_bus()
bus.add_signal_watch()
def on_message(bus, message, loop):
    if message.type == gst.MESSAGE_EOS:
        loop.quit()
    elif message.type == gst.MESSAGE_ERROR:
        print message
        loop.quit()
bus.connect("message", on_message, loop)
pipeline.set_state(gst.STATE_PLAYING)
loop.run()
pipeline.set_state(gst.STATE_NULL)


==== END SCRIPT =====
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0x5373FB61.asc
Type: application/pgp-keys
Size: 3157 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110727/a31d87a2/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 262 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110727/a31d87a2/attachment.pgp>


More information about the gstreamer-devel mailing list