Record wav file from rtp stream

Sebastian Dröge sebastian at centricular.com
Tue Apr 22 04:38:50 PDT 2014


On Mo, 2014-04-21 at 06:57 -0700, Gstlili wrote:
> Hi, all !
> 
> I need to record audio from incoming udp stream, and convert it to wav
> format.
> 
> I have two problems:
> 
> First: 
> 
> The following pipeline record the played video without sound !!!
> 
> sender: 
> 
> gst-launch-0.10 -e -v filesrc location=/home/media/example.mp4 ! qtdemux !
> h264parse ! queue ! ffdec_h264 ! x264enc ! video/x-h264 ! rtph264pay pt=96 !
> udpsink host=127.0.0.1 port=1234 sync=false 
> 
> receiver: 
> 
> gst-launch-0.10 udpsrc port=1234
> caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"
> ! gstrtpjitterbuffer latency=100 ! rtph264depay ! mpegtsmux ! filesink
> location=/home/mtlili/audio_record.mp4

This does not have any sound at all because you only handle the video
part of the file here. Take a look at the examples in
gst-plugins-good/tests/examples/rtp to see how to use the RTP elements
properly and with multiple streams, but basically you a) should use the
rtpbin element, b) use sync=true on all RTP udpsinks, c) have multiple
branches in your pipeline (one for audio, one for video).

(Also on the receiver you use mpegtsmux but write to a file called .mp4.
MPEG TS is not the same as MP4).

> Second:
> I change the receiver pipeline to save a wav file format but i doesn't work 
> :
> 
> gst-launch-0.10 udpsrc port=1234
> caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264"
> ! gstrtpjitterbuffer latency=100 ! rtph264depay ! mpegtsmux ! audioconvert !
> wavenc ! filesink location=file.wav
> 
> I receive : WARNING: erroneous pipeline: could not link mpegtsmux0 to
> audioconvert0.

rtph264depay outputs an H264 video stream, mpegtsmux converts that to an
MPEG TS stream with H264 video... and audioconvert can only handle raw
audio. You'll have to stream the audio separately via RTP and use an
audio codec for that.


-- 
Sebastian Dröge, 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: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140422/d21d0d32/attachment-0001.sig>


More information about the gstreamer-devel mailing list