VideoFrame.reformat ignores source colorspace by default
Created by: animetosho
Overview
Unless otherwise told, it seems like VideoFrame.to_rgb
(and conversely to_image
) assumes the source colorspace to be 601, regardless of what it actually is.
If given a source that, for example, is using a 709 colorspace, the resulting RGB output is incorrect.
Expected behavior
to_rgb
should use the colorspace specified by the source.
Actual behavior
If src_colorspace
is not supplied, 601 is assumed.
Investigation
On a source using a 709 colorspace, specifying src_colorspace='ITU709'
in to_rgb
/to_image
causes the correct output to be generated. Unfortunately, it seems like PyAV doesn't offer a way to determine what the source colorspace is, so this strategy isn't feasible unless the colorspace can be determined via other means.
Reproduction
Use the keyframe saving example with a source using a BT.709 colorspace.
Versions
- PyAV: 8.1.0
- libav*: 4.4