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()