NVIDIA / VideoProcessingFramework

Set of Python bindings to C++ libraries which provides full HW acceleration for video decoding, encoding and GPU-accelerated color space and pixel format conversions
Apache License 2.0
1.32k stars 233 forks source link

PyNvCodec.CuvidParserException: HW reset when decoding very small video #421

Open InkosiZhong opened 1 year ago

InkosiZhong commented 1 year ago

When I use SampleDecode.py to decode a video with resolution 128x130, some errors are raised as follow,

Decoding : : 0 frames [00:00, ? frames/s]/home/inkosizhong/Lab/VideoQuery/codec/VideoProcessingFramework/PyNvCodec/TC/src/NvDecoder.cpp:343
CUDA error: CUDA_ERROR_INVALID_VALUE
invalid argument

Cuvid parser faced error.
Cuvid parser exception happened.
Cuvid parser faced error.
Cuvid parser exception happened.
Traceback (most recent call last):
  File "SampleDecode.py", line 357, in <module>
    dec.decode(verbose=args.verbose)
  File "SampleDecode.py", line 315, in decode
    if not self.flush_frame(verbose):
  File "SampleDecode.py", line 283, in flush_frame
    ret = self.nv_dec.FlushSingleFrame(self.frame_nv12)
PyNvCodec.CuvidParserException: HW reset
Decoding : : 2 frames [00:00, 66.79 frames/s]

As I vary the input resolution, I found this error will happen when width<130 or height<130. I'm wondering that if there any solution to enable the decoding for such a small video?

InkosiZhong commented 1 year ago

Similarly, I found a similar restrict at encoding side. When I use HEVC, the smallest video I can encode is 48x130. (h>=48 and w>=130)

theHamsta commented 1 year ago

The line of code referenced by the error: https://github.com/NVIDIA/VideoProcessingFramework/blob/master/PyNvCodec/TC/src/NvDecoder.cpp#L342

gedoensmax commented 1 year ago

This is an answer i got internally: For NVDEC, Limits are different per codecs. NVDECODE API cuvidGetDecoderCaps() can be used to query min/max supported resolution on underlying GPU. For HEVC, nvdec support min 144x144. H264 is 48x16.

Not sure if this is satisfying feedback but i also doubt that at this small resolution CPU decode might be a bottleneck.