Ahmed
Ahmed

Reputation: 1533

ffmpeg RTP audio multicast stream choppy

I'm trying to stream .wav audio files via RTP multicast. I'm using the following command:

ffmpeg -re -i Melody_file.wav -f rtp rtp://224.0.1.211:5001

It successfully initiates the stream. However, the audio comes out very choppy. Any ideas how I can make the audio stream clean? I do not need any video at all. Below is a screenshot of my output:

enter image description here

Upvotes: 1

Views: 1910

Answers (1)

Pierz
Pierz

Reputation: 8098

Here's some examples expanding upon the useful comments between @Ralf and @Ahmed about setting asetnsamples and aresample, and also those mentioned in the Snom wiki. Basically one can get smoother multicast transmission/playback using these approaches for G711/mulaw audio:

ffmpeg -re -i Melody_file.wav -filter_complex 'aresample=8000,asetnsamples=n=160' -acodec pcm_mulaw -ac 1 -f rtp rtp://224.0.1.211:5001

Or using higher quality G722 audio codec:

ffmpeg -re -i Melody_file.wav -filter_complex 'aresample=16000,asetnsamples=n=160' -acodec g722 -ac 1 -f rtp rtp://224.0.1.211:5001

Upvotes: 1

Related Questions