viernes, 17 de agosto de 2012

RTMP listen went into libav

After some time we have managed to get rtmp listen into libav master. It has been harder than getting the last rtsp patch I announced in this same blog mainly because I didn't have any experience with rtmp. I have to thank Martin and Luca who had a lot of patience with me and in general to all the people within libav.

Now libav supports receiving a stream with the rtmp publish command, no authentication, no encryption, no... but at least it is a first step.

Now anyone can use the -rtmp_listen 1 argument to receive a stream and -timeout x to set an initial timeout to wait for incoming connections. How can we then receive an rtmp stream on our machine?

avconv -rtmp_listen 1 -f flv -timeout 10 rtmp://localhost/app/test outfile

on the other side to send the stream is as easy as:

avconv -i inputfile -f flv rtmp://localhost/app/test

Isn't that nice? And what if I want to just play my favorite movie on the laptop connected to my tv without using those slow pendrives?

"avplay -f flv -rtmp_listen 1 rtmp://my_ip/app/test" on the laptop and "avconv -i inputfile -f flv -c copy rtmp://my_ip/app/test" in your desktop.

Now using raw tcp, rtsp or rtmp to receive your streams is only a matter of choice.

Oh, didn't I say it? now you can use tcp://address:port/path?listen with your avconv to receive raw tcp streams. (Don't forget to set the output format with -f in the sender side)

recv: avconv -i tcp://ip:port/path?listen outfile

send: avconv -i inputfile -f format tcp://ip:port/path

I think that is all by now. Next improvement... Multiple connections!

 

No hay comentarios:

Publicar un comentario