FFmpegMediaMetadataRetriever


Source link: https://github.com/wseemann/FFmpegMediaMetadataRetriever

FFmpegMediaMetadataRetriever

View the project page 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. Your donation is highly appreciated (and I love food and coffee). Thank you!

PayPal

  • Donate 5 $: Thank's for creating this project, here's a coffee for you!
  • Donate 10 $: Wow, I am stunned. Let me take you to the movies!
  • Donate 15 $: I really appreciate your work, let's grab some lunch!
  • Donate 25 $: That's some awesome stuff you did right there, dinner is on me!
  • Donate 50 $: I really really want to support this project, great job!
  • Donate 100 $: You are the man! This project saved me hours (if not days) of struggle and hard work, simply awesome!
  • Of course, you can also 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.

Key Features:

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)

Using FMMR in your application (Android Studio)

Add the following maven dependency to your project's build.gradle file:

dependencies {

  compile 'com.github.wseemann:FFmpegMediaMetadataRetriever:1.0.14' 
}
 

Optionally, to support individual ABIs:

dependencies {

  compile 'com.github.wseemann:FFmpegMediaMetadataRetriever-armeabi:1.0.14'
  compile 'com.github.wseemann:FFmpegMediaMetadataRetriever-armeabi-v7a:1.0.14'
  compile 'com.github.wseemann:FFmpegMediaMetadataRetriever-x86:1.0.14'
  compile 'com.github.wseemann:FFmpegMediaMetadataRetriever-mips:1.0.14'
  compile 'com.github.wseemann:FFmpegMediaMetadataRetriever-x86_64:1.0.14'
  compile 'com.github.wseemann:FFmpegMediaMetadataRetriever-arm64-v8a:1.0.14' 
}
 

or, if your application supports individual architectures extract the appropriate AAR file into you projects "libs" folder:

Prebuilt AARs

(with HTTPS support)

Prebuilt AARs with HTTPS

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 FFmpegMediaMetadataRetriever/fmmr-library/ 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:

ndk.dir=<path to NDK> 

where is the path to your Android NDK, for example:

ndk.dir=/home/wseemann/Android/android-ndk-r11c 

Note: If you wish to enable https support (for use with API 8+ only) navigate to FFmpegMediaMetadataRetriever/fmmr-library/ and execute

ant build-ffmpeg-with-ssl 

To compile the library in Android Studio, highlight library in the project explorer and run Build->Make Module 'library'. 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 FFmpeg licensed under the LGPLv2.1 and its source can be downloaded here.

License

FFmpegMediaMetadataRetriever: A unified interface for retrieving frame  and meta data from an input media file.  Copyright 2017 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. 

Resources

Layout inflation library for Android which uses annotation processing to write the code you don't want to write and simplify your compound views.

Use the annotation @AfterInflate on your compound view's methods you want to run straight after the layout is inflated with Michelangelo.

TextChronometer is a very simple library offering a widget showing a live time formatted like "4 seconds ago": This library is very convenient if you are building apps with a live timeline.

A TextView that simulates the effect from the app Secret where the characters fade in/out at different speeds.

An animated path view following the methods in a blog post.

A highly configurable section based layout manager with headers and all that.

Features:

  • Section Headers
    • Sticky headers
    • Headers in content margins
    • Header overlays
  • Individual layouts for each section at the same time
    • Linear
    • Grid not yet implemented
    • Staggered Grid not yet implemented

A file picker fragment for Android that can be embedded in your app.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes