Streaming wav sound with FFMPEG

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

Streaming wav sound with FFMPEG

Nicolas VAMBAIRGUE
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

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Streaming wav sound with FFMPEG

Carl Eugen Hoyos-2


> Am 17.06.2020 um 11:37 schrieb Nicolas VAMBAIRGUE <[hidden email]>:
>
> - [rtp @ 0x7f7d00008040] Protocol 'rtp' not on whitelist 'file,crypto'!
>
> 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.

(Command line including) complete, uncut console output missing.
I consider it very unlikely that the same error is shown...

Carl Eugen
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Streaming wav sound with FFMPEG

Moritz Barsnick
In reply to this post by Nicolas VAMBAIRGUE
Hi Nicolas,

On Wed, Jun 17, 2020 at 11:37:00 +0200, Nicolas VAMBAIRGUE wrote:

> 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.

(As Carl Eugen wrote, please also show the complete, uncut console
output.)

The "Protocol 'rtp' not on whitelist" was an ffplay error, so you need
to add those options to the client ffplay command line, not to the
server's. (You may also need the protocol "udp".)

I can reproduce your error. If I add that option (plus "udp") to
ffplay, the error goes away. I get a different issue then, but YMMV.

Regards,
Moritz
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: Streaming wav sound with FFMPEG

Nicolas VAMBAIRGUE
In reply to this post by Carl Eugen Hoyos-2
Le 17/06/2020 à 16:32, Carl Eugen Hoyos a écrit :

>
>> Am 17.06.2020 um 11:37 schrieb Nicolas VAMBAIRGUE <[hidden email]>:
>>
>> - [rtp @ 0x7f7d00008040] Protocol 'rtp' not on whitelist 'file,crypto'!
>>
>> And if I finally tried :
>>
>>      ffmpeg -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.
> (Command line including) complete, uncut console output missing.
> I consider it very unlikely that the same error is shown...
>
> Carl Eugen
>
>
>       > Yes, sorry, let me post you what I got exactly. So, with the above command «server side» :
> > ffmpeg -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 type the following command «client side» to try to read the stream :
> > ffplay /home/dr_click/audio.sdp
> >
> > And then, I get this error :
>       > [rtp @ 0x7f7778008040] Protocol 'rtp' not on whitelist 'file,crypto'!
>  /home/dr_click/audio.sdp: Invalid data found when processing input
>      nan    :  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0
>
> > Dr_Click



_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".