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

Error when reading a video. #438

Open sotelo opened 1 year ago

sotelo commented 1 year ago

Describe the bug I am able to use VPF to read/write videos but there's a particular video where I get the following error:

Codec not supported on this GPU
Decoder not initialized.Cuvid parser faced error.
Cuvid parser exception happened.

Here's the video: https://user-images.githubusercontent.com/1833660/217904069-fdc84249-2e0d-462b-8927-e9588fc0751a.mp4

The codec of the video is h264 and the size is 1080x720 so I don't understand why I get this error. Could you please help me figure this out?

theHamsta commented 1 year ago

Which GPU do you have? The video is h264 encoded by nvenc at 4:4:4. Is bit depth 10bit? Did you encode with the same GPU as you're now trying to decode?

Relevant code location throwing the error https://github.com/NVIDIA/VideoProcessingFramework/blob/3ba39fb97434a06d85c0d4c73de049e166c9e162/src/TC/src/NvDecoder.cpp#L208-L219

sotelo commented 1 year ago

Hello! Thank you for the fast response. I'm using a NVIDIA GeForce RTX 3090 GPU.

I used this code to preprocess the video:

def format_file(video_path, output_path):
    command = (
        f"ffmpeg -hide_banner -loglevel quiet -y"
        f" -i {video_path} -r 25 -vf scale=1080:720 -c:v h264_nvenc -acodec aac -ar 16000 {output_path}"
    )
    subprocess.call(command, shell=True, stdout=None)