Frame extraction by timestamp
Describe the question.
Hello,
is it possible to extract the exact frame based on a specified timestamp? for example if i pass [2.7600, 2.7800, 2.8000, 2.8200, 2.8400] I would get 5 frames corresponding to these timestamps returned (one video).
cc @JanuszL
Thank you 🤗!
Check for duplicates
- [x] I have searched the open bugs/issues and have found no duplicates for this bug report
Hell @jadechoghari
thanks for the question. I think you are looking for enable_timestamps argument of our video reader
It works together with file_list argument. You can create a list and pass desired frames as list items. Is that enough for your use case?
Hey! I tried but it seems you can only pass a range say from 5.1 to 5.2 sec and it will sample from this range. any way to get exact timestamp?
Take torchcodec for example :
# initialize video decoder
decoder = VideoDecoder(video_path, device=device, seek_mode="approximate")
# ...
frames_batch = decoder.get_frames_at(indices=frame_indices)
Sure, I understand now. I am afraid that currently there is now way to get arbitrary frames by timestamp. I will mark this issue as a possible enhancement to the new video reader that we actively improve at the moment.
Do I understand correctly that API matching torchcodec would be something you are looking for?
yes exactly! it will be used in robotics!