SDP file for PCM audio stream? - multicast

I am multicasting PCM audio from mpd through pulseaudio to the network and receive it with VLC. This works fine as long as the audio is 44.1kHz - every other sampling rate results in VLC complaining it needs a correct SDP file describing the stream.
Is there a way to either
a) save the current "settings" in a running VLC session to a SDP file (to later edit it) or
b) create an SDP file by hand, which has these settings included:
rtp://#239.0.0.100:27028
24000Hz sampling rate
PCM Audio, 16bit
Thanks for any help or pointers!

This is what PulseAudio outputs with a debug level of 4 and works as the content of test.sdp:
v=0
o=root 3619500147 0 IN IP4 10.12.65.99
s=PulseAudio RTP Stream on RAMPv6
c=IN IP4 239.0.0.100
t=3619500147 0
a=recvonly
m=audio 27028 RTP/AVP 98
a=rtpmap:98 L16/24000/2
a=type:broadcast

Related

How to solve Jiiter Buffer problem in receiving audio RTP stream (bad sound quality) in PJSIP?

I'm a newbie to pjsip and want to build an RTP stream receiver using pjsip.
Setup:
I want to use specific L16/16000/1 codec and have also enabled it in "config_site.h" during compiling the pjsip project and checked that its available
Receiver:
BeagleBone
CrossCompiled Pjsip and Installed all req. libs and sample apps
Sender:
Another Windows PC in the same Network using FFmpeg to transmit Audio Stream via Multicast
I got to know about streamutil.c(pjsip sample-apps) which does similar things to send and receive both. Now for the sake of easyness, I'm using the same Cross-Compiled binary streamutil.
SENDER:
..\ffmpeg -re -stream_loop -1 -i test.mp3 -ar 16000 -acodec pcm_s16be -b:a 128k -ac 1 -payload_type 123 -f rtp udp://239.255.255.211:5500?pkt_size=652
......
Output #0, rtp, to 'udp://239.255.255.211:5500?pkt_size=652':
Metadata:
title : -----
artist : --------
album : -------
date : 2019
track : 1
encoder : Lavf58.20.100
Stream #0:0: Audio: pcm_s16be, 16000 Hz, mono, s16, 256 kb/s
Metadata:
encoder : Lavc58.35.100 pcm_s16be
SDP:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=GREATEST HITS (2) [1 HOUR 20 MINUTES LONG]
c=IN IP4 239.255.255.211/5
t=0 0
a=tool:libavformat 58.26.101
m=audio 5500 RTP/AVP 123
b=AS:256
a=rtpmap:97 L16/16000/1
a=rtpmap:123 L16/16000/1
a=control:streamid=
size= 833kB time=00:00:25.91 bitrate= 263.4kbits/s speed= 1x
RECIEVER LOG:
./streamutil --mcast-addr=239.255.255.211 --recv-only --codec=L16/16000/1
...
...
17:05:05.178 strm0x55dee1537f48 Jitter buffer starts returning normal frames (after 1 empty/lost)
17:05:05.246 strm0x55dee1537f48 Jitter buffer empty (prefetch=0), plc invoked
17:05:05.266 strm0x55dee1537f48 Jitter buffer starts returning normal frames (after 1 empty/lost)
17:05:05.325 strm0x55dee1537f48 Jitter buffer empty (prefetch=0), plc invoked
17:05:05.344 strm0x55dee1537f48 Jitter buffer starts returning normal frames (after 1 empty/lost)
17:05:05.422 strm0x55dee1537f48 Jitter buffer empty (prefetch=0), plc invoked
Tried So far:
set different payload_type
set specific codec in streamutil as parameter
all other parameters in FFmpeg ex. bitrate, clockrate, channels
Check working stream
I am facing no issue, if I use a *.sdp file to receive RTP stream in VLC.
SDP file:
v=0
o=- 0 0 IN IP4 127.0.0.1
s=GREATEST HITS (2) [1 HOUR 20 MINUTES LONG]
c=IN IP4 239.255.255.211/5
t=0 0
a=tool:libavformat 58.26.101
m=audio 5500 RTP/AVP 123
b=AS:256
a=rtpmap:97 PCMU/8000/1
a=rtpmap:123 PCMU/8000/1
a=control:streamid=
I have googled a lot but stuck now at this problem.
So finally my question is that,
How can I get the same Output via Pjsip without this Jitter Buffer logging and dropped sound?
Any help would be greatly appreciated.!
Please check audio bitrate, clock frequency that is set on the ffmpeg side.
Make sure the timestamp of each packets are updated according to the clock frequency.( check the wireshark logs)
You are trying to do a VOD ( from mp3 file) and not live data transmission, may cause problem. please check the timestamp of the rtp packets.

