Using GStreamer to Convert WAV -> RTP Results in Low-Quality RTP Stream

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Using GStreamer to Convert WAV -> RTP Results in Low-Quality RTP Stream

Josh Dickson
Hi,

I am sorry in advance if this is not the correct place to ask a question…

I am trying to convert a high-quality WAV file to RTP stream. I am successfully streaming with:

gst-launch-1.0 -m filesrc location=myfile.wav ! wavparse ! audioconvert ! audioresample ! alawenc ! rtppcmapay ! udpsink host=127.0.0.1 port=12000

I can then check the RTP stream from ffmpeg, which shows that is is 64 kb/s, pct_alaw, 8000 Hz, 1 channel, s16.

My WAV file is much higher quality than this (it is a sample of music at CD quality). I thought that the problem was with audioresample, but I have tried a number of changes and I cannot get any of them to stream correctly. Ideally the stream should be as high-quality as the WAV it’s generated from.

I would greatly appreciate a pointer on how I might be able to do this. Thank you!

Josh






_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using GStreamer to Convert WAV -> RTP Results in Low-Quality RTP Stream

Jan Schmidt-6

Hi,


On 12/05/17 14:43, Josh Dickson wrote:
Hi,

I am sorry in advance if this is not the correct place to ask a question…

I am trying to convert a high-quality WAV file to RTP stream. I am successfully streaming with:

gst-launch-1.0 -m filesrc location=myfile.wav ! wavparse ! audioconvert ! audioresample ! alawenc ! rtppcmapay ! udpsink host=127.0.0.1 port=12000

alaw is 8-bit @ 8khz and will generally sound awful for anything except speech. Try rtpL16pay for 16-bit CD quality audio.

Cheers,
Jan.


I can then check the RTP stream from ffmpeg, which shows that is is 64 kb/s, pct_alaw, 8000 Hz, 1 channel, s16.

My WAV file is much higher quality than this (it is a sample of music at CD quality). I thought that the problem was with audioresample, but I have tried a number of changes and I cannot get any of them to stream correctly. Ideally the stream should be as high-quality as the WAV it’s generated from.

I would greatly appreciate a pointer on how I might be able to do this. Thank you!

Josh







_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using GStreamer to Convert WAV -> RTP Results in Low-Quality RTP Stream

Josh Dickson
Hi Jan,

Thank you, that is definitely what I need. I have gotten that pipeline working successfully, but now when I play it (via ffplay), it sounds comically slow/distorted.

I am now using the pipeline:

gst-launch-1.0 -m filesrc location=myfile.wav ! wavparse ! audioconvert ! rtpL16pay ! udpsink host=127.0.0.1 port=12008

I used the -v option to produce what I thought was a correct SDP file:

v=0
o=root IN IP4 127.0.0.1
c=IN IP4 127.0.0.1
s=My Name
m=audio 12008 RTP/AVP 96
a=rtpmap:96 L16/44100
a=fmtp:96 media=audio; clock-rate=44100; encoding-name=L16; channels=2;

I am playing the sound with:

ffplay -i stream.sdp -protocol_whitelist file,udp,rtp

Ffplay does open, and the sound resembles the original song, but it is very slowed down/distorted. 

Ffplay sees:

bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16be, 44100 Hz, 1 channels, s16, 705 kb/s

(not sure if that will help)

I have been trying to research what is wrong here but I am not sure what part of this I’ve messed up. Any help would be much appreciated. Thank you!

Josh



On Fri, May 12, 2017 at 01:39 Jan Schmidt <">Jan Schmidt > wrote:

Hi,


On 12/05/17 14:43, Josh Dickson wrote:
Hi,

I am sorry in advance if this is not the correct place to ask a question…

I am trying to convert a high-quality WAV file to RTP stream. I am successfully streaming with:

gst-launch-1.0 -m filesrc location=myfile.wav ! wavparse ! audioconvert ! audioresample ! alawenc ! rtppcmapay ! udpsink host=127.0.0.1 port=12000

alaw is 8-bit @ 8khz and will generally sound awful for anything except speech. Try rtpL16pay for 16-bit CD quality audio.

Cheers,
Jan.


I can then check the RTP stream from ffmpeg, which shows that is is 64 kb/s, pct_alaw, 8000 Hz, 1 channel, s16.

My WAV file is much higher quality than this (it is a sample of music at CD quality). I thought that the problem was with audioresample, but I have tried a number of changes and I cannot get any of them to stream correctly. Ideally the stream should be as high-quality as the WAV it’s generated from.

I would greatly appreciate a pointer on how I might be able to do this. Thank you!

Josh







_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using GStreamer to Convert WAV -> RTP Results in Low-Quality RTP Stream

Ian Davidson
I see that you are creating a stereo output (channels=2), but it is
being played as a mono (channels=1), so each sample from the original is
being treated as 2 samples.  This means that it will take twice as long
to play as it did to record.

I don't know why.

Ian


On 12/05/2017 18:50, Josh Dickson wrote:

