All Projects → xiandanin → Mediametadataretrievercompat

xiandanin / Mediametadataretrievercompat

Licence: mit
多媒体元数据兼容方案 - 支持获取图片、视频、音频文件的媒体信息、视频图片缩略图

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Mediametadataretrievercompat

dataflow-bundle
Data processing framework inspired by PortPHP
Stars: ✭ 13 (-87.74%)
Mutual labels:  frame
React Keyframes
Create frame-based animations in React
Stars: ✭ 561 (+429.25%)
Mutual labels:  frame
Mrthumb
【拇指先生】 a simple easy video thumbnail provider,顺滑的获取视频缩略图,支持本地和网络视频,有问题大胆提Issues
Stars: ✭ 60 (-43.4%)
Mutual labels:  frame
adif
用标准c语言开发的常用数据结构和算法基础库,作为应用程序开发接口基础库,为编写高性能程序提供便利,可极大地缩短软件项目的开发周期,提升工程开发效率,并确保软件系统运行的可靠性、稳定性。
Stars: ✭ 33 (-68.87%)
Mutual labels:  frame
Deviceframe
📱 Put device frames around your mobile/web/progressive app screenshots.
Stars: ✭ 507 (+378.3%)
Mutual labels:  frame
Framecarousel
A jQuery plugin for quickly creating carousels within frames
Stars: ✭ 14 (-86.79%)
Mutual labels:  frame
DashcamCleaner
Censor identifiable information in videos., in particular dashcam recordings in Germany.
Stars: ✭ 20 (-81.13%)
Mutual labels:  frame
Onenote
📚 Linux Electron Onenote - A Linux compatible version of OneNote
Stars: ✭ 1,300 (+1126.42%)
Mutual labels:  frame
Traceback with variables
Adds variables to python traceback. Simple, lightweight, controllable. Debug reasons of exceptions by logging or pretty printing colorful variable contexts for each frame in a stacktrace, showing every value. Dump locals environments after errors to console, files, and loggers. Works in Jupyter and IPython. Install with pip or conda.
Stars: ✭ 509 (+380.19%)
Mutual labels:  frame
Hls Trimming Frame Accuracy
JS Code that given a group of HLS chunks, a start timestamp, and end timestamp it creates one MP4 that contains the original V/A frame accuracy trimmed and perfectly aligned
Stars: ✭ 46 (-56.6%)
Mutual labels:  frame
frame-by-frame
Frame By Frame - Chrome Extension. Move your mouse cursor over any video and use keyboard arrows to switch frames.
Stars: ✭ 38 (-64.15%)
Mutual labels:  frame
Fg
Rendering abstraction which describes a frame as a directed acyclic graph of render tasks and resources.
Stars: ✭ 390 (+267.92%)
Mutual labels:  frame
Source two
Open Source FPV Racing Frame
Stars: ✭ 35 (-66.98%)
Mutual labels:  frame
samanemvc
PHP Framework using MVC model developped by Ngor SECK!
Stars: ✭ 32 (-69.81%)
Mutual labels:  frame
Screenadaptationkit
🎨iOS rapidScreen Compatible AdapterKit(Deprecate)
Stars: ✭ 70 (-33.96%)
Mutual labels:  frame
UWP-Flow-Frame
Flow Frame is a new and improved Frame control. This builds upon the default frame control by providing high-performance page transition animations powered by the composition layer. Fresh, new animations will be used by default, with options to configure the animations or even create your own custom animations (from scratch).
Stars: ✭ 14 (-86.79%)
Mutual labels:  frame
Pesdk Ios Examples
A fully customizable photo editor for your app.
Stars: ✭ 837 (+689.62%)
Mutual labels:  frame
Hyperapp Fx
Effects for use with Hyperapp
Stars: ✭ 105 (-0.94%)
Mutual labels:  frame
Hub
Android 开发中通过接口获取实现类,可用于module之间的通信,通过注解解决module的依赖初始化问题,良好的多线程环境下的线程安全以及性能。a concise di library which can get implementation class for a interface easily in multiple module app , also avoid check null when want to invoke a implementation by interface.
Stars: ✭ 79 (-25.47%)
Mutual labels:  frame
Gifmagic
💈 Gif maker and extractor in Swift
Stars: ✭ 38 (-64.15%)
Mutual labels:  frame

