VideoFrame.to_image() doesn't work properly if width/height is specified
Created by: animetosho
Overview
VideoFrame.to_image()
permits width
and height
parameters, according to documentation, however, if specified, they cause issues.
Expected behavior
Either width/height is not supported in to_image
, or it resizes the frame to specified dimensions.
Actual behavior
If the width/height is smaller than original dimensions, a runtime error (ValueError: not enough image data
) is thrown. If it's larger, it resizes, but doesn't change the image's dimensions, giving messed up output.
Investigation
The to_image
function uses the frame's original dimensions when constructing the image, as opposed to the after-reformatted dimensions.
(it may also be worth checking the other functions which pass the parameters onto reformat
for similar issues)
Versions
- PyAV runtime: 8.1.0