[Libav-user] libavformat, RTSP: periodically read last available frame of live stream
alexcohn at netvision.net.il
Sun Sep 8 18:32:49 CEST 2013
On Sep 8, 2013 6:17 PM, "Sandro Mani" <manisandro at gmail.com> wrote:
> I would like to periodically (say every second) grab the latest frame
from a rtsp live stream of a webcam. I am able to successfully open the
stream and read and decode frames, however if I read one frame every
second, I am still reading subsequent frames (as opposed to frames which
are i.e. one second apart). I guess I need to seek to the last available
frame before reading the next frame. Can anyone point out how this can be
> For reference, my code is here:  .
> Thanks for any inputs.
>  http://smani.fedorapeople.org/VideoCapture.hpp
>  http://smani.fedorapeople.org/VideoCapture.cpp
If your webcam has GOP of 1 sec, e.g. GOP length = 30 and FPS = 30, you can
skip to next second; otherwize, the correct strategy would be to decode all
frames, but throw away all frames that you don't need.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user