├── sample ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── colors.xml │ │ │ │ └── styles.xml │ │ │ ├── mipmap-hdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ │ ├── ic_launcher.png │ │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-anydpi-v26 │ │ │ │ ├── ic_launcher.xml │ │ │ │ └── ic_launcher_round.xml │ │ │ ├── layout │ │ │ │ ├── row_image_list.xml │ │ │ │ └── activity_image_to_video.xml │ │ │ ├── drawable-v24 │ │ │ │ └── ic_launcher_foreground.xml │ │ │ └── drawable │ │ │ │ └── ic_launcher_background.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── daasuu │ │ │ │ └── imagetovideoandroid │ │ │ │ ├── ImageloadListener.kt │ │ │ │ ├── ImageListAdapter.kt │ │ │ │ ├── ImageLoader.kt │ │ │ │ └── MainActivity.kt │ │ └── AndroidManifest.xml │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── daasuu │ │ │ └── imagetovideoandroid │ │ │ └── ExampleUnitTest.java │ └── androidTest │ │ └── java │ │ └── com │ │ └── daasuu │ │ └── imagetovideoandroid │ │ └── ExampleInstrumentedTest.java ├── proguard-rules.pro └── build.gradle ├── imagetovideo ├── .gitignore ├── src │ └── main │ │ ├── res │ │ └── values │ │ │ └── strings.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── daasuu │ │ └── imagetovideo │ │ ├── EncodeListener.kt │ │ ├── ImageToVideoConverter.kt │ │ ├── GLOverlayDraw.kt │ │ ├── GLHelper.kt │ │ ├── MediaMuxerCaptureWrapper.kt │ │ ├── GLThread.kt │ │ ├── GLImageOverlay.kt │ │ ├── GLDraw.kt │ │ └── VideoEncoder.kt ├── build.gradle └── proguard-rules.pro ├── settings.gradle ├── art └── output.gif ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradle.properties ├── LICENSE ├── .gitignore ├── README.md ├── gradlew.bat └── gradlew /sample/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /imagetovideo/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':sample', ':imagetovideo' 2 | -------------------------------------------------------------------------------- /art/output.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MasayukiSuda/ImageToVideoAndroid/HEAD/art/output.gif -------------------------------------------------------------------------------- /imagetovideo/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ImageToVideo 3 | 4 | -------------------------------------------------------------------------------- /sample/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | ImageToVideoAndroid 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MasayukiSuda/ImageToVideoAndroid/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /imagetovideo/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MasayukiSuda/ImageToVideoAndroid/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MasayukiSuda/ImageToVideoAndroid/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MasayukiSuda/ImageToVideoAndroid/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MasayukiSuda/ImageToVideoAndroid/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MasayukiSuda/ImageToVideoAndroid/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MasayukiSuda/ImageToVideoAndroid/HEAD/sample/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MasayukiSuda/ImageToVideoAndroid/HEAD/sample/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MasayukiSuda/ImageToVideoAndroid/HEAD/sample/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MasayukiSuda/ImageToVideoAndroid/HEAD/sample/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MasayukiSuda/ImageToVideoAndroid/HEAD/sample/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sample/src/main/java/com/daasuu/imagetovideoandroid/ImageloadListener.kt: -------------------------------------------------------------------------------- 1 | package com.daasuu.imagetovideoandroid 2 | 3 | interface ImageLoadListener { 4 | 5 | fun onVideoLoaded(imagePath: List) 6 | 7 | fun onFailed(e: Exception) 8 | } 9 | -------------------------------------------------------------------------------- /sample/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Sat Oct 06 15:30:34 JST 2018 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip 7 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /sample/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /sample/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /imagetovideo/src/main/java/com/daasuu/imagetovideo/EncodeListener.kt: -------------------------------------------------------------------------------- 1 | package com.daasuu.imagetovideo 2 | 3 | interface EncodeListener { 4 | /** 5 | * Called to notify progress. 6 | * 7 | * @param progress Progress in [0.0, 1.0] range, or negative value if progress is unknown. 8 | */ 9 | fun onProgress(progress: Float) 10 | 11 | /** 12 | * Called when transcode completed. 13 | */ 14 | fun onCompleted() 15 | 16 | fun onFailed(exception: Exception) 17 | 18 | } -------------------------------------------------------------------------------- /sample/src/test/java/com/daasuu/imagetovideoandroid/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.daasuu.imagetovideoandroid; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /imagetovideo/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | 4 | android { 5 | compileSdkVersion COMPILE_SDK_VERSION as int 6 | 7 | defaultConfig { 8 | minSdkVersion COMPILE_MIN_SDK_VERSION as int 9 | targetSdkVersion COMPILE_SDK_VERSION as int 10 | versionCode VERSION_CODE as int 11 | versionName VERSION_NAME 12 | } 13 | 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | 21 | } 22 | 23 | dependencies { 24 | implementation fileTree(dir: 'libs', include: ['*.jar']) 25 | 26 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 27 | } 28 | -------------------------------------------------------------------------------- /sample/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/row_image_list.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 14 | 15 | 21 | 22 | -------------------------------------------------------------------------------- /imagetovideo/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | # IDE (e.g. Android Studio) users: 3 | # Gradle settings configured through the IDE *will override* 4 | # any settings specified in this file. 5 | # For more details on how to configure your build environment visit 6 | # http://www.gradle.org/docs/current/userguide/build_environment.html 7 | # Specifies the JVM arguments used for the daemon process. 8 | # The setting is particularly useful for tweaking memory settings. 9 | org.gradle.jvmargs=-Xmx1536m 10 | # When configured, Gradle will run in incubating parallel mode. 11 | # This option should only be used with decoupled projects. More details, visit 12 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 13 | # org.gradle.parallel=true 14 | VERSION_NAME=0.1.0 15 | VERSION_CODE=1 16 | COMPILE_SDK_VERSION=28 17 | COMPILE_MIN_SDK_VERSION=21 -------------------------------------------------------------------------------- /sample/src/androidTest/java/com/daasuu/imagetovideoandroid/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.daasuu.imagetovideoandroid; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumented test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.daasuu.imagetovideoandroid", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /sample/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Masayuki Suda 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /sample/src/main/java/com/daasuu/imagetovideoandroid/ImageListAdapter.kt: -------------------------------------------------------------------------------- 1 | package com.daasuu.imagetovideoandroid 2 | 3 | import android.content.Context 4 | import android.view.LayoutInflater 5 | import android.view.View 6 | import android.view.ViewGroup 7 | import android.widget.ArrayAdapter 8 | import android.widget.ImageView 9 | import android.widget.TextView 10 | import com.bumptech.glide.Glide 11 | 12 | internal class ImageListAdapter(context: Context, resource: Int, objects: List) : ArrayAdapter(context, resource, objects) { 13 | 14 | private val layoutInflater = context.getSystemService(Context.LAYOUT_INFLATER_SERVICE) as LayoutInflater 15 | 16 | override fun getView(position: Int, view: View?, parent: ViewGroup): View { 17 | var convertView = view 18 | val path = getItem(position) 19 | 20 | if (null == convertView) { 21 | convertView = layoutInflater.inflate(R.layout.row_image_list, null) 22 | } 23 | 24 | convertView?.let { 25 | val imageView = it.findViewById(R.id.image) 26 | val textView = it.findViewById(R.id.txt_image_name) 27 | 28 | textView.setText(path) 29 | 30 | Glide.with(context.applicationContext).load(path).into(imageView) 31 | } 32 | 33 | 34 | return convertView!! 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /sample/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | 4 | android { 5 | compileSdkVersion COMPILE_SDK_VERSION as int 6 | defaultConfig { 7 | applicationId "com.daasuu.imagetovideoandroid" 8 | minSdkVersion COMPILE_MIN_SDK_VERSION as int 9 | targetSdkVersion COMPILE_SDK_VERSION as int 10 | versionCode VERSION_CODE as int 11 | versionName VERSION_NAME 12 | 13 | 14 | 15 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 16 | } 17 | buildTypes { 18 | release { 19 | minifyEnabled false 20 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 21 | } 22 | } 23 | } 24 | 25 | dependencies { 26 | implementation fileTree(dir: 'libs', include: ['*.jar']) 27 | implementation 'com.android.support:appcompat-v7:28.0.0-rc02' 28 | implementation 'com.android.support.constraint:constraint-layout:1.1.3' 29 | testImplementation 'junit:junit:4.12' 30 | androidTestImplementation 'com.android.support.test:runner:1.0.2' 31 | androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' 32 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 33 | implementation project(':imagetovideo') 34 | 35 | implementation 'com.github.bumptech.glide:glide:4.7.1' 36 | 37 | } 38 | repositories { 39 | mavenCentral() 40 | } 41 | 42 | apply plugin: 'kotlin-android-extensions' 43 | -------------------------------------------------------------------------------- /imagetovideo/src/main/java/com/daasuu/imagetovideo/ImageToVideoConverter.kt: -------------------------------------------------------------------------------- 1 | package com.daasuu.imagetovideo 2 | 3 | import android.util.Size 4 | import java.util.concurrent.TimeUnit 5 | 6 | class ImageToVideoConverter( 7 | outputPath: String, 8 | inputImagePath: String, 9 | private val listener: EncodeListener? = null, 10 | private val size: Size = Size(720, 720), 11 | duration: Long = TimeUnit.SECONDS.toMicros(4) 12 | ) { 13 | 14 | 15 | private var imageCreateFinish = false 16 | private var startCall = false 17 | 18 | 19 | private var glThread: GLThread? = null 20 | private var muxer: MediaMuxerCaptureWrapper? = null 21 | private val drawer = GLImageOverlay(inputImagePath, size) { 22 | imageCreateFinish = true 23 | startAction() 24 | } 25 | 26 | init { 27 | muxer = MediaMuxerCaptureWrapper(outputPath, duration, listener) { 28 | stop() 29 | } 30 | } 31 | 32 | fun start() { 33 | startCall = true 34 | startAction() 35 | } 36 | 37 | private fun startAction() { 38 | if (startCall && imageCreateFinish) { 39 | try { 40 | val encoder = VideoEncoder(size, muxer) { listener?.onCompleted() } 41 | muxer?.prepare() 42 | glThread = GLThread(encoder.surface, drawer, size) { 43 | encoder.frameAvailableSoon() 44 | } 45 | glThread?.start() 46 | muxer?.startRecording() 47 | } catch (e: Exception) { 48 | listener?.onFailed(e) 49 | } 50 | } 51 | } 52 | 53 | fun stop() { 54 | muxer?.stopRecording() 55 | muxer = null 56 | 57 | glThread?.requestExitAndWait() 58 | glThread = null 59 | 60 | } 61 | 62 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # Files for the ART/Dalvik VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # Generated files 12 | bin/ 13 | gen/ 14 | out/ 15 | 16 | # Gradle files 17 | .gradle/ 18 | build/ 19 | 20 | # Local configuration file (sdk path, etc) 21 | local.properties 22 | 23 | # Proguard folder generated by Eclipse 24 | proguard/ 25 | 26 | # Log Files 27 | *.log 28 | 29 | # Android Studio Navigation editor temp files 30 | .navigation/ 31 | 32 | # Android Studio captures folder 33 | captures/ 34 | 35 | # Intellij 36 | *.iml 37 | .idea/workspace.xml 38 | .idea/tasks.xml 39 | .idea/gradle.xml 40 | .idea/dictionaries 41 | .idea/libraries 42 | 43 | # Keystore files 44 | *.jks 45 | 46 | # External native build folder generated in Android Studio 2.2 and later 47 | .externalNativeBuild 48 | 49 | # Google Services (e.g. APIs or Firebase) 50 | google-services.json 51 | 52 | # Freeline 53 | freeline.py 54 | freeline/ 55 | freeline_project_description.json 56 | 57 | 58 | .DS_Store 59 | Thumbs.db 60 | 61 | # built application files 62 | *.apk 63 | *.ap_ 64 | 65 | # files for the dex VM 66 | *.dex 67 | 68 | # Java class files 69 | *.class 70 | 71 | # gradle files 72 | .gradle 73 | 74 | # IntelliJ 75 | .idea 76 | *.iml 77 | 78 | # generated files 79 | bin/ 80 | gen/ 81 | obj/ 82 | apk/ 83 | target/ 84 | build/ 85 | app/libs/**/*.java 86 | 87 | # Local configuration file (sdk path, etc) 88 | local.properties 89 | *crashlytics-build.properties 90 | *com_crashlytics_export_strings.xml 91 | 92 | # Proguard folder generated by Eclipse 93 | proguard/ 94 | 95 | mapping.txt 96 | 97 | app/prd/release/output.json 98 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ImageToVideoAndroid 2 | [![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html) 3 | 4 | [![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=21) 5 |
6 | Easy Image to Video Converter 7 | 8 | 9 | 10 | ## Gradle 11 | Step 1. Add the JitPack repository to your build file 12 | ```groovy 13 | allprojects { 14 | repositories { 15 | ... 16 | maven { url 'https://jitpack.io' } 17 | } 18 | } 19 | ``` 20 | Step 2. Add the dependency 21 | ```groovy 22 | dependencies { 23 | implementation 'com.github.MasayukiSuda:ImageToVideoAndroid:v0.1.0' 24 | } 25 | ``` 26 | ## Usage 27 | ```Kotlin 28 | imageToVideo = ImageToVideoConverter( 29 | outputPath = outputVideoPath, 30 | inputImagePath = inputImagePath, 31 | size = Size(720, 720), 32 | duration = TimeUnit.SECONDS.toMicros(4), 33 | listener = object : EncodeListener { 34 | override fun onProgress(progress: Float) { 35 | Log.d("progress", "progress = $progress") 36 | runOnUiThread { 37 | progressBar.progress = (progress * 100).toInt() 38 | } 39 | } 40 | 41 | override fun onCompleted() { 42 | runOnUiThread { 43 | progressBar.progress = 100 44 | } 45 | } 46 | 47 | override fun onFailed(exception: Exception) { 48 | 49 | } 50 | } 51 | ) 52 | imageToVideo?.start() 53 | ``` 54 | 55 | 56 | ## Sample Dependencies 57 | * [glide](https://github.com/bumptech/glide) 58 | 59 | ## License 60 | 61 | [MIT License](https://github.com/MasayukiSuda/ImageToVideoAndroid/blob/master/LICENSE) 62 | -------------------------------------------------------------------------------- /sample/src/main/res/layout/activity_image_to_video.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 |