Crashed when processing video
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 <module>
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 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
Is other video working fine? If poosible, can you attach the video to this issue?
Yes, other video works fine. I am using this video https://youtu.be/Nf4p_PxDLI8
And it is downloaded 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...")
I will look into the issue once I reproduce the issue with windows
@ken2576 I have no issue loading the video you have mentioned, can you check if you have a corrupted video file? I am using the video you mentioned: https://youtu.be/Nf4p_PxDLI8
@ken2576, I have the same problem with your video - OSError: [WinError -529697949] Windows Error 0xe06d7363.
The problem is in this video, but why?
Sorry I was busy with other things so I haven't had the time to test it again. My guess is that the video file downloaded with youtube-dl is corrupted for some reason. But it plays fine if I view it directly.