Allow conversion from `VideoFrame` in 'gray16be' or 'gray16le' pixel format to ndarray
Created by: LHolten
Overview
Currently when trying to run code like frame.reformat(format='gray16').to_ndarray()
an error is thrown ValueError: Conversion to numpy array with format 'gray16le' is not yet supported
.
Desired Behavior
frame.reformat(format='gray16').to_ndarray()
should return a numpy array with dtype numpy.uint16
.
Example API
with av.open(path) as container:
for frame in container.decode(video=0):
yield frame.reformat(format='gray16').to_ndarray()
Additional context
In my current project I need to convert video frames to grayscale, but 'gray8' doesn't have enough depth.