Crashed when processing video
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 232
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I am processing the RealEstate10K dataset, which consists of a bunch of videos from YouTube.
And for one of the videos, decord would throw core dumped on Linux (Ubuntu 20.04) and OSError on Windows 10.
Here is the error message for Windows:
```
Traceback (most recent call last):
File ".\extract_frames.py", line 176, in
proc_files(vids, files, os.path.join(vid_folder, postfix), os.path.join(out_folder, postfix))
File ".\extract_frames.py", line 128, in proc_files
File ".\extract_frames.py", line 134, in extract_and_save
frames = extract_frames(frame_nums, vid_path)
File ".\extract_frames.py", line 35, in extract_frames
vr = VideoReader(vid_path, ctx=cpu(0))
File "C:\Users\Ken\Anaconda3\lib\site-packages\decord\video_reader.py", line 45, in __init__
uri, ctx.device_type, ctx.device_id, width, height, num_threads, 0)
File "C:\Users\Ken\Anaconda3\lib\site-packages\decord\_ffi\_ctypes\function.py", line 175, in __call__
ctypes.byref(ret_val), ctypes.byref(ret_tcode)))
OSError: [WinError -529697949] Windows Error 0xe06d7363
```
I downloaded this video [https://youtu.be/Nf4p_PxDLI8](url) with `youtube-dl` using the following script
```
# Download video from [url] to a folder [path] and name it [filename]
def download_video(url, path, filename):
print('Downloading: ', url, '...')
ydl_opts = {
'format': 'bestvideo/best',
'noplaylist': True,
'outtmpl': os.path.join(path, filename + '.mp4'),
}
try:
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
except Exception as e:
logging.error(traceback.format_exc())
print("skipping...")
```
And then extract the video with this script
```
def extract_frames(timestamps, vid_path):
vr = VideoReader(vid_path, ctx=cpu(0))
# print('video frames:', len(vr))
fps = vr.get_avg_fps()
# print('fps:', fps)
frame_nums = [round(time/1000000 * fps) for time in timestamps]
try:
frames = vr.get_batch(frame_nums).asnumpy()
except DECORDError:
print('\nSkipping corrupted video:', vid_path)
return None
return frames
```
Is it because of a corrupted video? How can I catch this type of error?
Thanks
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.