[Libav-user] Writing an rtsp-consuming application - introduction
Luke Clemens
lclemens at gmail.com
Thu Oct 27 22:02:07 CEST 2011
if it's quitting after a period of a few minutes, i agree with ferdinand,
it's probably a timeout problem. i know that older version of ffmpeg had a
timeout problem with our axis cameras. once i got the latest version that
problem went away, so make sure you're using an up-to-date version.
the basic pseudo code i use is:
av_find_input_format()
av_open_input_file() // opens the specified video file
av_find_stream_info() // performs a probe and fills a format context
for each stream {
avcodec_find_decoder()
avcodec_open()
}
read loop {
av_read_frame()
switch (frame type) {
case audio: avcodec_decode_audio3()
case subtitle: avcodec_decode_subtitle2()
case video: avcodec_decode_video2()
}
}
On Thu, Oct 27, 2011 at 2:16 AM, Ferdinand Jacobs <jacobsfer at hotmail.com>wrote:
> Hi Nick!
>
> I think it would help if you used wireshark and examined the RTSP packets
> to see what is going on. It could be that your camera needs a GET_PARAMETER
> and times out. That's not very hard to implement by the way.
>
> For the encoding part, I'm still struggling with that myself as there are
> no tutorials for that subject, and it's kind of hard for someone who isn't
> very experienced to just dive into ffmpeg.c ... ( I have to encode h264
> video from a camera to mpeg4 )
> So if you find any on that, let me know. : )
>
> Greetings Ferdinand
>
> ------------------------------
> Date: Wed, 26 Oct 2011 19:54:41 -0400
> From: eveningnick1 at gmail.com
> To: libav-user at ffmpeg.org
> Subject: [Libav-user] Writing an rtsp-consuming application - introduction
>
>
> 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<http://a11.l1857056010.c18570.g.lq.akamaistream.net/D/11/18570/v0001/reflector%3a56010>'
> -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!
>
>
> _______________________________________________ Libav-user mailing list
> Libav-user at ffmpeg.org http://ffmpeg.org/mailman/listinfo/libav-user
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
>
--
-
-
-
-
Luke Clemens
http://clemens.bytehammer.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20111027/36a23541/attachment.html>
More information about the Libav-user
mailing list