> Hi Jan,
>
> Thank you, that is definitely what I need. I have gotten that pipeline
> working successfully, but now when I play it (via ffplay), it sounds
> comically slow/distorted.
>
> I am now using the pipeline:
>
> gst-launch-1.0 -m filesrc location=myfile.wav ! wavparse !
> audioconvert ! rtpL16pay ! udpsink host=127.0.0.1 port=12008
>
> I used the -v option to produce what I thought was a correct SDP file:
>
> v=0
> o=root IN IP4 127.0.0.1
> c=IN IP4 127.0.0.1
> s=My Name
> m=audio 12008 RTP/AVP 96
> a=rtpmap:96 L16/44100
> a=fmtp:96 media=audio; clock-rate=44100; encoding-name=L16; channels=2;
>
> I am playing the sound with:
>
> ffplay -i stream.sdp -protocol_whitelist file,udp,rtp
>
> Ffplay does open, and the sound resembles the original song, but it is
> very slowed down/distorted.
>
> Ffplay sees:
>
> bitrate: 705 kb/s
>     Stream #0:0: Audio: pcm_s16be, 44100 Hz, 1 channels, s16, 705 kb/s
>
> (not sure if that will help)
>
> I have been trying to research what is wrong here but I am not sure
> what part of this I’ve messed up. Any help would be much appreciated.
> Thank you!
>
> Josh

_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using GStreamer to Convert WAV -> RTP Results in Low-Quality RTP Stream

Peter Maersk-Moller-2
In reply to this post by Josh Dickson
You could try setting the correct payload type for 2 channels 44100Hz L16. I might work
See RFC3551. Or see IANAs list of allocated payload types https://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml#rtp-parameters-1

I could suggest payload type 10. Set for rtpL16pay (and for the sdp file)

Regards
Peter

On Fri, May 12, 2017 at 7:50 PM, Josh Dickson <[hidden email]> wrote:
Hi Jan,

Thank you, that is definitely what I need. I have gotten that pipeline working successfully, but now when I play it (via ffplay), it sounds comically slow/distorted.

I am now using the pipeline:

gst-launch-1.0 -m filesrc location=myfile.wav ! wavparse ! audioconvert ! rtpL16pay ! udpsink host=127.0.0.1 port=12008

I used the -v option to produce what I thought was a correct SDP file:

v=0
o=root IN IP4 127.0.0.1
c=IN IP4 127.0.0.1
s=My Name
m=audio 12008 RTP/AVP 96
a=rtpmap:96 L16/44100
a=fmtp:96 media=audio; clock-rate=44100; encoding-name=L16; channels=2;

I am playing the sound with:

ffplay -i stream.sdp -protocol_whitelist file,udp,rtp

Ffplay does open, and the sound resembles the original song, but it is very slowed down/distorted. 

Ffplay sees:

bitrate: 705 kb/s
    Stream #0:0: Audio: pcm_s16be, 44100 Hz, 1 channels, s16, 705 kb/s

(not sure if that will help)

I have been trying to research what is wrong here but I am not sure what part of this I’ve messed up. Any help would be much appreciated. Thank you!

Josh



On Fri, May 12, 2017 at 01:39 Jan Schmidt <[hidden email]> wrote:

Hi,


On 12/05/17 14:43, Josh Dickson wrote:
Hi,

I am sorry in advance if this is not the correct place to ask a question…

I am trying to convert a high-quality WAV file to RTP stream. I am successfully streaming with:

gst-launch-1.0 -m filesrc location=myfile.wav ! wavparse ! audioconvert ! audioresample ! alawenc ! rtppcmapay ! udpsink host=127.0.0.1 port=12000

alaw is 8-bit @ 8khz and will generally sound awful for anything except speech. Try rtpL16pay for 16-bit CD quality audio.

Cheers,
Jan.


I can then check the RTP stream from ffmpeg, which shows that is is 64 kb/s, pct_alaw, 8000 Hz, 1 channel, s16.

My WAV file is much higher quality than this (it is a sample of music at CD quality). I thought that the problem was with audioresample, but I have tried a number of changes and I cannot get any of them to stream correctly. Ideally the stream should be as high-quality as the WAV it’s generated from.

I would greatly appreciate a pointer on how I might be able to do this. Thank you!

Josh







_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using GStreamer to Convert WAV -> RTP Results in Low-Quality RTP Stream

Nicolas Dufresne-5
Le mardi 16 mai 2017 à 19:01 +0200, Peter Maersk-Moller a écrit :
> You could try setting the correct payload type for 2 channels 44100Hz
> L16. I might work
> See RFC3551. Or see IANAs list of allocated payload types
> https://www.iana.org/assignments/rtp-parameters/rtp-
> parameters.xhtml#rtp-parameters-1

Though allocated payload types should be usable.

> > v=0
> > o=root IN IP4 127.0.0.1
> > c=IN IP4 127.0.0.1
> > s=My Name
> > m=audio 12008 RTP/AVP 96
> > a=rtpmap:96 L16/44100

You should use "a=rtpmap:96 L16/44100/2" to signal that you have 2
channels.

regards,
Nicolas
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (188 bytes) Download Attachment