Add stream method to identify a video's rotation. #670
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's in this PR?
Add a stream method to easily identify the rotation of a video.
Why?
There seems to be a common confusion regarding the dimensions of a video that have been rotated. FFProbe can report the width and height as the reverse of what the video appears to have. iPhones create portrait video that exhibit this issue, for example. But by inspecting the rotation of a video, this issue can be accounted for. By providing a getRotation method alongside the getDimensions method, it will be easier for users of this library to discover the reason for their confusion.
Here are some examples of people exhibiting this confusion, sometimes with this library, sometimes with FFProbe vanilla:
#117
https://forums.creativecow.net/docs/forums/post.php?forumid=291&postid=888&univpostid=888&pview=t
https://stackoverflow.com/questions/53339787/ffmpeg-get-orientation-inverted
#199
https://stackoverflow.com/questions/13093295/how-can-i-determine-video-rotation-orientation-in-php-ffmpeg-phonegap
Here's a help page from this library that discusses the issue. This new method is self-documenting code that would assist users who go down the same rabbit hole that I did:
https://github.com/PHP-FFMpeg/PHP-FFMpeg/wiki/How-to-rotate-video-based-on-smartphone-rotate-meta-tag
Example Usage