FFmpeg: Improve scrubbing performance

Applying negative offset to seek position before scanning doesnn't have
any effect. This change results in 1.5x faster seeking (random frame,
average value) in sample file with 30 frame GOP length.

If I am not mistaken, B frames can have pts that can be less than
pts of I frame that must be decoded. Even in this case though, B frame
packet will be stored after that I frame.

In addition, preseek value is de facto hardcoded so seeking would fail
if it could. This can be hard to spot though.

Reviewed By: sergey

Differential Revision: https://developer.blender.org/D10529
This commit is contained in:
Richard Antalik 2021-03-02 12:13:21 +01:00
parent bbb1936411
commit 88604b79b7
Notes: blender-bot 2024-01-16 18:05:25 +01:00
Referenced by commit 6c33d3d01b, Fix T86944: Incorrect seeking in some movies
Referenced by issue #86944, Regression: artefacts in video between Keyframes in VSE
Referenced by issue #70529, Verify ffmpeg and other image and video libraries use optimal build flags
1 changed files with 1 additions and 1 deletions

View File

@ -1149,7 +1149,7 @@ static ImBuf *ffmpeg_fetchibuf(struct anim *anim, int position, IMB_Timecode_Typ
}
}
else {
pos = (int64_t)(position - anim->preseek) * AV_TIME_BASE / frame_rate;
pos = (int64_t)position * AV_TIME_BASE / frame_rate;
av_log(anim->pFormatCtx,
AV_LOG_DEBUG,