Skip to content

VideoFrame.to_ndarray(format="rgb24") raises [Errno 95] Operation not supported for NVDEC frames with reserved colorspace metadata (regression from 16.1.0) #2208

@bazookanu

Description

@bazookanu

Calling VideoFrame.to_ndarray(format="rgb24") on frames decoded by h264_cuvid/hevc_cuvid (NVDEC) raises [Errno 95] Operation not supported in 17.0.0.

This worked correctly in 16.1.0.

Error

[swscaler] Unsupported input (Operation not supported): fmt:nv12 csp:gbr prim:reserved trc:reserved -> fmt:rgb24 csp:gbr prim:reserved trc:reserved OSError: [Errno 95] Operation not supported

Reproducing

import av                                                                                                          
                  
codec = av.Codec("hevc_cuvid", "r")                                                                                
ctx = av.CodecContext.create(codec)
ctx.options = {"surfaces": "8"}                                                                                    
                                                                                                                   
with open("sample.h265", "rb") as f:                                                                               
    raw = f.read()                                                                                                 
                                                                                                                   
packet = av.Packet(raw)                                                                                            
frames = ctx.decode(packet)                                                                                        
for frame in frames:                                                                                               
    img = frame.to_ndarray(format="rgb24")  # raises in 17.0.0, works in 16.1.0
  • PyAV 16.1.0: works
  • PyAV 17.0.0: fails
  • Decoder: hevc_cuvid (NVDEC)
  • Source streams: H.265

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