dmlc / dmlc/decord

DECORDError for certain video files

Open
#150 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
C++
Stars
2.5k
Forks
232
PR merge metrics
No merged PRs in 30d

Description

Hi, thanks for the great package.

I just encountered the following error when decoding a small video file (attached below). I am using decord 0.52.0 on mac.

```python
vr = decord.VideoReader('encoded.mp4')
video = vr[:].asnumpy()
del vr
```

```
---------------------------------------------------------------------------
DECORDError Traceback (most recent call last)
in
1 vr = decord.VideoReader('../transcoded.mp4')
----> 2 video = vr[:].asnumpy()
3 del vr

~/.pyenv/versions/3.7.10/lib/python3.7/site-packages/decord/video_reader.py in __getitem__(self, idx)
94 """
95 if isinstance(idx, slice):
---> 96 return self.get_batch(range(*idx.indices(len(self))))
97 if idx < 0:
98 idx += self._num_frame

~/.pyenv/versions/3.7.10/lib/python3.7/site-packages/decord/video_reader.py in get_batch(self, indices)
170 assert self._handle is not None
171 indices = _nd.array(self._validate_indices(indices))
--> 172 arr = _CAPI_VideoReaderGetBatch(self._handle, indices)
173 return bridge_out(arr)
174

~/.pyenv/versions/3.7.10/lib/python3.7/site-packages/decord/_ffi/_ctypes/function.py in __call__(self, *args)
173 check_call(_LIB.DECORDFuncCall(
174 self.handle, values, tcodes, ctypes.c_int(num_args),
--> 175 ctypes.byref(ret_val), ctypes.byref(ret_tcode)))
176 _ = temp_args
177 _ = args

~/.pyenv/versions/3.7.10/lib/python3.7/site-packages/decord/_ffi/base.py in check_call(ret)
76 err_str = err_str.split('Stack trace')[0].strip()
77 raise DECORDLimitReachedError(err_str)
---> 78 raise DECORDError(err_str)
79
80

DECORDError: [16:23:03] /Users/runner/work/decord/decord/src/runtime/ndarray.cc:171: Check failed: from_size == to_size (36864 vs. 27648) DECORDArrayCopyFromTo: The size must exactly match
```

The following succeeds, but strangely the resulting video has 4 channels instead of 3.

```python
vr = decord.VideoReader('encoded.mp4')
video = np.stack([vr.next().asnumpy() for _ in range(len(vr))], axis=0)
del vr
```

Here is the failing video file. Perhaps the video file has unknown color space?

https://user-images.githubusercontent.com/1190780/116515453-46a4c200-a907-11eb-916a-debdd0435cdc.mp4

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.