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
{{ message }}
Repository navigation
Allow access to an affine transform of a particular video tracks display rotation. #1047
I'd like to propose an intermediary solution that puts the onus on the user for doing anything with the transform, but exposes it to clients of PyAV
Use case:
As a client of PyAV building a robust video processing system which consumes arbitrary videos, its a requirement to handle track transforms as we decode video within pyAV for ML / deep learning tasks. If we dont have our transform we may produce incorrect predictions, thumbnails and the like.
being able to introspect a video track and extract it rotation would add a class method to av.video.stream.VideoStream
something like getDisplayRotation() or perhaps a more pythonic get_display_rotation which would return a np.array containing the rotation matrix.
Should a track not have a preferred transform, I see two possible solutions. Return None or return an identity matrix
Other media processing apis take a similar approach, for example, AVFoundation which is Apples media processing api exposes a prefferedTransform property on a asset track (equivalent of a stream in ffmpeg parlance)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
So ideally PyAV would either expose a utility function that wraps av_display_rotation_get or introduce an API to directly read the rotation either from the frame or from from the frames side_data. @WyattBlue what do you think would be the best approach?
Activity
github-actions commentedon Mar 11, 2023
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
lgeiger commentedon Dec 3, 2024
@WyattBlue with the removal of
stream.side_data["DISPLAYMATRIX"]in #1570 I think this issues becomes relevant again (See #1629).As far as I can tell there is currently no way to read the rotation information from either the frame or the packet, or am I missing something?
What's the recommended way of checking whether the video content needs to be rotated with PyAV?
lgeiger commentedon Dec 3, 2024
The display matrix can already be read using in PyAV 14.0:
So ideally PyAV would either expose a utility function that wraps
av_display_rotation_getor introduce an API to directly read the rotation either from the frame or from from the framesside_data. @WyattBlue what do you think would be the best approach?