FFmpeg cap consider rotation metadata 3.4#17489
Conversation
modules/videoio/src/cap_ffmpeg.cpp
Outdated
| return; | ||
| } | ||
| int angle = ffmpegCapture->rotation_angle; | ||
| if(!ffmpegCapture->rotation_auto || (angle % 360) == 0) { |
There was a problem hiding this comment.
OpenCV build for Windows used FFmpeg through dedicated wrapper DLL and internal fields are not visible. You have to use getProperty method to get values.
d52c1b9 to
60ecd75
Compare
|
Is it allowed to change the declaration of So, now it able to build, but some tests fail. I do not know where I can get testing video samples and how to run the tests. Please give me the introduction info about this |
|
i checked FFmpeg version and it looks like the rotation metadata is not supported by libav in Ubuntu 14.04. It's used for 3.4 testing. It looks like we need another branch inside FFmpeg code or skip the test for old systems. I'll check and come up with solution in mean time. |
|
Hi @asmorkalov, You can delegate it to me if you have not enough time |
|
@Lapshin Sorry for delay. I investigated FFmpeg API and options to support libAV on Ubuntu 14.04. It looks like public API for ROTATIONMATRIX appeared in FFmpeg (libAV) in 2014 and is not present in the old Ubuntu. I'm discussing options with alalek and team members and return back in mean time. |
32912e8 to
7423983
Compare
|
Your changes are good for me |
|
Ci build for Windows does not re-build FFmpeg warpper each time, but use old version. We added extra fields to classes and it leads to binary incompatibly. I'm looking on the issue right now. |
|
@Lapshin I moved rotation step to |
|
Thank you, @asmorkalov. You did it :) |
|
@alalek The patch is ready for integration with squash. I fixed Windows test failure and related warnings. Windows builds will report "not supported" till FFmpeg wrapper rebuild. |
|
@mshabunin Could you look at it. |
|
@asmorkalov , could you please squash commits into two to preserve authors. |
- Add VideoCapture camera orientation property for mp4 videos with camera orientation meta. - Add auto rotation for 90, 180, 270 degrees using cv::rotate
- Added test for automated rotation for MP4 videos with metadata - Fix 180 degrees rotation bug - Moved rotation logic to cv::VideoCapture implementation for FFmpeg and restore binary compatibility with FFmpeg wrapper.
52c8ca3 to
7ed37b3
Compare
|
@mshabunin Done. |
|
@asmorkalov , thank you. Do we need to port this feature to master branch? |
|
Yes, I expect that it can be merged as is with regular 3.4->master merge. Please let me know, if manual port is needed. I'll do it. |
| return; | ||
| } | ||
|
|
||
| cv::rotate(mat, mat, flag); |
There was a problem hiding this comment.
cv::Mat / cv::rotate is not available for FFmpeg wrapper on 3.4 branch.
Build of Windows wrapper is broken
Pull Request Readiness Checklist
Relates to #15499
Duplicates commit of #17452
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Patch to opencv_extra has the same branch name.