You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PyAV currently supports hardware decoding (via HWAccel + av.open(..., hwaccel=...)) and hardware encoding (just pick an encoder like h264_qsv on the output stream) (see examples/basics/hw_decode.py)
However, hardware filters like vpp_qsv, overlay_qsv, scale_qsv, hwupload, and hwdownload are not currently supported through PyAV's filter graph API. Those filters require attaching an AVHWDeviceContext to the filter graph (and/or an AVHWFramesContext to the buffer source via av_buffersrc_parameters_set), and PyAV's av.filter.Graph doesn't expose either of those bindings yet.
So a direct PyAV port of your command isn't possible today. Workarounds:
Software filter, hardware codecs: decode with QSV, transfer frames to system memory (frame.to_ndarray() / software overlay), then encode with h264_qsv. You lose the zero-copy benefit of vpp_qsv + overlay_qsv.
Shell out to ffmpeg for the parts of the pipeline that need hardware filters; PyAV and the ffmpeg CLI can coexist.
If anyone wants to take a shot at adding hw_device_ctx to Graph and hw_frames_ctx plumbing to the buffer source, that would be the path to making this work natively.
Activity
MeshHun commentedon Mar 30, 2026
Pyav can do these?
WyattBlue commentedon May 6, 2026
PyAV currently supports hardware decoding (via
HWAccel+av.open(..., hwaccel=...)) and hardware encoding (just pick an encoder likeh264_qsvon the output stream) (seeexamples/basics/hw_decode.py)However, hardware filters like
vpp_qsv,overlay_qsv,scale_qsv,hwupload, andhwdownloadare not currently supported through PyAV's filter graph API. Those filters require attaching anAVHWDeviceContextto the filter graph (and/or anAVHWFramesContextto the buffer source viaav_buffersrc_parameters_set), and PyAV'sav.filter.Graphdoesn't expose either of those bindings yet.So a direct PyAV port of your command isn't possible today. Workarounds:
frame.to_ndarray()/ softwareoverlay), then encode withh264_qsv. You lose the zero-copy benefit ofvpp_qsv+overlay_qsv.ffmpegCLI can coexist.If anyone wants to take a shot at adding
hw_device_ctxtoGraphandhw_frames_ctxplumbing to the buffer source, that would be the path to making this work natively.