I installed gstreamer , gst-plugins-bad and its python bindings.
The following code selects a song from the specified 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 a 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 two elements in soundtouch ( bpmdetect and pitch ) that cannot be created. Help?
source share