[FFmpeg-user] rotation of video from android_camera

Juha Heinanen jh at tutpro.com
Mon Apr 27 18:33:32 EEST 2020


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 is sent in landscape orientation
rotated clockwise 90 degrees from portrait orientation.

I added some debug into the app and found that
CameraCharacteristics.SENSOR_ORIENTATION has always value 270.  Android
reference tells this about that characteristics:

  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 android_camera device would rotate the video clockwise by that
amount (270), orientation of the video would be correct.  There is this
in android_camera.c:

  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);
  }


Any idea why the rotation does not happen?

-- Juha


More information about the ffmpeg-user mailing list