I'm using the ffmpeg library to decode / encode audio in JAVA, using the Process objets. The aim is to got the raw datas decoded by ffmpeg in my JAVA code and then, to send them back to ffmpeg to generate a stream or 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) So, I'd prefer 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 semms to work on the server side. But, when I enter the below command line on the server 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
If I try 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 try :
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
I still get the same error.
Which point do I miss to stream locally some raw datas and catch them back in the AudioInputStream ?
Thank you for all your replies.