效果

     图片         音频          视频         自定义

示例APK:example-debug.apk

Gradle

//必选
implementation 'in.xiandan.mmrc:media-metadata-retriever-compat:1.2.0'

//可选,需要Exif支持时必选
implementation 'com.android.support:exifinterface:28.0.0'
//可选,需要FFmpeg支持时必选,全平台约24M
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.14'

//只保留v7a,可降低至3M
ndk {
    abiFilters 'armeabi-v7a'
}

数据源类型

datasource 中预设了一些DataSource,以提供不同的输入源,如果需要自定义数据源,可implements DataSource或参考其它数据源

设置数据源

设置数据源的操作建议放在子线程

MediaMetadataRetrieverCompat mmrc = new MediaMetadataRetrieverCompat();

//设置数据源
mmrc.setDataSource(source);
//设置数据源或抛出异常
mmrc.setDataSourceOrThrow(source);
//设置数据源或抛出异常 并指定检索器
mmrc.setDataSourceOrThrow(source, AndroidMediaMetadataRetrieverFactory.class);

获取Metadata信息

final String width = mmrc.extractMetadata(MediaMetadataKey.WIDTH);

//将值转换为int
final int width = mmrc.extractMetadataInt(MediaMetadataKey.WIDTH, 0);

//将值转换为float
final float width = mmrc.extractMetadataFloat(MediaMetadataKey.WIDTH, 0f);

//将值转换为long
final long width = mmrc.extractMetadataLong(MediaMetadataKey.WIDTH, 0L);

...

获取缩略图

取帧是耗时操作,需要放在子线程,视频有4种取帧方式

//最接近timeUs的关键帧 - 仅视频
MediaMetadataKey.OPTION_CLOSEST_SYNC

//最接近timeUs的帧,不一定是关键帧(性能开销较大) - 仅视频
MediaMetadataKey.OPTION_CLOSEST

//早于timeUs的关键帧 - 仅视频
MediaMetadataKey.OPTION_PREVIOUS_SYNC

//晚于timeUs的关键帧 - 仅视频
MediaMetadataKey.OPTION_NEXT_SYNC
//获取第一帧原尺寸图片
mmrc.getFrameAtTime();

//获取指定毫秒的原尺寸图片 注意这里传的毫秒不再是微秒
mmrc.getFrameAtTime(0, MediaMetadataKey.OPTION_CLOSEST_SYNC);

//获取指定毫秒的缩略图,并基于指定宽高缩放,输出的Bitmap不一定是指定宽高
mmrc.getScaledFrameAtTime(0, MediaMetadataKey.OPTION_CLOSEST_SYNC, 300, 300);

//获取指定毫秒的缩略图,并按指定宽高缩放裁剪,输出的Bitmap一定是指定宽高
mmrc.getCenterCropFrameAtTime(0, MediaMetadataKey.OPTION_CLOSEST_SYNC, 300, 300);

全局配置

//创建一个新的配置构造器
MediaMetadataConfig.newBuilder()
        .setCustomDataSourceCallback(new MediaMetadataConfig.CustomDataSourceCallback() {
            @Override
            public void setCustomDataSource(IMediaMetadataRetriever retriever, DataSource source) {
                //当设置了自定义数据源时 会回调
            }
        })
        //添加格式检查器
        .addFileFormatChecker(new CustomFormatChecker())
        //添加自定义检索器
        .addCustomRetrieverFactory(new SVGMediaMetadataRetrieverFactory())
        .addCustomRetrieverFactory(new CustomMediaMetadataRetrieverFactory())
        .build()
        //应用配置
        .apply();

自定义检索器

custom 演示了以SVG文件为例如何自定义检索器

MediaMetadataConfig.newBuilder()
        .addFileFormatChecker(new CustomFormatChecker())
        .addCustomRetrieverFactory(new SVGMediaMetadataRetrieverFactory())
        .build()
        .apply();

相关资料

fresco/imageformat
FFmpegMediaMetadataRetriever
MediaMetadataRetriever
ImageDecoder
ExifInterface

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].