FFmpegMediaMetadataRetriever
FFmpegMediaMetadataRetriever provides a unified interface for retrieving frame and meta data from an input media file.
Top Related Projects
This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.
Android开源弹幕引擎·烈焰弹幕使 ~
视频播放器(IJKplayer、ExoPlayer、MediaPlayer),HTTPS,16k page size,支持弹幕,外挂字幕,支持滤镜、水印、gif截图,片头广告、中间广告,多个同时播放,支持基本的拖动,声音、亮度调节,支持边播边缓存,支持视频自带rotation的旋转(90,270之类),重力旋转与手动旋转的同步支持,支持列表播放 ,列表全屏动画,视频加载速度,列表小窗口支持拖动,动画效果,调整比例,多分辨率切换,支持切换播放器,进度条小窗口预览, 列表切换详情页面无缝播放,rtsp、concat、mpeg。
Infinite cycle ViewPager with two-way orientation and interactive effect.
Image Cropping Library for Android
Quick Overview
FFmpegMediaMetadataRetriever is an Android library that wraps FFmpeg, providing a simple way to retrieve metadata and frame captures from media files. It supports a wide range of audio and video formats, making it a powerful tool for Android developers working with multimedia content.
Pros
- Supports a vast array of audio and video formats due to FFmpeg integration
- Provides easy access to metadata and frame captures from media files
- Works with both local files and remote URLs
- Regularly updated and maintained
Cons
- Large library size due to FFmpeg inclusion
- May require additional configuration for certain Android architectures
- Learning curve for developers unfamiliar with FFmpeg concepts
- Potential licensing considerations due to FFmpeg integration
Code Examples
- Retrieving metadata from a media file:
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
mmr.setDataSource(path);
String artist = mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ARTIST);
String title = mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_TITLE);
mmr.release();
- Extracting a frame from a video file:
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
mmr.setDataSource(path);
Bitmap bitmap = mmr.getFrameAtTime(2000000, FFmpegMediaMetadataRetriever.OPTION_CLOSEST);
mmr.release();
- Retrieving audio waveform data:
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
mmr.setDataSource(path);
byte[] waveform = mmr.getEmbeddedPicture();
mmr.release();
Getting Started
- Add the following to your app's
build.gradle
:
dependencies {
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.15'
}
- Initialize and use the FFmpegMediaMetadataRetriever in your code:
import wseemann.media.FFmpegMediaMetadataRetriever;
// In your activity or fragment
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
mmr.setDataSource(mediaPath);
// Use mmr to retrieve metadata or frames
mmr.release(); // Don't forget to release when done
Competitor Comparisons
This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
Pros of ExoPlayer
- More comprehensive media playback solution, supporting various formats and streaming protocols
- Actively maintained by Google, ensuring regular updates and improvements
- Extensive documentation and community support
Cons of ExoPlayer
- Larger library size, potentially increasing app size
- Steeper learning curve due to its extensive feature set
- May be overkill for simple metadata retrieval tasks
Code Comparison
FFmpegMediaMetadataRetriever:
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
mmr.setDataSource(path);
String title = mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_TITLE);
mmr.release();
ExoPlayer:
SimpleExoPlayer player = new SimpleExoPlayer.Builder(context).build();
MediaItem mediaItem = MediaItem.fromUri(uri);
player.setMediaItem(mediaItem);
player.prepare();
MediaMetadata metadata = player.getMediaMetadata();
String title = metadata.title;
Summary
ExoPlayer is a more robust solution for media playback and metadata retrieval, offering extensive features and ongoing support from Google. However, FFmpegMediaMetadataRetriever may be more suitable for simpler projects focused primarily on metadata extraction, as it has a smaller footprint and a more straightforward API. The choice between the two depends on the specific requirements of your project and the level of complexity you're willing to manage.
Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.
Pros of ijkplayer
- More comprehensive media player solution, offering video playback capabilities
- Supports a wider range of formats and protocols
- Provides a customizable UI for video playback
Cons of ijkplayer
- Larger library size and potentially higher resource usage
- More complex integration due to its broader feature set
- May require more frequent updates to keep up with FFmpeg changes
Code Comparison
FFmpegMediaMetadataRetriever:
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
mmr.setDataSource(url);
String title = mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_TITLE);
mmr.release();
ijkplayer:
IjkMediaPlayer player = new IjkMediaPlayer();
player.setDataSource(url);
player.prepareAsync();
player.start();
player.release();
Summary
FFmpegMediaMetadataRetriever focuses on metadata extraction, while ijkplayer is a full-featured media player. ijkplayer offers more comprehensive playback capabilities but comes with increased complexity and resource usage. FFmpegMediaMetadataRetriever is more lightweight and specialized for metadata retrieval. The choice between the two depends on whether you need full playback functionality or just metadata extraction.
Android开源弹幕引擎·烈焰弹幕使 ~
Pros of DanmakuFlameMaster
- Specialized for rendering danmaku (bullet comments) on video players
- Optimized for high-performance rendering of large numbers of comments
- Supports various danmaku styles and effects
Cons of DanmakuFlameMaster
- Limited to danmaku functionality, not a general-purpose media metadata tool
- May require additional integration for full video playback features
- Less suitable for projects not focused on danmaku or Asian-style video platforms
Code Comparison
FFmpegMediaMetadataRetriever:
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
mmr.setDataSource(path);
String title = mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_TITLE);
mmr.release();
DanmakuFlameMaster:
IDanmakuView danmakuView = (IDanmakuView) findViewById(R.id.sv_danmaku);
BaseDanmakuParser parser = createParser(this.getResources().openRawResource(R.raw.comments));
danmakuView.prepare(parser, danmakuContext);
danmakuView.showFPS(true);
danmakuView.enableDanmakuDrawingCache(true);
FFmpegMediaMetadataRetriever focuses on extracting metadata from media files, while DanmakuFlameMaster is designed for rendering danmaku comments on video players. The code examples highlight their different purposes: FFmpegMediaMetadataRetriever retrieves metadata, while DanmakuFlameMaster sets up a danmaku view for displaying comments.
视频播放器(IJKplayer、ExoPlayer、MediaPlayer),HTTPS,16k page size,支持弹幕,外挂字幕,支持滤镜、水印、gif截图,片 头广告、中间广告,多个同时播放,支持基本的拖动,声音、亮度调节,支持边播边缓存,支持视频自带rotation的旋转(90,270之类),重力旋转与手动旋转的同步支持,支持列表播放 ,列表全屏动画,视频加载速度,列表小窗口支持拖动,动画效果,调整比例,多分辨率切换,支持切换播放器,进度条小窗口预览,列表切换详情页面无缝播放,rtsp、concat、mpeg。
Pros of GSYVideoPlayer
- More comprehensive video player solution with a wide range of features
- Supports multiple video formats and streaming protocols
- Offers customizable UI components and gestures for playback control
Cons of GSYVideoPlayer
- Larger library size due to its extensive feature set
- May have a steeper learning curve for basic metadata retrieval tasks
- Potentially higher resource usage for simple metadata extraction scenarios
Code Comparison
FFmpegMediaMetadataRetriever:
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
mmr.setDataSource(videoPath);
String title = mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_TITLE);
mmr.release();
GSYVideoPlayer:
GSYVideoOptionBuilder gsyVideoOption = new GSYVideoOptionBuilder();
gsyVideoOption.setIsTouchWiget(true)
.setRotateViewAuto(false)
.setLockLand(false)
.setShowFullAnimation(false)
.setNeedLockFull(true)
.setUrl(videoUrl)
.setCacheWithPlay(false)
.setVideoTitle("Video Title")
.build(videoPlayer);
Summary
FFmpegMediaMetadataRetriever is focused on metadata extraction, making it lightweight and efficient for specific tasks. GSYVideoPlayer offers a full-featured video player solution with extensive customization options, but may be overkill for simple metadata retrieval. Choose based on your project's requirements: FFmpegMediaMetadataRetriever for metadata-centric tasks, or GSYVideoPlayer for a complete video playback experience.
Infinite cycle ViewPager with two-way orientation and interactive effect.
Pros of InfiniteCycleViewPager
- Specialized for creating infinite, cyclic view pagers with smooth animations
- Offers customizable transformations and scroll effects
- Provides a more visually appealing and interactive user experience
Cons of InfiniteCycleViewPager
- Limited to view paging functionality, not a general-purpose media tool
- May require more setup and customization for specific use cases
- Less actively maintained (last update was several years ago)
Code Comparison
FFmpegMediaMetadataRetriever:
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
mmr.setDataSource(path);
String title = mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_TITLE);
mmr.release();
InfiniteCycleViewPager:
InfiniteCycleViewPager infiniteCycleViewPager = findViewById(R.id.infinite_cycle_view_pager);
infiniteCycleViewPager.setAdapter(new MyPagerAdapter(this));
infiniteCycleViewPager.setScrollDuration(500);
infiniteCycleViewPager.setInterpolator(new AccelerateDecelerateInterpolator());
Summary
FFmpegMediaMetadataRetriever is a powerful tool for extracting metadata from media files, while InfiniteCycleViewPager focuses on creating visually appealing, infinite-scrolling view pagers. The former is more suited for media processing tasks, while the latter is ideal for creating engaging user interfaces with cyclic content navigation.
Image Cropping Library for Android
Pros of uCrop
- Specialized for image cropping and rotation with a user-friendly interface
- Supports gesture controls for intuitive image manipulation
- Offers customizable aspect ratios and overlay grids
Cons of uCrop
- Limited to image processing, lacking audio or video capabilities
- Requires more manual user interaction for editing tasks
- May have higher memory usage due to image processing operations
Code Comparison
uCrop:
UCrop.of(sourceUri, destinationUri)
.withAspectRatio(16, 9)
.withMaxResultSize(maxWidth, maxHeight)
.start(this);
FFmpegMediaMetadataRetriever:
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
mmr.setDataSource(path);
Bitmap b = mmr.getFrameAtTime(2000000, FFmpegMediaMetadataRetriever.OPTION_CLOSEST);
mmr.release();
Summary
uCrop excels in image cropping and rotation, offering a user-friendly interface with gesture controls. It's ideal for applications focused on image editing. However, it lacks audio and video processing capabilities.
FFmpegMediaMetadataRetriever, on the other hand, is more versatile, supporting various media types including audio and video. It's better suited for applications requiring comprehensive media metadata extraction and frame retrieval.
Choose uCrop for dedicated image cropping functionality, or FFmpegMediaMetadataRetriever for broader media processing needs.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
FFmpegMediaMetadataRetriever
View the project page <a href=http://wseemann.github.io/FFmpegMediaMetadataRetriever/>here.
Donations
Donations can be made via PayPal:
This project needs you! If you would like to support this project's further development, the creator of this project or the continuous maintenance of this project, feel free to donate. Donations are highly appreciated. Thank you!
PayPal
- Choose what you want to donate, all donations are awesome!
Overview
FFmpegMediaMetadataRetriever is a reimplementation of Android's MediaMetadataRetriever class. The FFmpegMediaMetadataRetriever class provides a unified interface for retrieving frame and meta data from an input media file and uses FFmpeg as its backend.
This project uses FFmpeg version 4.2.2.
Key Features:
- ARMv7, x86, x86_64 and ARM_64 support (Note: ARM and MIPS aren't supported as of version 1.0.14)
- Support for API 16+
- URL support (Unlike MediaMetadataRetriever, see: http://code.google.com/p/android/issues/detail?id=35794)
Supported protocols:
- file, http, https, mms, mmsh and rtmp
Supported formats (audio and video):
- aac, acc+, avi, flac, mp2, mp3, mp4, ogg, 3gp and more!
Additional support for:
- ICY Metadata (SHOUTcast metadata)
Demo Application
If you would like to try FFmpegMediaMetadataRetriever you can do so using the Demo Application
Using FMMR in your application (Android Studio)
Add the following maven dependency to your project's build.gradle
file:
dependencies {
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-core:1.0.19'
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-native:1.0.19'
}
Optionally, to support individual ABIs:
dependencies {
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-core:1.0.19'
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-native-armeabi-v7a:1.0.19'
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-native-x86:1.0.19'
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-native-x86_64:1.0.19'
implementation 'com.github.wseemann:FFmpegMediaMetadataRetriever-native-arm64-v8a:1.0.19'
}
or, if your application supports individual architectures extract the appropriate AAR file into you projects "libs" folder:
Demo Application
A sample application that makes use of FFmpegMediaMetadataRetriever can be downloaded here. Note: The sample application is compiled with support for ALL available formats. This results in a larger library and APK. FFmpeg can be recompiled with a subset of codecs enabled for those wanting a smaller size.
Installation
FFmpegMediaMetadataRetriever relies on FFmpeg and native code. The build process is complex and may be confusing for those unfamiliar the Android NDK. For this reason I've precompiled AARs created by the build process and checked them in here. The modules are also included with the library. If you don't want to build the modules you can simple unzip the prebuilt ones and copy them to your projects "libs" folder. (Note: copy them to YOUR projects "libs" folder, NOT the "libs" folder located in FFmpegMediaMetadataRetriever/fmmr-library. Once this step is complete you can use the library (See: Installation in Eclipse (Kepler)). If you want to compile the modules yourself follow the Ant instructions listed below before attempting to use the library.
Download and install the Android SDK. Download the Android NDK. Clone/Download/Fork the repo through GitHub or via (read-only)
git clone https://github.com/wseemann/FFmpegMediaMetadataRetriever.git
Android Studio (Gradle)
Note: The build instructions and scripts assume you are running Unix or Linux. Building on other operating systems is currently not supported.
Execute the following in the root project directory (assuming /path/to/android_sdk/tools is in your PATH):
android update project --path .
Open the newly created local.properties file and add the following lines:
sdk.dir=<path to SDK>
ndk.dir=<path to NDK>
where
sdk.dir=/Users/wseemann/Library/Android/sdk
where
ndk.dir=/home/wseemann/Android/android-ndk-r20
To compile the library in Android Studio, highlight core
in the project explorer and run Build->Make Module 'core'. This will also build the native FFmpeg binaries.
Usage
Sample code:
FFmpegMediaMetadataRetriever mmr = new FFmpegMediaMetadataRetriever();
mmr.setDataSource(mUri);
mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ALBUM);
mmr.extractMetadata(FFmpegMediaMetadataRetriever.METADATA_KEY_ARTIST);
Bitmap b = mmr.getFrameAtTime(2000000, FFmpegMediaMetadataRetriever.OPTION_CLOSEST); // frame at 2 seconds
byte [] artwork = mmr.getEmbeddedPicture();
mmr.release();
FFmpeg
This software uses code of <a href=http://ffmpeg.org>FFmpeg licensed under the <a href=http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html>LGPLv2.1 and its source can be downloaded <a href=https://www.ffmpeg.org/developer.html>here.
License
FFmpegMediaMetadataRetriever: A unified interface for retrieving frame
and meta data from an input media file.
Copyright 2022 William Seemann
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Top Related Projects
This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.
Android开源弹幕引擎·烈焰弹幕使 ~
视频播放器(IJKplayer、ExoPlayer、MediaPlayer),HTTPS,16k page size,支持弹幕,外挂字幕,支持滤镜、水印、gif截图,片头广告、中间广告,多个同时播放,支持基本的拖动,声音、亮度调节,支持边播边缓存,支持视频自带rotation的旋转(90,270之类),重力旋转与手动旋转的同步支持,支持列表播放 ,列表全屏动画,视频加载速度,列表小窗口支持拖动,动画效果,调整比例,多分辨率切换,支持切换播放器,进度条小窗口预览,列表切换详情页面无缝播放,rtsp、concat、mpeg。
Infinite cycle ViewPager with two-way orientation and interactive effect.
Image Cropping Library for Android
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot