Hi I need help understanding the internals of FFmpeg API seek call with certain files.
Im using the ffmpeg libav* API in an appliaction that reduces the bitrate of MP4 files. The output MP4 file has 1 H264 video and 1 AAC audio track. The application supports seeking on the input file to a specifc video frame using the seek API call. I added some diagnostics to FFmpeg to help me see what happens during seek calls. So generally seeking works fine for me. I make seek API call on the video track to a PTS and the MP4 demuxer aligns its internal sample index pointers for each track, so the next time demuxer reads for the next frame, it will seek to position the file pointer into the required offset to get the required frame. The behaviour is predicatble for input files that have audio and video tracks. So ffmpeg may 2 two phyical file/stream seeks if it need to locate the correct frame for audio and video. However I have an issue when i Have an input flle with 6 tracks. 1 H264 Video track, 1 AAC audio track, 2 Hint tracks (one for vidoe and audio), an OD track (has 1 sample) and a Scenes track (which has 1 sample). the layout of this file is ftyp-moov-mdat-free-free When I perform the seek API call this time on this file, the MP4 demuxer as expected aligns its internal sample index pointer for each track, so the next time we request a frame from demuxer it will seek to the correct postiion in the file to get the correct frame. This works as expected, we seek into the correct location in the file, and align correctly for each of the other tracks. Only 4 of the tracks have samples at the desired time, audio, video and both hint tracks. So application is able to start demuxing the frames from this seek time (e.g. 1 second) for all 4 tracks. However after reading a certain amount of data another 2 seek requests are made internally by FFmpeg to a position in bothj of the Hint tracks at a time unrelated to the oriignal seek request e.g. 3 seconds. Im at a loss to explain, why FFmpeg internally needs to perform these 2 addiitonal seek requests into each of the hint tracks, when no other seek API call is made. Surely 1 seek request, results in at maximun 1 seek request per track. However in this case I have 2 seeks on the hint tracks. The 'Scene' and 'OD' track dont have any sample for this seek location. Im hoping someone can explain, why this happens and how predictable it is? Thanks _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel