Question

How do I need to link this gstreamer pipeline in python code? (Not by using gst.launch()! )

filesrc ! h264parse ! avimux ! filesink

When I try to create pad object -

h264parse.get_pad('src0') 

it returns NoneType. I am also attaching bufferprobe to this pad.

Was it helpful?

Solution

It is very straight forward, but rather than giving you the code, I suggest you go and read a bit on the topic, try this one: http://www.jonobacon.org/2006/08/28/getting-started-with-gstreamer-with-python/

The srcpadname for h264parse is 'src', not 'src0' and that is why it returns NoneType. 'src0' is usually only used when you have an element with request-pads (like the Tee) but this is not the case for h264parse.

Feel free to post a more complete code-attempt if you still can not make it work.

OTHER TIPS

A small snippet of code which works with Gstreamer 1.0 , python 2.7:

import sys, os
import gi
gi.require_version('Gst', '1.0')
from gi.repository import GObject, Gst, Gtk
GObject.threads_init()
Gst.init(None)
pipeline = Gst.Pipeline()
src = Gst.ElementFactory.make("filesrc", "src")
parse = Gst.ElementFactory.make("h264parse", "parse")
mux = Gst.ElementFactory.make("avimux", "mux")
sink = Gst.ElementFactory.make("fakesink","sink")

pipeline.add(src)
pipeline.add(parse)
pipeline.add(mux)
pipeline.add(sink)

pipeline.set_state(Gst.State.PLAYING)
Gtk.main()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top