decord
decord copied to clipboard
Thread worker: Error sending packet, when num_threads > 2
This is my test code
vr = decord.VideoReader('input\\videoS.webm', ctx=decord.cpu(0), num_threads=2)
for i in range(len(vr)):
frame = vr[i]
crop = frame.asnumpy()[500:550, 800:850]
When I put num_threads
higher then 2 it throws a error, but only for some video files.
Traceback (most recent call last):
File "c:\Users\GG\Desktop\LoL-OCR\test.py", line 12, in <module>
frame = vr[i]
File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\video_reader.py", line 105, in __getitem__
return self.next()
File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\video_reader.py", line 117, in next
arr = _CAPI_VideoReaderNextFrame(self._handle)
File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\_ffi\_ctypes\function.py", line 173, in __call__
check_call(_LIB.DECORDFuncCall(
File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\_ffi\base.py", line 78, in check_call
raise DECORDError(err_str)
decord._ffi.base.DECORDError: [22:49:58] D:\a\decord\decord\src\video\ffmpeg\threaded_decoder.cc:292: [22:49:58] D:\a\decord\decord\src\video\ffmpeg\threaded_decoder.cc:218: Check failed: avcodec_send_packet(dec_ctx_.get(), pkt.get()) >= 0 (-11 vs. 0) Thread worker: Error sending packet.
And if I remove crop = frame.asnumpy()[500:550, 800:850]
when num_threads
is higher then 2 it throws this error and again only for some video files.
Traceback (most recent call last):
File "c:\Users\GG\Desktop\LoL-OCR\test2.py", line 7, in <module>
frame = vr[i]
File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\video_reader.py", line 105, in __getitem__
return self.next()
File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\video_reader.py", line 117, in next
arr = _CAPI_VideoReaderNextFrame(self._handle)
File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\_ffi\_ctypes\function.py", line 173, in __call__
check_call(_LIB.DECORDFuncCall(
File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\_ffi\base.py", line 78, in check_call
raise DECORDError(err_str)
decord._ffi.base.DECORDError: [22:57:11] D:\a\decord\decord\src\video\ffmpeg\threaded_decoder.cc:104: Check failed: run_.load()
- OS: Windows 10
- Conda: 22.9.0
- Python: 3.10.8
- Pip: 22.3.1
- Decord: 0.6.0
- Ffmpeg: 4.2.3
This is my test code
vr = decord.VideoReader('input\\videoS.webm', ctx=decord.cpu(0), num_threads=2) for i in range(len(vr)): frame = vr[i] crop = frame.asnumpy()[500:550, 800:850]
When I put
num_threads
higher then 2 it throws a error, but only for some video files.Traceback (most recent call last): File "c:\Users\GG\Desktop\LoL-OCR\test.py", line 12, in <module> frame = vr[i] File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\video_reader.py", line 105, in __getitem__ return self.next() File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\video_reader.py", line 117, in next arr = _CAPI_VideoReaderNextFrame(self._handle) File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\_ffi\_ctypes\function.py", line 173, in __call__ check_call(_LIB.DECORDFuncCall( File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\_ffi\base.py", line 78, in check_call raise DECORDError(err_str) decord._ffi.base.DECORDError: [22:49:58] D:\a\decord\decord\src\video\ffmpeg\threaded_decoder.cc:292: [22:49:58] D:\a\decord\decord\src\video\ffmpeg\threaded_decoder.cc:218: Check failed: avcodec_send_packet(dec_ctx_.get(), pkt.get()) >= 0 (-11 vs. 0) Thread worker: Error sending packet.
And if I remove
crop = frame.asnumpy()[500:550, 800:850]
whennum_threads
is higher then 2 it throws this error and again only for some video files.Traceback (most recent call last): File "c:\Users\GG\Desktop\LoL-OCR\test2.py", line 7, in <module> frame = vr[i] File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\video_reader.py", line 105, in __getitem__ return self.next() File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\video_reader.py", line 117, in next arr = _CAPI_VideoReaderNextFrame(self._handle) File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\_ffi\_ctypes\function.py", line 173, in __call__ check_call(_LIB.DECORDFuncCall( File "C:\Users\GG\.conda\envs\LoL\lib\site-packages\decord\_ffi\base.py", line 78, in check_call raise DECORDError(err_str) decord._ffi.base.DECORDError: [22:57:11] D:\a\decord\decord\src\video\ffmpeg\threaded_decoder.cc:104: Check failed: run_.load()
- OS: Windows 10
- Conda: 22.9.0
- Python: 3.10.8
- Pip: 22.3.1
- Decord: 0.6.0
- Ffmpeg: 4.2.3
Have you solve the problem?I encounter another issue(https://github.com/dmlc/decord/issues/262) which is similar with yours
No closer to an overall fix, unfortunately, but in my testing this seems to occur consistently on VP9 encoded webm content, whereas mp4 and mkv containers are fine. Only workaround we've found so far is limiting to num_threads=2
on that input type.