[FFmpeg-trac] #8659(avdevice:new): av_display_rotation_set() has no effect in android_camera
FFmpeg
trac at avcodec.org
Thu May 7 18:44:44 EEST 2020
#8659: av_display_rotation_set() has no effect in android_camera
----------------------------------------+----------------------------------
Reporter: juha-h | Type: defect
Status: new | Priority: normal
Component: avdevice | Version: 4.2
Keywords: android_camera | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
----------------------------------------+----------------------------------
I'm using ffmpeg android_camera device as video source in my open source
baresip VoIP app.
If I make a call by holding the device upright (portrait), video from the
front facing camera of the device has been rotated clockwise 90 degrees
from portrait orientation.
libavdevice/android_camera.c has this piece of code related to rotation:
av_display_rotation_set(display_matrix, ctx->sensor_orientation);
if (ctx->lens_facing == ACAMERA_LENS_FACING_FRONT) {
av_display_matrix_flip(display_matrix, 1, 0);
}
I added debug to it and found that ctx->sensor_orientation has value
270.0. It is correct value, since according to Android reference
CameraCharacteristics.SENSOR_ORIENTATION means:
The orientation of the camera image. The value is the angle that the
camera image needs to be rotated clockwise so it shows correctly on
the display in its natural orientation. It should be 0, 90, 180, or
270.
If av_display_rotation_set(display_matrix, ctx->sensor_orientation) call
would work correctly, 90 + 270 = 360, and rotation of the video from the
camera would be as it should be, i.e., upright. Now it is 90 degrees from
portrait, i.e., av_display_rotation_set() has no effect.
I made more tests by replacing ctx->sensor_orientation argument with
various constant values, eg. 0.0, 90.0, 180.0, etc, and noticed that the
call has no effect: video is always rotated 90 degrees from portrait.
So, I'm suspecting that there is a bug, which causes
av_display_rotation_set() call to have no effect in android_camera.c.
If needed I'm ready to make more tests and try possible patches.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/8659>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list