I am new to gstreamer and trying to use it for some GPU accelerated video decoding on my NVIDIA Jetson ARM based board. I found some python code online which creates a gstreamer pipeline and I was trying to use it to familiarize myself. The code that creates the pipeline is as follows:
def new_pipeline(self, mediauri):
pipeline = Gst.Pipeline()
if (not pipeline):
print ('Failed to create pipeline')
exit (-1)
# Create bus to get events from GStreamer pipeline
bus = pipeline.get_bus()
self.bus.append(bus)
bus.add_signal_watch()
bus.connect('message::error', self.on_error)
# This is needed to make the video output in our DrawingArea:
bus.enable_sync_message_emission()
bus.connect('sync-message::element', self.on_sync_message)
# Create GStreamer elements
decodebin = Gst.ElementFactory.make('uridecodebin', 'decodebin')
videosink = Gst.ElementFactory.make('nveglglessink', 'videosink')
if (not decodebin or not videosink):
print ('Failed to create uridecodebin and/or nveglglessink')
exit(-1)
# Set properties
decodebin.set_property('uri', mediauri)
videosink.set_property('create-window', False)
# Add elements to the pipeline
pipeline.add(decodebin)
pipeline.add(videosink)
decodebin.connect("pad-added", self.decodebin_pad_added)
return pipeline
The full project can be found here (https://github.com/kulve/gst-multiwindow)
Now, whenever I try to create a pipeline from a local file I get the error:
on_error(): (GError('Invalid URI "testfile.avi".',), 'gsturidecodebin.c(1373): gen_source_element (): /GstPipeline:pipeline0/GstURIDecodeBin:decodebin')
I have a feeling this error is because a local file is not a valid uri. I tried passing it as file://testfile.avi
but that did not work either returning could not open resource for reading
error.
Is there a change in this code that may help me play local video files?