Use to create video thumbnails any formats for Android based on FFMpeg
This is a library helps you to extract image frames at time from video of any formats supported by ffmpeg. With this library you can:
- get frame at specific time
- extract a thousand images for a few seconds
- set size for output thubmnail
- set quality thumbnails
- add watermark
- see progress in percentages
- extract frames with a custom frequency
by gradle :
dependencies {
implementation 'com.cleveroad.bootstrap:kotlin-ffmpeg-thumbnails:2.0.0'
}
Before use make sure you have added the following permission to your project
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
class FFMpegActivity : AppCompatActivity(), View.OnClickListener {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...
setClickListeners(bCreateThumbnails)
}
override fun onClick(view: View) {
when (view.id) {
R.id.bCreateThumbnails -> {
requestWriteStoragePermission {
ThumbnailsFFMpegBuilder.with(this)
.setInput(inputFilePath)
.setOutput(inputFilePath)
.setThumbnailsCount(THUMBNAILS_COUNT)
.execute({ result -> onResultThumbnails(result) },
{ error -> onError(error) },
{ progress -> onProgress(progress) })
}
}
}
}
private fun onResultThumbnails(result: Result) {
photosAdapter.apply {
clear()
addAll(result.thumbnails)
notifyDataSetChanged()
}
setProgressVisibility(false)
}
private fun onError(error: Throwable) {
error.message?.let { Log.e(TAG, it) }
}
private fun onProgress(progress: Long) {
tvProgress.text = progress.toString()
}
}
If you have any questions, issues or propositions, please create a new issue in this repository.
If you want to hire us, send an email to [email protected] or fill the form on contact page
Follow us:
The MIT License (MIT)
Copyright (c) 2016 Cleveroad Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.