[Ffmpeg-devel] Newbie - How to go to the near frame to specify timestamp?

Michel Bardiaux mbardiaux
Thu Feb 2 10:48:57 CET 2006


qqq qqqq wrote:
> Hi ,
> 
> I find that there is no way to know frame count ... or
> jump to a determinate frame.
> 
> I am newbie , i do some test with avcodec and
> avformat.
> 
> Now i can open file , and get one frame picture (the
> first frame in the file) and save this picture into
> file.
> 
> I want to jump to a determinate timestamp and get the
> near frame for this timestamp.
> 
> I find the function av_seek_frame.
> 
> I try to use this function this way :
> 
> av_seek_frame(FormatContext , videostream , timestamp
> , AVSEEK_FLAG_BACKWARD)
> 
> But i don't know how to set timestamp , i send to this
> function the timestamp in seconds but i don't get the
> result i want. (example if send timestamp 60 and
> timestamp 420 i get the same picture).
> 
> I try to send timestamp this way :
> timestamp = 60 * AV_TIME_BASE;
> 
> But i get the same result (same picture) if i send :
> timestamp = 60 * AV_TIME_BASE;
> timestamp = 420 * AV_TIME_BASE;
> 
> Any sample code to use av_seek_frame ?
> 

The best strategy for such questions is to rehearse what you want to do 
using the ffmpeg command line; then you look in the source (eg adding 
your own calls to av_log) to see how it is done.

-- 
Michel Bardiaux
R&D Director
T +32 [0] 2 790 29 41
F +32 [0] 2 790 29 02
E mailto:mbardiaux at mediaxim.be

Mediaxim NV/SA
Vorstlaan 191 Boulevard du Souverain
Brussel 1160 Bruxelles
http://www.mediaxim.com/





More information about the ffmpeg-devel mailing list