These comments apply to most file formats I work with but I am currently experiencing lots of problems with mpeg2 h264 files (with duration not set).
I am using the ffmpeg-0.5 release of libav libraries. When I av_seek_frame in my application, the function does not necessarily take me to a key frame (even though I do not specify AVSEEK_FRAME_ANY). Is this to be expected? I seem to have to add an error margin and seek a little further back each time, and then decode many frames I do not actually want before discovering the keyframe I need. Moreover, I can accurately compute the timestamp to search to and know exactly where the keyframes are in the file - but av_seek_frame will quite often take me to a position too high up the file and therefore I miss the necessary keyframe (even though I add a big negative margin of error in the search!). Also - I tried to write a little routine to discover how many frames were in the file (since the duration field is set to zero) by deliberately seeking off the end of the file and then doing a binary chop back down to locate the file end. However, the av_seek_frame never seems to fail (i.e. -1 is never returned, even though I blatantly seek way off the end of the file!!!) Can anyone tell me (particularly regarding h264 files): 1) Why av_seek_frame returns non-key frames (when the flags param is zero). 2) Why av_seek_frame sometimes refuses to seek to a particular timestamp and sometimes misses it by two or three keyframe spacings? 3) Why av_seek_frame never returns -1 when seeking off the end of the file? 4) Should the timestamp passed to av_seek_frame represent 'seconds into the file' (expressed as a timestamp, obviously), or should it have the first frame timestamp added to it? Please help me here. I can't see how I can accurately skip around a video file using av_seek_frame. It seems that the only certain way to navigate the file is to start at the beginning and decode everything right through to the end!!! Gary Smart _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
