Apollo Marquis
Apollo Marquis

Reputation: 181

Gstreamer1.0 missing plugin: decodebin2 in Python code

The following Python code that adds three files to a GES timeline throws up the following error that others have also had:

(GError('Your GStreamer installation is missing a plug-in.',), 'gstdecodebin2.c(3928): gst_decode_bin_expose (): /GESPipeline:gespipeline0/GESTimeline:gestimeline0/GESVideoTrack:gesvideotrack0/GnlComposition:gnlcomposition1/GnlSource:gnlsource0/GstBin:videosrcbin/GstURIDecodeBin:uridecodebin0/GstDecodeBin:decodebin4:\nno suitable plugins found')

from gi.repository import GES
from gi.repository import GstPbutils
from gi.repository import Gtk
from gi.repository import Gst
from gi.repository import GObject
import sys
import signal

VIDEOPATH = "file:///path/to/my/video/folder/"

class Timeline:
    def __init__(self, files):
    print Gst._version # prints 1

    self.pipeline = GES.Pipeline()
    container_caps = Gst.Caps.new_empty_simple("video/quicktime")
    video_caps = Gst.Caps.new_empty_simple("video/x-h264")
    audio_caps = Gst.Caps.new_empty_simple("audio/mpeg")
    self.container_profile = GstPbutils.EncodingContainerProfile.new("jane_profile", "mp4 concatation", container_caps, None )#Gst.Caps("video/mp4", None))

    self.video_profile = GstPbutils.EncodingVideoProfile.new(video_caps, None, None, 0)
    self.audio_profile = GstPbutils.EncodingAudioProfile.new(audio_caps, None, None, 0)
    self.container_profile.add_profile(self.video_profile)
    self.container_profile.add_profile(self.audio_profile)

    self.bus = self.pipeline.get_bus()
    self.bus.add_signal_watch()
    self.bus.connect("message", self.busMessageCb)

    self.timeline = GES.Timeline.new_audio_video()
    self.layer = self.timeline.append_layer()
    signal.signal(signal.SIGINT, self.handle_sigint)
    self.start_on_timeline = 0

    for file in files:
        asset = GES.UriClipAsset.request_sync(VIDEOPATH + file)
        print asset.get_duration()
        duration = asset.get_duration()
        clip = self.layer.add_asset(asset, self.start_on_timeline, 0, duration, GES.TrackType.UNKNOWN)
        self.start_on_timeline += duration
        print 'start:' + str(self.start_on_timeline)

    self.timeline.commit()
    self.pipeline.set_timeline(self.timeline) 

def handle_sigint(self, sig, frame):
    Gtk.main_quit()

def busMessageCb(self, unused_bus, message):
    print message
    print message.type
    if message.type == Gst.MessageType.EOS:
        print "eos"
        Gtk.main_quit()
    elif message.type == Gst.MessageType.ERROR:
        error = message.parse_error()
        print (error)
        Gtk.main_quit()


if __name__=="__main__":
   GObject.threads_init()
   Gst.init(None)
   GES.init()
   gv = GES.version() # prints 1.2

   timeline = Timeline(['one.mp4', 'two.mp4', 'two.mp4'])
   done = timeline.pipeline.set_render_settings('file:///home/directory/output.mp4', timeline.container_profile)
   print 'done: {0}'.format(done)
   timeline.pipeline.set_mode(GES.PipelineFlags.RENDER)
   timeline.pipeline.set_state(Gst.State.PAUSED)
   Gtk.main()

I have set the GST_PLUGIN_PATH_1_0 environment variable to "/usr/local/lib:/usr/local/lib/gstreamer-1.0:/usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu/gstreamer-1.0"

I compiled and installed gstreamer1.0-1.2.4, together with the base, good, bad and ugly packages for that version. GES is installed with version 1.2.1 as this was the nearest to the gstreamer version I found. I also installed the libav-1.2.4.

The decodebin2 should be in base according to the make install log for plugin-base and is linked into libgstplayback, which is part of my GST_PLUGIN_PATH_1_0:

   /usr/local/lib/gstreamer-1.0 libgstplayback_la-gstdecodebin2.lo

I do have gstreamer0.10 and the decodebin2 is there as a blacklisted version when I do 'gst-inspect-1.0 -b' as it sits in the gstreamer0.10 library path rather than on that for 1.0.

I tried clearing the ~/.cache/gstreamer files and running gst-inspect-1.0 again to regenerate the plugin registry but I still keep getting the error in the Python code. This sample code might be wrong as it is my first stab at writing a timeline using Gstreamer editing services. I am on Ubuntu Trusty or 14.04.

The file is an mp4 file which is why I installed gst-libav for the required libraries. The output of MP4Box -info on the file is:

log @ pastebin.com/BjJ8Z5Bd for when I run 'GST_DEBUG=3,gnl*:5 python ./timeline1.py > timeline1.log 2>&1'

Upvotes: 1

Views: 1742

Answers (1)

Sebastian Dröge
Sebastian Dröge

Reputation: 2143

There is no "decodebin2" in GStreamer 1.x, which you're using here. It's just called "decodebin" now and is equivalent to "decodebin2" in 0.10.

Your problem here however is not that decodebin is not found. Your problem is that you're missing a plugin to play this specific media file. What kind of media file is it?

Upvotes: 1

Related Questions