c++ - gstreamer choose one channel and convert to mono (deinterleave) -


i'm creating audio stream audio server , streaming receiver , receiver choose 1 channel , convert mono.

the code below pipeline of receiver. receiving rtp stream.

gst-launch-0.10 -v \ udpsrc multicast-group=224.0.0.7 port=5000 \ ! "application/x-rtp,media=audio, clock-rate=44100, width=16, height=16, encoding-name=l16, encoding-params=2, payload=96" \ ! gstrtpjitterbuffer latency=200 ! rtpl16depay ! audioconvert ! deinterleave name=d    interleave name=i ! alsasink \ d.src_0 ! queue ! audioconvert !"audio/x-raw-int,channels=1"! i.sink1 \ d.src_0 ! queue ! audioconvert !"audio/x-raw-int,channels=1"! i.sink0  

it run listening nothing when stream comes through, throws error.

error: element /gstpipeline:pipeline0/gstudpsrc:udpsrc0: internal data flow error. 

you can't connect d.src_0 twice.

instead, can ditch interleave part , concentrate on playing mono stream (i hope it's ok replaced udpsrc uribin, pipeline easier read way):

gst-launch-0.10 -v uridecodebin uri=file://file.ogg ! audioconvert ! \   deinterleave name=d  d.src0 ! queue ! audioconvert ! alsasink 

this will, pipeline, deinterleave stereo stream , take left channel (d.src0, use d.src1 other one) provides mono stream , feed alsasink.

alsa doesn't mind whether feed mono or stereo data it, if explicitly wanted stereo stream/file? add audiopanorama. takes audio stream , places somewhere between left , right speaker (the panorama parameter defaults 0 center) , produces stereo stream:

gst-launch-0.10 -v uridecodebin uri=file://file.mp3 ! audioconvert ! \   deinterleave name=d d.src0 ! queue ! audioconvert ! audiopanorama ! alsasink 

but said, alsa (and other sound servers pulse, osd, ...) doesn't care whether feed mono or stereo it, it's gonna play on both channels.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -