Colin Braley
2008-08-01 15:40:13 UTC
First of all, let me say the FFMpeg project in general is awesome, and
thanks a lot to the developers. Anyway, I have been coding an application
which
needs to import video files in as many formats as possible, and needs to do
fast frame-accurate seeking. I started out trying to use the
av_seek_frame(...)
function to try to do seeking. Here is some example code:
int frame = <frame number to seek to goes here>;
double t = framesToTime( frame );//function to convert frame number to time
in seconds
int64_t timestamp = t * AV_TIME_BASE;
av_seek_frame( pFormatCtx , -1 , timestamp + pFormatCtx->start_time ,
AVSEEK_FLAG_BACKWARD );
this works fine for some video formats, and doesn't work at all in others.
After searching the web, I came across this thread:
http://readlist.com/lists/mplayerhq.hu/ffmpeg-user/1/5936.html
with a lot of information. I tried all of the approaches mentioned to
getting av_seek_frame(...) to work, but none worked for all formats.
Here are my questions:
-Is av_seek_frame(...) worth using? It seems that many people online have
had trouble working with it, and if I need frame accurate seeking, should I
use this function?
-Where is the current file position stored when FFMpeg is reading a file? I
figure that if I can't get av_seek_frame(...) working well, I could just
index the file myself and get frame
accurate seeking working in this manner.
Thanks for all the help!
~Colin
thanks a lot to the developers. Anyway, I have been coding an application
which
needs to import video files in as many formats as possible, and needs to do
fast frame-accurate seeking. I started out trying to use the
av_seek_frame(...)
function to try to do seeking. Here is some example code:
int frame = <frame number to seek to goes here>;
double t = framesToTime( frame );//function to convert frame number to time
in seconds
int64_t timestamp = t * AV_TIME_BASE;
av_seek_frame( pFormatCtx , -1 , timestamp + pFormatCtx->start_time ,
AVSEEK_FLAG_BACKWARD );
this works fine for some video formats, and doesn't work at all in others.
After searching the web, I came across this thread:
http://readlist.com/lists/mplayerhq.hu/ffmpeg-user/1/5936.html
with a lot of information. I tried all of the approaches mentioned to
getting av_seek_frame(...) to work, but none worked for all formats.
Here are my questions:
-Is av_seek_frame(...) worth using? It seems that many people online have
had trouble working with it, and if I need frame accurate seeking, should I
use this function?
-Where is the current file position stored when FFMpeg is reading a file? I
figure that if I can't get av_seek_frame(...) working well, I could just
index the file myself and get frame
accurate seeking working in this manner.
Thanks for all the help!
~Colin