[gst-devel] How to decrease CPU consumation for audio recording?

Jan Schmidt thaytan at noraisin.net
Sun Dec 20 13:50:00 CET 2009


On Thu, 2009-12-17 at 08:51 +0800, Zhao, Halley wrote:
> Finally, I found out pulseaudio play a lot in the audio pipeline, if I access alsasrc, hw:0 directly, it could make %cpu half.

Pulseaudio will always open the audio device in a fixed sample rate and
then resample internally, using a high-quality resampling algorithm by
default. What you're seeing is probably the overhead of performing a
high-quality resample from 44100 Hz to 8000 Hz.

> Then I tried flac instead of vorbis, %CPU is decreased another half.

Not surprising - Vorbis achieves higher compression partly by being a
more complicated compression algorithm.

J.

> 
> -----Original Message-----
> From: Zhao, Halley [mailto:halley.zhao at intel.com] 
> Sent: 2009年12月15日 9:36
> To: 'Stefan Kost'; 'Discussion of the development of GStreamer'
> Subject: Re: [gst-devel] How to decrease CPU consumation for audio recording?
> 
> Thanks for your suggestion.
> But further information shows vorbisenc doesn't matter much in the pipeline.
> Either fakesink or vorbisenc will consume 50+% CPU, but arecord only 4% CPU.
> I will use C programming to identify it is not caused by gst-launch.
> Maybe buffer size matter here.
> 
> 
> 
> === audio only + fakesink
> gst-launch alsasrc ! audio/x-raw-int, rate=8000 ! queue ! fakesink
> gst-launch 51%CPU, pulseaudio 13%CPU
> 
> === save audio to ogg/vorbis
> gst-launch alsasrc ! audio/x-raw-int, rate=8000, width=16, depth=16, channel=1 ! queue ! audioconvert ! vorbisenc ! oggmux ! filesink location=test-audio.ogg
> gst-launch 57%CPU, pulseaudio 13%CPU
> 
> === arecord and drop data 
> arecord >/dev/null
> Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
> arecord 4.3%, pulseaudio 2.2%
> 
> === arecord save to file
> arecord >test.wav
> Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
> arecord 4.4%, pulseaudio 2.3%
> 
> -----Original Message-----
> From: Stefan Kost [mailto:ensonic at hora-obscura.de] 
> Sent: 2009年12月15日 6:05
> To: Discussion of the development of GStreamer
> Cc: Zhao, Halley
> Subject: Re: [gst-devel] How to decrease CPU consumation for audio recording?
> 
> Am 14.12.2009 08:53, schrieb Zhao, Halley:
> > I have a simple audio recording pipeline as below. To my surprise it
> > consumes CPU as high as a 640x480 video recording. Could it be optimized
> > to use CPU less?
> > 
> > gst-launch alsasrc ! audio/x-raw-int, rate=8000, width=16, depth=16,
> > channel=1 ! queue ! audioconvert ! vorbisenc ! oggmux ! filesink
> > location=test-audio.ogg
> 
> 1.) optimize vorbis
> 2.) add orc opimizations to audioconvert (vorbis-enc wants float input)
> 3.) we need some optimizations for such pipleines so that audioencoder and
> audiosrc can negotiate a (max-)buffer size. the encoder would then provide
> pad_alloc (resuable buffers). this needs same work on audioconvert too
> 
> Stefan
> 
> > 
> >  
> > 
> > on a netbook with ATOM 1.6GHZ, ~90 %CPU.
> > 
> >  
> > 
> > Thanks in advance.
> > 
> >  
> > 
> >  
> > 
> > *ZHAO, Halley (Aihua)*
> > 
> > Email: halley.zhao at intel.com <BLOCKED::mailto:aihua.zhao at intel.com>
> > 
> > Tel: +86(21)61166476
> > 
> > iNet: 8821-6476
> > 
> > SSG/OTC/Moblin 3W038 Pole: F4
> > 
> >  
> > 
> > 
> > 
> > ------------------------------------------------------------------------------
> > Return on Information:
> > Google Enterprise Search pays you back
> > Get the facts.
> > http://p.sf.net/sfu/google-dev2dev
> > 
> > 
> > 
> > _______________________________________________
> > gstreamer-devel mailing list
> > gstreamer-devel at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> 
> ------------------------------------------------------------------------------
> Return on Information:
> Google Enterprise Search pays you back
> Get the facts.
> http://p.sf.net/sfu/google-dev2dev
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


-- 
Jan Schmidt <thaytan at noraisin.net>





More information about the gstreamer-devel mailing list