two issues when recording sound
Sebastian Dröge
sebastian at centricular.com
Mon Dec 2 00:05:46 PST 2013
On So, 2013-12-01 at 19:33 +0100, Pablo Rodriguez wrote:
> Hi there,
>
> first of all, congratulations for your excellent work on Gstreamer and
> many thanks for releasing it under a free license.
>
> I have a small script that records sound from microphone to a .wav file.
> it is written in Python. You can find it at
> https://github.com/ousia/iRaccoonShow/blob/master/recslides.py, but the
> relevant part is:
>
> self.player = gst.Pipeline("player")
> #~ self.clock = self.player.get_clock()
>
> self.source = gst.element_factory_make("alsasrc", "alsa-source")
> #~ self.caps = gst.Caps("audio/x-raw-int,rate=16000,channels=1")
>
> self.encoder = gst.element_factory_make("wavenc", "wavenc")
>
> self.fileout = gst.element_factory_make("filesink", "sink")
> self.fileout.set_property("location", self.audiofilename )
>
> self.player.add(self.source, self.encoder, self.fileout)
> gst.element_link_many(self.source, self.encoder, self.fileout)
>
> Before I forget, I use Fedora 19, which comes with gstreamer-0.10.36.
>
> When I start the script, I always get the following error:
>
> ** Message: pygobject_register_sinkfunc is deprecated (GstObject)
>
> How could I fix this?
You can't, but that's not a problem. It just warns you that
gstreamer-python uses old pygobject API.
If you use a 1.x version of gstreamer-python you won't see this anymore,
and also should really consider updating to that because 0.10.x is
unmaintained and unsupported since quite some time.
> The other issue is the only commented line in the code snippet above. I
> would like to have the sound recorded with a lower frame rate and only
> one channel (otherwise, output files are huge).
>
> How should I integrate the self.caps line, so that I have an output
> files with these features?
You'll create a capsfilter element and link it between alsasrc and
wavenc. capsfilter has the "caps" property, on which you can set the
caps you create there in the commented out line.
--
Sebastian Dröge <sebastian at centricular.com>
Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 966 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20131202/f59e35dd/attachment.pgp>
More information about the gstreamer-devel
mailing list