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
Overview
Unless otherwise told, it seems like
VideoFrame.to_rgb(and converselyto_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_rgbshould use the colorspace specified by the source.Actual behavior
If
src_colorspaceis not supplied, 601 is assumed.Investigation
On a source using a 709 colorspace, specifying
src_colorspace='ITU709'into_rgb/to_imagecauses 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