[gst-devel] gstreamer-python and playbin
Christian Fredrik Kalager Schaller
uraeus at linuxrising.org
Mon Aug 3 15:46:28 CEST 2009
Hi,
playbin (or uridecodebin) will automatically decode the incoming stream
unless you specifically tells it not to. uridecodebin and playbin2 got a
property called 'caps' which you can use to tell it to stop autopluggin
on certain caps. If you create a list of possible container formats caps
there, it will not try to demux and decode and you can save it directly
to disk.
Here is an example that should work (haven't tested though):
self.remuxcaps = gst.Caps()
self.remuxcaps.append_structure(gst.Structure("video/quicktime"))
self.remuxcaps.append_structure(gst.Structure("video/x-ms-asf"))
self.uridecoder.set_property("caps", self.remuxcaps)
Hope this helps,
Christian
On Sat, 2009-08-01 at 20:40 -0400, Charles Ulrich wrote:
> Hi,
>
> I freely admit to still having much to learn about gstreamer (and its
> python bindings), but I was wondering if someone can give me any advice
> on a simple prototype script I'm working on.
>
> Basically, I'm trying to write a script in Python using gsteamer. The
> goal of this script is to capture the data from a uri source and save it
> to a file on disk. Because I want to be able to support many types of
> sources automatically (file, http, mms, rstp), I thought the playbin
> would be the best and simplest way to go. But I'm having a hard time
> plugging the filesrc plugin into it.
>
> #!/usr/bin/python
>
> import pygst
> pygst.require("0.10")
> import gst
> import gobject
>
> srcuri='http://r1.scenesat.com:8000/scenesat'
> #srcuri='mms://71.127.77.19/wadml'
> #srcuri='rtsp://archmp3.wfmu.org/broadcast/wfmu_live.rm'
>
> class Main:
> def __init__(self):
> # Create a pipline object
> self.pipeline = gst.Pipeline("mypipeline")
>
> # Create the playbin object
> self.streambin = gst.element_factory_make("playbin", "stream")
>
> # Set the uri property so playbin knows where to fetch from
> self.streambin.set_property('uri', srcuri)
>
> # Add our playbin to the pipeline
> self.pipeline.add(self.streambin)
>
> # Create filesink, set location, and configure filesink as playbin
> # audio sink
> self.audiosink = gst.element_factory_make('filesink', 'audiosink')
> self.audiosink.set_property('location', 'foo.dump')
> self.streambin.set_property('audio-sink', self.audiosink)
>
> # Create fakesink for playbin video sink
> self.videosink = gst.element_factory_make('fakesink', 'videosink')
> self.streambin.set_property('video-sink', self.videosink)
>
> # Set the pipeline state to playing
> self.pipeline.set_state(gst.STATE_PLAYING)
>
> start=Main()
>
> mainloop = gobject.MainLoop()
> mainloop.run()
>
> Basically, what happens is that gstreamer appears to be correctly
> fetching the stream and saving _something_ to disk, but what's saved
> does not appear to be either audio or video. Mplayer won't play the file
> but identifies it as DVSD (video) and ffdv (audio). I thought that
> specifying fakesink for the video sink would make a difference, but it
> does not.
>
> What I'd like to do is construct is a pipeline that can (ideally) detect
> the media given to it via some uri and save that media as it is
> streamed, without any audio conversion or encoding. Any tips on how I
> can accomplish that?
>
> Charles
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
More information about the gstreamer-devel
mailing list