0

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.

Andy G
  • 19,232
  • 5
  • 47
  • 69
Kristians Kuhta
  • 53
  • 1
  • 4
  • 10

2 Answers2

2

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.

Havard Graff
  • 2,805
  • 1
  • 15
  • 16
  • A lot of stuff has changed in Gstreamer 1.0 specially in python api so you will needs a new more comprehensive link for this occasion :) https://wiki.ubuntu.com/Novacut/GStreamer1.0#Adding_PPA_for_Ubuntu_Precise . FYI: Novacut people are kickass check them out. – Shashank Singh Jan 08 '14 at 00:52
0

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()
Shashank Singh
  • 568
  • 7
  • 19