You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seek that seeks to the closest keyframe before requested timestamp
Motivation
At the moment, seek function is restricted to a precise seek which under the hood finds the closest keyframe, and decodes frames until we reach our targeted frame. This is a convenient, however potentially slower operation. We want users to be able to decide if they want to seek to keyframes only (for the fastest possible version), we should allow it for them.
Pitch
Imagine we have a video with keyframes at 0s and 8.3s. Then the precise seek (current implementation) works as follows:
video.seek(2)
data = next(video)
print(data['pts'])
>> 2.002
video.seek(5)
data = next(video)
print(data['pts'])
>> 5.005
video.seek(9)
data = next(video)
print(data['pts'])
>> 9.009
And the imprecise seek (keyframes only):
video.seek(2, keyframes_only=True)
data = next(video)
print(data['pts'])
>> 0.0
video.seek(5, keyframes_only=True)
data = next(video)
print(data['pts'])
>> 0.0
video.seek(9, keyframes_only=True)
data = next(video)
print(data['pts'])
>> 8.341667
Additional context
This is a function provided in pyav already, so I think it would be useful to have it as an option.
Note:
This requires changes in the decoder C++ API which is IIUC used internally in FB; before accepting the PR, @fmassa should probably look into importing it and testing it internally. The default values and operations are kept the same, but nevertheless, there could be regressions not caught by our current tests.
Uh oh!
There was an error while loading. Please reload this page.
🚀 Feature
Seek that seeks to the closest keyframe before requested timestamp
Motivation
At the moment, seek function is restricted to a precise seek which under the hood finds the closest keyframe, and decodes frames until we reach our targeted frame. This is a convenient, however potentially slower operation. We want users to be able to decide if they want to seek to keyframes only (for the fastest possible version), we should allow it for them.
Pitch
Imagine we have a video with keyframes at 0s and 8.3s. Then the precise seek (current implementation) works as follows:
And the imprecise seek (keyframes only):
Additional context
This is a function provided in pyav already, so I think it would be useful to have it as an option.
Note:
This requires changes in the
decoder
C++ API which is IIUC used internally in FB; before accepting the PR, @fmassa should probably look into importing it and testing it internally. The default values and operations are kept the same, but nevertheless, there could be regressions not caught by our current tests.cc @bjuncek
The text was updated successfully, but these errors were encountered: