# videocomposemedia3 **Repository Path**: docname/videocomposemedia3 ## Basic Information - **Project Name**: videocomposemedia3 - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-25 - **Last Updated**: 2026-05-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Android NDK MediaCodec Video Compression This project provides an Android library to compress video with a real MediaCodec transcode path. ## Features - Kotlin API entrypoint: `VideoCompressManager` - Configurable params: width, height, bitrate, frameRate, iFrame interval - Real transcode: decode input video and re-encode to H.264 with target bitrate - Audio passthrough into output MP4 when enabled - Native JNI/NDK scaffold kept for future native pipeline hardening - Audio track passthrough strategy with graceful fallback signal - Unified error model and callback lifecycle ## Current Behavior - Validates compression parameters in Kotlin - Decodes source video frames with `MediaCodec` decoder - Re-encodes frames to H.264 (`video/avc`) using configured bitrate/frame rate/I-frame interval - Muxes encoded video and optional passthrough audio to MP4 ## Usage ```kotlin val manager = VideoCompressManager(context) manager.compress( VideoCompressConfig( inputPath = "/sdcard/input.mp4", outputPath = "/sdcard/output.mp4", targetWidth = 1280, targetHeight = 720, bitrate = 2_000_000, frameRate = 30, iFrameIntervalSec = 2, copyAudio = true ), object : CompressCallback { override fun onProgress(progress: Int) = println("progress=$progress") override fun onSuccess(result: CompressResult) = println("done=$result") override fun onError(error: CompressionError, message: String) = println("$error: $message") } ) ``` ## Error Handling - `INVALID_ARG` - `CODEC_INIT_FAILED` - `MUX_FAILED` - `INTERNAL_ERROR` ## Notes - Min SDK: 26 - This scaffold is intended for iterative hardening and device-level validation.