Android 获取播放视频的相关 内容, 分辨率, 方向,作者信息
来源:互联网 发布:软件设计师2016下半年 编辑:程序博客网 时间:2024/06/08 09:59
MediaMetadataRetriever retr = new MediaMetadataRetriever(); retr.setDataSource(videoPath); String height = retr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT); // 视频高度 String width = retr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH); // 视频宽度 String rotation = retr.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_ROTATION); // 视频旋转方向
还有 很多的信息 可以获取
需要注意的时, 获取到的 都是String 类型 需要自己转换成 相应类型 建议转换成 float
应为 即使是整数,转成float 也没有问题 但是小数string 转 int 就有问题而来
/** * The metadata key to retrieve the numeric string describing the * order of the audio data source on its original recording. */ public static final int METADATA_KEY_CD_TRACK_NUMBER = 0; /** * The metadata key to retrieve the information about the album title * of the data source. */ public static final int METADATA_KEY_ALBUM = 1; /** * The metadata key to retrieve the information about the artist of * the data source. */ public static final int METADATA_KEY_ARTIST = 2; /** * The metadata key to retrieve the information about the author of * the data source. */ public static final int METADATA_KEY_AUTHOR = 3; /** * The metadata key to retrieve the information about the composer of * the data source. */ public static final int METADATA_KEY_COMPOSER = 4; /** * The metadata key to retrieve the date when the data source was created * or modified. */ public static final int METADATA_KEY_DATE = 5; /** * The metadata key to retrieve the content type or genre of the data * source. */ public static final int METADATA_KEY_GENRE = 6; /** * The metadata key to retrieve the data source title. */ public static final int METADATA_KEY_TITLE = 7; /** * The metadata key to retrieve the year when the data source was created * or modified. */ public static final int METADATA_KEY_YEAR = 8; /** * The metadata key to retrieve the playback duration of the data source. */ public static final int METADATA_KEY_DURATION = 9; /** * The metadata key to retrieve the number of tracks, such as audio, video, * text, in the data source, such as a mp4 or 3gpp file. */ public static final int METADATA_KEY_NUM_TRACKS = 10; /** * The metadata key to retrieve the information of the writer (such as * lyricist) of the data source. */ public static final int METADATA_KEY_WRITER = 11; /** * The metadata key to retrieve the mime type of the data source. Some * example mime types include: "video/mp4", "audio/mp4", "audio/amr-wb", * etc. */ public static final int METADATA_KEY_MIMETYPE = 12; /** * The metadata key to retrieve the information about the performers or * artist associated with the data source. */ public static final int METADATA_KEY_ALBUMARTIST = 13; /** * The metadata key to retrieve the numberic string that describes which * part of a set the audio data source comes from. */ public static final int METADATA_KEY_DISC_NUMBER = 14; /** * The metadata key to retrieve the music album compilation status. */ public static final int METADATA_KEY_COMPILATION = 15; /** * If this key exists the media contains audio content. */ public static final int METADATA_KEY_HAS_AUDIO = 16; /** * If this key exists the media contains video content. */ public static final int METADATA_KEY_HAS_VIDEO = 17; /** * If the media contains video, this key retrieves its width. */ public static final int METADATA_KEY_VIDEO_WIDTH = 18; /** * If the media contains video, this key retrieves its height. */ public static final int METADATA_KEY_VIDEO_HEIGHT = 19; /** * This key retrieves the average bitrate (in bits/sec), if available. */ public static final int METADATA_KEY_BITRATE = 20; /** * This key retrieves the language code of text tracks, if available. * If multiple text tracks present, the return value will look like: * "eng:chi" * @hide */ public static final int METADATA_KEY_TIMED_TEXT_LANGUAGES = 21; /** * If this key exists the media is drm-protected. * @hide */ public static final int METADATA_KEY_IS_DRM = 22; /** * This key retrieves the location information, if available. * The location should be specified according to ISO-6709 standard, under * a mp4/3gp box "@xyz". Location with longitude of -90 degrees and latitude * of 180 degrees will be retrieved as "-90.0000+180.0000", for instance. */ public static final int METADATA_KEY_LOCATION = 23; /** * This key retrieves the video rotation angle in degrees, if available. * The video rotation angle may be 0, 90, 180, or 270 degrees. */ public static final int METADATA_KEY_VIDEO_ROTATION = 24; /** * This key retrieves the original capture framerate, if it's * available. The capture framerate will be a floating point * number. */ public static final int METADATA_KEY_CAPTURE_FRAMERATE = 25;
2 0
- Android 获取播放视频的相关 内容, 分辨率, 方向,作者信息
- Android获取手机分辨率 和屏幕的方向
- 获取优酷视频作者信息接口
- Android 获取视频缩略图的 与播放视频的冲突
- 查看视频播放时的分辨率
- android获取手机屏幕的宽高,水平,竖直方向的分辨率,测试手机属于哪种分辨率
- Android 获取视频缩略图以及获取视频分辨率
- Android--电池相关信息的获取
- 【Android】获取手机的相关硬件信息
- 【Android】获取手机的相关硬件信息
- Android获取系统相关的信息
- 获取android手机的相关信息
- Android 获取手机的相关硬件信息
- Android 获取手机信息相关的方法
- 视频播放相关的协议
- Java获取视频的相关信息,并获取指定时间的视频图片
- android 获取手机屏幕分辨率和setRequestedOrientation设置屏幕方向
- android 获取手机屏幕分辨率和setRequestedOrientation设置屏幕方向
- ConcurrentHashMap笔记
- 浅谈程序员
- UI - UIRefreshControl
- 绘图 - 5
- APUE学习之----进程通信实现消息队列
- Android 获取播放视频的相关 内容, 分辨率, 方向,作者信息
- hdoj Big Number 1212 (大数取余) 水
- iOS在控制器中绘制圆形图像,二维码
- 23种设计模式C++实例之概述
- ARC下会导致内存泄漏的情况
- typedef定义函数类型
- 使用get请求下载文件的时候,由于地址栏用的是iso-8859-1编码格式产生乱码,得到不正确的值
- 自己动手“敲”微软100题系列二
- Java字符编码根本原理