vicmns
vicmns

Reputation: 724

Android get video rotation from metatags

currently I am using the Android MediaMetadataRetriever class in order to get the video rotation tag from a MP4 file, using the MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION tag. The main drawback of this, is that is only compatible with API level 17 and up, and the minimum supported API level desired for the application is 14.

Is there any work around for this, I tried using the ffmpeg library that used in the project, but I did not find an option to get this tag from the video.

Thanks in advance.

Upvotes: 2

Views: 2385

Answers (2)

William Seemann
William Seemann

Reputation: 3530

The latest version of FFmpegMediaMetadataRetriever has support for the METADATA_KEY_VIDEO_ROTATION tag, I recommend trying that library.

Upvotes: 1

vicmns
vicmns

Reputation: 724

Well, It turn outs that ffmpeg does actually returns the Rotation from the metadata info of the video using the -i option:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'original180.mp4':
Metadata:
 major_brand     : isom
 minor_version   : 0
  compatible_brands: isom3gp4
  creation_time   : 2013-11-05 23:34:58
  Duration: 00:00:24.11, start: 0.000000, bitrate: 16896 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080, 17008 kb/s, SAR 1:1 DAR 16:9, 29.96 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
Metadata:
  rotate          : 180
  creation_time   : 2013-11-05 23:34:58
  handler_name    : VideoHandle
Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 122 kb/s (default)
Metadata:
  creation_time   : 2013-11-05 23:34:58
  handler_name    : SoundHandle

Hope it helps someone.

Upvotes: 1

Related Questions