List Info

Thread: Simple TS to MKV converter




Simple TS to MKV converter
country flaguser name
Germany
2007-02-06 09:08:03
Hi,

I'm trying to understand gstreamer and so I tried to write a
small
python script that reads from a file, demuxes the transport
stream (it
is a dvb recording) and saves the file as matroska file.

But, it does not work. I have no idea why, but the dest file
is not
written. Maybe I'm making a fundamental design error. I read
about
queues and set_active calls on the mailing list, but I have
no idea
where to add this calls.


import sys

import pygst
pygst.require('0.10')
import gst
import gobject

def new_pad(demuxer, pad):
    pad.link(matroska.get_compatible_pad(pad))

def bus_event(bus, message):
    t = message.type
    if t == gst.MESSAGE_EOS:
        sys.exit(0)
    elif t == gst.MESSAGE_ERROR:
        err, debug = message.parse_error()
        print "Error: %s" % err, debug
        sys.exit(0)
    print message
    return True

pipeline = gst.Pipeline()
pipeline.get_bus().add_watch(bus_event)

source = gst.element_factory_make("filesrc")
source.set_property('location', '/home/dmeyer/zdf.ts')
mpegts = gst.element_factory_make('ffdemux_mpegts')

mpegts.connect("pad-added", new_pad)

matroska =
gst.element_factory_make("matroskamux")
sink = gst.element_factory_make("filesink")
sink.set_property('location', '/home/dmeyer/zdf.mkv')

pipeline.add(source, mpegts, matroska, sink)

source.link(mpegts)
matroska.link(sink)

pipeline.set_state(gst.STATE_PLAYING)

gobject.MainLoop().run()



Regards,


Dischi

-- 
A tree never hits an automobile except in self-defence.

------------------------------------------------------------
-------------
Using Tomcat but need to do more? Need to support web
services, security?
Get stuff done quickly with pre-integrated technology to
make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on
Apache Geronimo
http://sel.as-us.falkag.net/
sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
gstreamer-devel mailing list
gstreamer-devellists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gstream
er-devel

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )