This image encoder convert collections of images into compressed video format with Android and CLI interfaces.
The Image Encoder Project provides for image-to-video conversion through three main components:
- Android Application: User-friendly interface for image selection, encoding configuration, and video playback
- Image Encoder Core: Modular core logic handling the image-to-video conversion
- CLI Tool: Command-line interface powered by Picocli for terminal-based encoding
- Android app with image selection capabilities and encoding controls
- Modular architecture separating core logic from interfaces
- Command-line tool for automated batch processing
- Picocli integration for robust CLI argument handling
- Fat JAR generation via Shadow plugin
- In-app video playback capabilities
ec504_AndroidCV/
├── app/
│ ├── build.gradle.kts
│ └── src/
│ └── main/
│ ├── java/com/example/androidvideoencoder/
│ │ └── MainActivity.kt
│ ├── res/
│ │ ├── layout/
│ │ │ ├── activity_main.xml
│ │ │ └── item_image.xml
│ │ └── values/
│ │ └── strings.xml
│ └── AndroidManifest.xml
├── image-encoder-cli/
│ ├── build.gradle.kts
│ └── src/main/java/com/example/image_encoder_cli/
│ └── ImageEncoderCLI.java
├── image-encoder-core/
│ ├── build.gradle.kts
│ └── src/main/java/com/example/image_encoder_core/
│ └── ImageEncoder.java
└── gradle/
Core Stack
- Kotlin and Java
- Gradle with Kotlin DSL
- Android SDK
Plugins
- Android Gradle Plugin
- Kotlin Android Plugin
- Shadow Plugin
- Picocli
- JDK 8+
- Latest Android Studio
- Android NDK Installed
- Gradle 8.5
- Git
Clone the repository:
git clone https://github.com/yourusername/ec504_AndroidCV.git
cd ec504_AndroidCVFrom terminal run:
gradle wrapper --gradle-version 8.5 --distribution-type all-
Open in Android Studio: Launch Android Studio and open the
ec504_AndroidCVproject. -
Sync Gradle: Click on File > Sync Project with Gradle Files to resolve dependencies.
-
Build the Project: Navigate to Build > Build Project.
-
Run the App: Start an emulator, then click the Run button (This launches the app and shows two interfaces (Splash activity and Main activity)
From Terminal
-
Navigate to the Project Root:
cd ec504_AndroidCV -
Build the CLI Module:
- On Linux/Mac:
./gradlew :image-encoder-cli:shadowJar --rerun-tasks --info
- On Windows:
gradlew.bat :image-encoder-cli:shadowJar --rerun-tasks --info
Note that we only provided pre-built
libencoder_jnifor x64 Linux or ARM macOS. If you want to run the CLI on Windows you'll need to go to the native library Repository and build the native.dlllibrary following the guide and put it in the root folder of this project. - On Linux/Mac:
-
Locate the Generated JAR: After the build, the fat JAR will be located at:
image-encoder-cli/build/libs/image-encoder-cli-1.0.0.jar
Note: This jar file does not ship with the native library counterpart, so you have to put the native library in appropriate places (e.g. libencoder_jni.dylib to /usr/lib/java) for the CLI to work.
To see help information:
java -jar image-encoder-cli-1.0.0.jar --help
Intended usage of commandline below at the end of the project.
-
Ensure Java is Installed: Verify Java installation with:
java -version
-
Run the JAR File: Navigate to the directory containing the JAR file:
cd ec504_AndroidCV/image-encoder-cli/build/libs/ -
Execute the JAR with Required Arguments:
java -jar image-encoder-cli-1.0.0.jar --input /path/to/input/images --output /path/to/output/video.mpeg1 --format mpeg1 --quality 80
--inputor-i: Path to the directory containing input JPEG images.--outputor-o: Desired output file path for the encoded video.--formator-f: Video format (e.g., mpeg1, mpeg2, h264, hevc).--qualityor-q: Encoding quality (1-100).
java -jar image-encoder-cli-1.0.0.jar --input ./images --output ./videos/output_video.mpeg1 --format mpeg1 --quality 80