Freeswitch PJSIP client, PESQ score incorrect

I am trying to measure voice-quality (PESQ Score) by playing a file at server and recoding it at client-side and then passing both files to ITU implementation of PESQ score computation.
While the codec negotiated is PCMU(G.711) so I should get PESQ score of 4.1 (or something near that) but the score I am getting is in range of 3.4-3.7.
After computing score for more than 40 recordings PESQ Scores I am getting is:
AVG: 3.4278035714
MAX: 3.707
MIN: 3.343
I don't understand what is it that I am doing incorrectly. Why am I not getting scores close to 4.1 ??
Setup:
File (PCM#8000) --- FreeSwitch(PCMU#8000) ---PJSIPClient(PCMU#8000)---File(PCM#8000)
Server and client are on same server.
Server: Freeswitch
Client: PJSUA Python client
Audio file format (#Server): RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz
Audio file format (#cilent, recorded by client): RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz
Codec negotiated between client and server is PCMU#8000h
t=0 0
m=audio 28734 RTP/AVP 0 96
a=rtpmap:0 PCMU/8000
a=rtpmap:96 telephone-event/8000
a=fmtp:96 0-16
a=ptime:20
a=rtcp:28735 IN IP4 192.168.1.236

RTP AAC Packet Depacketizer

I asked earlier about H264 at RTP H.264 Packet Depacketizer
My question now is about the audio packets.
I noticed via the RTP packets that audio frames like AAC, G.711, G.726 and others all have the Marker Bit set.
I think frames are independent. am I right?
My question is: Audio is small, but I know that I can have more than one frame per RTP ​​packet. Independent of how many frames I have, they are complete? Or it may be fragmented between RTP packets.
The difference between audio and video is that audio is typically encoded either in individual samples, or in certain [small] frames without reference to previous data. Additionally, amount of data is small. So audio does not typically need complicated fragmentation to be transmitted over RTP. However, for any payload type you should again refer to RFC that describes the details:
AAC - RTP Payload Format for MPEG-4 Audio/Visual Streams
G.711 - RTP Payload Format for ITU-T Recommendation G.711.1
G.726 - RTP Profile for Audio and Video Conferences with Minimal Control
Other

How to detect the audio availability in the SUSE Linux system

I got some audio pieces in flv format. Each of them is about 10 seconds long.
My question is how to detect whether the audio pieces has "sound", in other words, sometimes the audio pieces has no sound even the size of it is not 0 byte, so how to find those broken/silent audio files by some linux tool/command?
Maybe ffplay can do this? any available advice?
If you want to quickly check if the stream is video only, audio only or if it contains both audio and video, try hexdump -C filename | head. The fifth byte contains information about the contents of the file.
0x01 - video only
0x04 - audio only
0x05 - audio + video
You can also try to play the file using VLC media player. There is a menu option that enables informational messages from the media being played back.

Resampling audio output for A2DP (from PCM WAV)

How do I bring stereo PCM WAV 32,000Hz with a stream of 1024 kbps (125 KB) to the headset with Bluetooth 2.1 on a CM7 smartphone with DSPManager? Is this possible? SBC is really a bad idea.
Maybe it's possible with the Headset Profile (HSP)? I don`t know about supported codecs in this profile.
#TJD: Because it compresses the compressed stream. My Epic 4G don`t have Apt-X support. My headset Gemix BH-04A yellow.

Resources