4

I have installed gstreamer, gst-plugins-bad and its python bindings.

The following code selects a song from a given directory and plays it.

import pygst
pygst.require("0.10")
import gst
import pygtk
import gtk
import os

class Main:
    def __init__(self):
        self.pipeline = gst.Pipeline("mypipeline")

        self.musicFiles = os.listdir("musicFiles")

        self.currentSong = self.musicFiles[0]

        self.findFile = gst.element_factory_make("filesrc", "file")
        self.findFile.set_property("location", "musicFiles/" + self.currentSong)
        self.pipeline.add(self.findFile)

        self.mad = gst.element_factory_make("mad", "mad")
        self.pipeline.add(self.mad)

        self.findFile.link(self.mad)

        self.audioconvert = gst.element_factory_make("audioconvert", "convert")
        self.pipeline.add(self.audioconvert)

        self.mad.link(self.audioconvert)

        self.audioresample = gst.element_factory_make("audioresample", "resample")
        self.pipeline.add(self.audioresample)

        self.audioconvert.link(self.audioresample)

        self.getbpm = gst.element_factory_make("bpmdetect", "bpm")
        self.pipeline.add(self.getbpm)

        self.audioresample.link(self.getbpm)

        self.sink = gst.element_factory_make("playsink", "sink")
        self.pipeline.add(self.sink)

        self.audioresample.link(self.sink)

        self.pipeline.set_state(gst.STATE_PLAYING)

start=Main()
gtk.main()

However, when I try to create the bpmdetect element, it gives the following error:

Traceback (most recent call last):
  File "/Users/shubhitsingh/Desktop/Stuff/COLLEGE/US/Carnegie Mellon/Fall '12/15-112/Term Project/Practice/gstreamertutorial-1.py", line 49, in <module>
    start=Main()
  File "/Users/shubhitsingh/Desktop/Stuff/COLLEGE/US/Carnegie Mellon/Fall '12/15-112/Term Project/Practice/gstreamertutorial-1.py", line 37, in __init__
    self.getbpm = gst.element_factory_make("bpmdetect", "bpm")
ElementNotFoundError: bpmdetect

Other elements from gst-plugins-bad can be created without problems. Its just the two elements under soundtouch (bpmdetect and pitch) that cannot be created. Help?

  • Can't help with the bpm error, but there is a linkage error in your code, the 2nd to last line in the function is calling the wrong element to link. – levesque Dec 18 '12 at 01:21
  • **1)** Try to run it with env.variable `GST_DEBUG=3` or higher (upto 7 may be reasonable) and you may see where exactly it fails. **2)** make sure the `bpmdetect` element really is installed (your version of `gst-plugins-bad` may be older than the current one and therefore you possibly don't have those elements) by running: `gst-inspect bpmdetect` – Jan Spurny Jul 10 '13 at 08:56

0 Answers0