[FFmpeg-user] Streaming wav sound with FFMPEG

Nicolas VAMBAIRGUE nicolas2020 at nv76.info
Wed Jun 17 12:37:00 EEST 2020


Hello,

I'm using the ffmpeg library to decode / encode audio in Java, using the 
Process objets. The aim is to decode the datas of an external source 
with ffmpeg, and then to stream the decoded (wav) datas locally to catch 
them in my Java code. After I processed them in Java, I'll send them 
back to ffmpeg to generate a coded stream (mp3, opus, ogg...) or to 
create a file.

As Java sounds only allow wav audio datas, I made a first try with this 
command line :

     ffmpeg -i http://199.180.75.118:80 -acodec pcm_s16le -ar 44100 -ac 
2 "/home/dr_click/montest.wav"

It works. But, my goal is to get the frames on the fly and not a file. I 
thought about using a pipe but it seems it will work only with Linux and 
not with Windows (and no idea for MacOS)

To stream locally a wav file and to catch it with Java into a 
AudioInputStream, I wrote this command :

     ffmpeg -re -i http://199.180.75.118:80 -acodec pcm_s16le -ar 44100 
-ac 2 -f rtp rtp://127.0.0.1:1234

It seems to work on the server side. But, when I enter the below command 
line to act like the client side :

     ffplay rtp://127.0.0.1:1234

It doesn't work at all. I got this error :

- [rtp @ 0x7f29c8000b80] Unable to receive RTP payload type 97 without 
an SDP file describing it

So I tried the couple :

     ffmpeg -i http://199.180.75.118:80 -acodec pcm_s16le -ar 44100 -ac 
2 -f rtp -sdp_file /home/dr_click/audio.sdp rtp://127.0.1.1:1234

and

     ffplay /home/dr_click/audio.sdp

I got the following error :

- [rtp @ 0x7f7d00008040] Protocol 'rtp' not on whitelist 'file,crypto'! if


And if I finally tried :

     fmpeg -protocol_whitelist file,http,rtp,tcp -i 
http://199.180.75.118:80 -acodec pcm_s16le -ar 44100 -ac 2 -f rtp 
-sdp_file /home/dr_click/audio.sdp rtp://127.0.1.1:1234

But I get the same "whitelist" error.

Which point do I miss to stream locally some wav datas and then catching 
them in the JAVA AudioInputStream ?

Thank you for all your replies.

Regards,

Nicolas



More information about the ffmpeg-user mailing list