[Libav-user] Writing an rtsp-consuming application - introduction

Nick N eveningnick1 at gmail.com
Thu Oct 27 01:54:41 CEST 2011


Hello

I have faced with a task to develop an application that has to receive an
RTSP (audio + h.264 video) stream from an Axis IP camera. Basically what I
need to do is to consume this stream reliably (i.e., I can't afford my
application to crash if there's some network delay) and export it into a
file + decode video and do some processing on decoded frames.

Searching in google and through the mailing list, I have found a lot of
complaints about the fact that ffmpeg application (not the libavformat
library itself, as i understand) has some issues with receiving RTSP stream
(carried by UDP packets).
I actually launched ffmpeg trying to see how it actually works
"out-of-the-box":

./ffmpeg/ffmpeg -i 'rtsp://
a11.l1857056010.c18570.g.lq.akamaistream.net/D/11/18570/v0001/reflector:56010'
-vcodec copy -acodec copy -t 3600 -y 'nasa.mp4'

(this is NASA translation)
and after few minutes (or seconds) of recording I get some kind of error or
ffmpeg just stops recording and quits.
Well I have a lot to learn and I hope this issue is caused by the
application and not by the library itself.

What I would like to do now - is to do some experiments and write a simple
application that can connect to the RTSP server and start "reading" the
stream, transforming it into a series of AVFrame's that I could display
using SDL, or edit and save/export.

I've played with ffmpeg and SDL (thanks to an awesome Stephen Dranger's
tutorial) for a while, so far. But that is, of course, not enough.
I have found documentation for the RTSP-related functions of libavformat:
http://ffmpeg.org/doxygen/0.6/rtsp_8h.html but as a newbie I couldn't build
a working application that can retrieve the stream. I don't even know in
what order to call these functions. I'd use ffmpeg.c as an example, but it
seems to be huge, I am getting lost in it.

Can you point me in the right direction? Maybe a similar question has been
answered already, but I missed this answer?
How are streaming applications like the one i need to create, built usually
(what kind of architecture the applications should have)? How a simple
streaming application? Do the problems with the ffmpeg library
(unreliability of RTSP recording) extend on libavformat?

I am sorry for unspecific questions (I believe the answer would require a
whole article to be written :) ), but basically I am asking for a simple
sketch and basic ideas I need to delve into.

Thank you for everyone who will find some time to respond!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20111026/893e3d59/attachment.html>


More information about the Libav-user mailing list