How can I quickly sort files for thousands of video data sets in terms of duration/frames?
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
How can I quickly sort files for thousands of video data sets in terms of duration/frames?
In the usual way, the length of the video is sorted using the following code
`orderdNames = VideoNames[np.argsort([len(decord.VideoReader(x)) for x in VideoNames])]`
VideoReader(x) one by one to get the total number of frames in the video is very time consuming, is there any good technique to increase the efficiency? Thank you!
The results of the test in 9848 videos are as follows:
```python
t1 = time.time()
framesList1 = [cv2.VideoCapture(x).get(cv2.CAP_PROP_FRAME_COUNT) for x in VideoNames]
t2 = time.time()
framesList2 = [len(decord.VideoReader(x)) for x in VideoNames]
t3 = time.time()
import operator
print('opencv 耗时:{}\n'.format(t2-t1))
print('decord 耗时:{}\n'.format(t3-t2))
```
opencv 耗时:177.791166305542 秒
decord 耗时:255.77367973327637 秒
How are the results explained?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.