miércoles, 11 de julio de 2012

RTSP listen went into libav

Finally we did it, the RTSP announce/record scenario I announced some months ago has been accepted into libav. This means that anyone will be able to receive rtsp streams on demand with avconv or avplay. With this enhancement with others which will hopefully be merged into libav soon, we will be able to implement avserv using URLContext and limiting the network functionalities to the demuxer developed into libavformat. The other enhancements are: modification to the libavformat TCP demuxer to allow multiple accepts to one socket (like servers do) and a rtsp listen like functionality to rtmp, which is waiting for review.

We added the "-rtsp_flag listen" option which allows both avconv and avplay to wait for an incoming RTSP connection which will send a stream after a RECORD command and receive the stream over UDP or TCP. What is this useful to? Imagine that you want to publish a real time stream with a client that only supports rtsp but your server only supports rtmp, what can we do?

avconv -f rtsp -rtsp_flags listen -i rtsp://myhost/stream.sdp rtmp://myhost/app/stream

or you can just store it to a file

avconv -f rtsp -rtsp_flags listen -i rtsp://myhost/stream.sdp file.mp4/ogv/mpg/...

In addition you will be able to do the usual with avconv as for instance convert to any of the infinite available codecs.

I don't know if it is really useful but isn't it cool? ;-)