Skip to content

Hardware accel example does not use h264_cuvid (dedicated hardware decoder) on nvidia hardware #2220

@oakaigh

Description

@oakaigh

PyAV Version: 16.1.0

Driver Version: 595.58.03
CUDA Version: 13.2
NVIDIA GeForce RTX 3090

import av
import av.codec
import av.logging
av.logging.restore_default_callback()

import av.datasets
from av.codec.hwaccel import HWAccel, hwdevices_available

hwaccel = HWAccel(device_type="cuda", allow_software_fallback=False)
container = av.open(
    av.datasets.curated(
        "pexels/time-lapse-video-of-night-sky-857195.mp4"
    ),
    hwaccel=hwaccel,
)
for packet in container.demux(video=0):
    packet.decode()

print(container.streams[0].codec)
av.codec.codec.dump_hwconfigs()

Output

<av.Codec h264 mode='r'>
Hardware configs:
    ...
    h264
        <av.HWConfig device_type=cuda format=cuda is_supported=True at 0xe3feb60>
    h264_amf
        <av.HWConfig device_type=amf format=amf is_supported=True at 0xe0d8520>
    h264_cuvid
        <av.HWConfig device_type=cuda format=cuda is_supported=True at 0xe0fd720>
    ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions