A powerful and easy-to-use Android video compression library using MediaCodec. Generates compressed MP4 with configurable resolution, bitrate, and codec while maintaining good visual quality.
Add the JitPack repository to your settings.gradle:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}Add the dependency in your module-level build.gradle:
implementation 'com.github.davotoula:LightCompressor-enhanced:Tag'You also need Kotlin coroutines:
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutines_version"import com.davotoula.lightcompressor.VideoCompressor
import com.davotoula.lightcompressor.VideoQuality
import com.davotoula.lightcompressor.config.Configuration
import com.davotoula.lightcompressor.config.SharedStorageConfiguration
import com.davotoula.lightcompressor.config.SaveLocation
import com.davotoula.lightcompressor.listener.CompressionListener
val compression = VideoCompressor.start(
context = applicationContext,
uris = listOf(videoUri),
isStreamable = true,
storageConfiguration = SharedStorageConfiguration(
saveAt = SaveLocation.MOVIES,
subFolderName = "my-videos"
),
configureWith = Configuration(
videoNames = listOf("output.mp4"),
quality = VideoQuality.MEDIUM,
isMinBitrateCheckEnabled = true,
disableAudio = false,
),
listener = object : CompressionListener {
override fun onStart(index: Int) {
// Compression started
}
override fun onProgress(index: Int, percent: Float) {
// Update progress UI (worker thread — post to main thread if needed)
}
override fun onSuccess(index: Int, size: Long, path: String?) {
// Compression finished; path is the output file location
}
override fun onFailure(index: Int, failureMessage: String) {
// Handle error
}
override fun onCancelled(index: Int) {
// Compression was cancelled
}
}
)
// To cancel this start() call's videos only:
compression.cancel()
// To cancel every running compression:
VideoCompressor.cancel()Cancelling: start() returns a CompressionHandle. Its cancel() stops the videos of that start() call still in progress, including videos that haven't started yet, and leaves other start() calls running; calling it after the call has finished does nothing. VideoCompressor.cancel() does the same for every start() call in progress. Each cancelled video gets onCancelled, so every video ends in exactly one of onSuccess, onFailure or onCancelled; a video that had already finished keeps its result. A start() made after a cancel runs normally.
Encoder stalls: a device's hardware encoder can occasionally stop producing output partway through a job (seen with Samsung Exynos HEVC encoders while other apps hold hardware video codecs). If the encoder produces nothing for 10 seconds while it has frames to encode, the library releases it: the job ends through onFailure with a message saying the video encoder stopped responding, rather than hanging, and cancel() still works during the stall. There is no automatic retry; a later attempt usually succeeds. In HLS preparation the stalled rendition fails and the remaining renditions continue.
- H.264 (AVC) and H.265 (HEVC) codec support
- Flexible
VideoResizerAPI for resolution control:VideoResizer.auto— auto-resize based on original dimensionsVideoResizer.scale(0.5)— scale by percentageVideoResizer.limitSize(1920.0)— limit longest side (landscape-oriented bounding box)VideoResizer.limitSize(1920.0, 1080.0)— limit width and height independentlyVideoResizer.limitShortSide(1080.0)— constrain the shorter dimension, orientation-agnostic (preferred for portrait/landscape-neutral targeting)VideoResizer.limitShortSide(1920.0, 1080.0)— same as above, uses the smaller of the two valuesVideoResizer.matchSize(1920.0, 1080.0)— scale to match target dimensions exactly
- GIF to MP4 conversion
- Streamable output (moov atom moved for progressive download)
- Granular bitrate control: specify in Mbps (
videoBitrateInMbps) or bps (videoBitrateInBps) - Audio control (
disableAudio) - Native Android
MediaMuxer(no third-party MP4 muxer)
| Quality | Bitrate multiplier |
|---|---|
| VERY_HIGH | 0.6x original |
| HIGH | 0.4x original |
| MEDIUM | 0.3x original |
| LOW | 0.2x original |
| VERY_LOW | 0.1x original |
videoBitrateInMbps: Int?— custom bitrate in MbpsvideoBitrateInBps: Long?— custom bitrate in bps (takes precedence overvideoBitrateInMbps)isMinBitrateCheckEnabled: Boolean— whentrue, skips compression if source bitrate is below 2 Mbps
import com.davotoula.lightcompressor.VideoCodec
import com.davotoula.lightcompressor.utils.CompressorUtils
val codec = if (CompressorUtils.isHevcEncodingSupported()) {
VideoCodec.H265 // Better compression, smaller files
} else {
VideoCodec.H264 // Maximum device compatibility (default)
}
val config = Configuration(
videoNames = listOf("output.mp4"),
quality = VideoQuality.MEDIUM,
videoCodec = codec,
)If VideoCodec.H265 is requested on a device that does not support HEVC encoding, onFailure is called with a descriptive error message.
Available from 2.3.0. HLG and PQ (HDR10/HDR10+) input is controlled by hdrMode. SDR input is never affected.
import com.davotoula.lightcompressor.VideoCodec
import com.davotoula.lightcompressor.config.Configuration
import com.davotoula.lightcompressor.config.HdrMode
val config = Configuration.withBitrateInBps(
videoNames = listOf("output.mp4"),
videoBitrateInBps = 6_000_000L,
videoCodec = VideoCodec.H265,
hdrMode = HdrMode.KEEP_IF_SUPPORTED, // default
)| Mode | Result |
|---|---|
HdrMode.KEEP_IF_SUPPORTED |
BT.2020 input encoded as H.265 on a device whose HEVC encoder supports HDR editing (Android 13+) keeps 10-bit HDR. Everything else is tone mapped to 8-bit SDR. |
HdrMode.TONE_MAP_TO_SDR |
HDR input is always tone mapped to 8-bit SDR (BT.709). |
H.264 can't keep HDR. With VideoCodec.H264, HDR input is always tone mapped to SDR, whatever the mode: Android hardware encoders don't encode 10-bit H.264 (High 10), and few hardware decoders could play it. Use VideoCodec.H265 to keep HDR. The sample app disables its Keep HDR option while H.264 is selected.
HDR input is also tone mapped to 8-bit SDR for HLS (which always converts HDR to SDR, whatever the mode), for input tagged with a colour standard other than BT.2020, and on older or unsupported devices. Kept HDR output keeps the input's transfer: HLG stays HLG, and PQ is written as plain HDR10 because HDR10+ dynamic metadata is dropped.
Dolby Vision video with a backward-compatible base layer (profile 8.1 or 8.4, which includes iPhone HDR recordings) is compressed from that base layer, so it comes out as HDR10 or HLG, or as SDR when tone mapped. The Dolby Vision metadata is dropped. Profile 5, which has no base layer, needs a Dolby Vision decoder on the device.
To show an HDR option only when it applies, probe the picked video first. probeHdr opens the file, so call it off the main thread. It never throws.
import com.davotoula.lightcompressor.VideoCompressor
import com.davotoula.lightcompressor.hdr.HdrInput
val probe = VideoCompressor.probeHdr(context, uri)
val isHdr = probe.input != HdrInput.SDR // e.g. to say the video will be converted to SDR
val showKeepHdr = probe.canKeepHdr // always false for SDR inputinputisHdrInput.HLG,HdrInput.PQorHdrInput.SDR. SDR, untagged and unreadable video all reportSDR, which is also how compression treats them. Dolby Vision 8.x reports its base layer's transfer.canKeepHdris true when compressing this video asVideoCodec.H265withHdrMode.KEEP_IF_SUPPORTEDwould keep its HDR on this device. It is always false for SDR input, and H.264 output is always tone mapped.
Each video is saved under its name from videoNames (with .mp4 added if the name doesn't contain it), with or without isStreamable. In app-specific and cache storage an existing file with that name is replaced; in shared storage on Android 10 and later, MediaStore gives the new file a numbered name instead. Give each video in a batch its own name, and don't reuse the name of a source video in the same folder (for example a picked video your app copied into its cache directory): the output would replace the source before it is read.
Saves to shared storage (Movies, Pictures, or Downloads).
import com.davotoula.lightcompressor.config.SharedStorageConfiguration
import com.davotoula.lightcompressor.config.SaveLocation
SharedStorageConfiguration(
saveAt = SaveLocation.MOVIES, // or .PICTURES / .DOWNLOADS
subFolderName = "my-videos" // optional
)Saves to the app's private internal files directory (Context.filesDir).
import com.davotoula.lightcompressor.config.AppSpecificStorageConfiguration
AppSpecificStorageConfiguration(
subFolderName = "compressed" // optional subfolder
)Saves to the app's cache directory (may be cleared by the system).
import com.davotoula.lightcompressor.config.CacheStorageConfiguration
CacheStorageConfiguration()Implement StorageConfiguration for full control over where files are written.
import com.davotoula.lightcompressor.config.StorageConfiguration
class MyStorageConfiguration : StorageConfiguration {
override fun createFileToSave(
context: Context,
videoFile: File,
fileName: String,
shouldSave: Boolean
): File {
// Return the File where the output should be written
}
}createFileToSave is called with shouldSave = false to pick the file compression writes to, then with shouldSave = true once compression succeeds, when videoFile is the compressed file. With shouldSave = false, videoFile only names the source video: it is the source's path when MediaStore knows it, and otherwise a placeholder, not a real file, so don't read it.
API < 29
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="28"
tools:ignore="ScopedStorage" />API 29 – 32
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32"/>API >= 33 (Photo Picker recommended)
<uses-permission android:name="android.permission.READ_MEDIA_VIDEO"/>Available from 2.4.0. Mp4Sanitizer.sanitize strips container metadata from an MP4 or M4A without re-encoding it, and writes the result fast-start, so playback can begin before the download finishes. Call it off the main thread.
import com.davotoula.lightcompressor.sanitizer.Mp4Sanitizer
val clean = File(context.cacheDir, "upload.mp4")
try {
val result = Mp4Sanitizer.sanitize(context, uri, clean)
if (!result.fastStart) Log.w(TAG, "${result.file} plays only after a full download")
} catch (e: IOException) { /* not sanitized; clean does not exist */ }- What it strips: every audio and video sample is copied into a new MPEG-4 container, so
udta(location, device make and model),meta/ilst,uuid(XMP) boxes and per-track user data are left behind. Tracks that are neither audio nor video, such as the timed-metadata (mett) track camera apps record, are dropped along with their samples. The rotation is carried over. - What it does not strip:
MediaMuxerwrites its own creation time and ametabox holdingcom.android.version(the Android version). Metadata inside the video bitstream, such as H.264 SEI user data, stays. - Fast start:
moovis moved ahead ofmdat.SanitizeResult.fastStartis false only when that pass failed; the output is then a valid but non-fast-start file.Mp4Sanitizer.isFastStart(file)checks any file. - Failures throw
IOException: when the source can't be read, has no audio or video track, has an audio or video track an MPEG-4 container can't hold (Mp4Sanitizer.isMuxableIntoMp4(mime), e.g. Opus, MP3 or Dolby Vision), is a stream-copy trim whose edit list starts mid-GOP (a remux would bring back the trimmed-out frames; AAC encoder priming is not a trim and is kept), or the remux fails. An interrupted thread getsInterruptedIOException, so wrap the call inrunInterruptibleto make it cancellable. The output file never exists after a throw. It must not be the input file, and only one call at a time may write to a given output path.
Available from 2.5.0. Pass a TrimRange to keep only part of the source. It is trimmed, stripped and fast-started in one pass, still without re-encoding, so the cut falls on key frames.
val result = Mp4Sanitizer.sanitize(context, uri, clean, TrimRange(startMs = 2_000, endMs = 7_500))- Start: the cut starts at the video key frame at or before
startMs, so up to one GOP before it can show. That frame is written at time 0 and every track is shifted alike, so audio and video stay in sync; audio before it is dropped. Audio-only input starts at the audio sample at or beforestartMs. - End:
endMsis inclusive. Up to 8 video frames past it are kept when a frame at or before it needs them to decode (B-frames).Long.MAX_VALUEkeeps everything fromstartMs. - The source's beginning: a cut from there keeps AAC encoder priming behind an edit list, as
sanitizedoes. A stream-copy trim whose edit list starts mid-GOP, which a plainsanitizerefuses, can be trimmed: its hidden key frame is what the cut snaps back to. - Tracks: an audio track with no sample in the range is left out of the output. A source with more than one video track, or a
startMsafter the end of the video, throwsIOException.
HlsPreparer transcodes a local video into multiple HLS VOD renditions (fMP4 segments + m3u8 playlists) for adaptive-bitrate playback.
HlsPreparer.start(context, uri, config, listener): Job— kicks off preparation and returns a coroutineJob.HlsPreparer.cancel()— cancels any running preparation.HlsConfig(ladder, codec, segmentDurationSeconds, disableAudio, singleFilePerRendition)— configuration. Defaults:HlsLadder.default(),VideoCodec.H264, 6 s segments, audio enabled, multi-file output. SetsingleFilePerRendition = trueto emit one combined fMP4 file per rendition (init + every media segment) referenced by#EXT-X-BYTERANGEin the playlist — useful when the consumer wants a single upload per rendition instead of dozens of segment files.HlsLadder— ordered list ofRenditions. UseHlsLadder.default()(360p / 540p / 720p / 1080p / 4K) and chain.drop("1080p", "4K")or.add(Rendition(Resolution.HD_720, 2500))to customise. Renditions whose short side exceeds the source are automatically dropped atstart.Rendition(resolution: Resolution, bitrateKbps: Int)— a single ladder entry.Resolutionis the same enum used byVideoCompressor(SD_360,SD_540,HD_720,FHD_1080,UHD_4K).HlsListener— 8 callbacks:onStart(renditionCount),onRenditionStart(rendition),onSegmentReady(rendition, segment),onRenditionComplete(rendition, summary),onComplete(masterPlaylist),onFailure(error),onProgress(rendition, percent),onCancelled().HlsRenditionSummarycarries the media playlist plus output dimensions, codec string, and the library's chosen filenames. SubclassSimpleHlsListenerif you only care about a subset of events.HlsSegment(file, index, durationSeconds, isInitSegment, isCombinedRendition)— one emitted segment.fileis a temp file that is valid only untilonSegmentReadyreturns — copy or upload it synchronously. In multi-file modeisInitSegment = truefor the per-renditioninit.mp4. In single-file mode the listener receives exactly one callback per rendition withisCombinedRendition = true; the file contains the init segment followed by every media fragment.HlsError(message, failedRenditions, completedRenditions)— delivered toonFailurewhen every rendition fails. Partial failures still triggeronComplete.
Threading: onSegmentReady and onProgress are invoked on a background dispatcher (Dispatchers.Default); all other callbacks are on the main thread.
Output layout (multi-file, default): segments are identified by the rendition's Resolution.label (e.g. 720p). Per rendition, HlsPreparer emits one init.mp4 followed by segment_000.m4s, segment_001.m4s, … The per-rendition media playlist (media.m3u8) is delivered as a String via onRenditionComplete, and the master playlist (master.m3u8) is delivered as a String via onComplete. Persisting playlists and segments to their final destination (disk, CDN, object storage) is the caller's responsibility — a typical layout is master.m3u8 at the root with one subdirectory per rendition label containing media.m3u8, init.mp4, and the segment_NNN.m4s files.
Output layout (single-file): with singleFilePerRendition = true, each rendition produces one <label>.mp4 file (e.g. 720p.mp4) containing the init segment immediately followed by every media fragment. The media playlist references the file via #EXT-X-MAP:URI="<label>.mp4",BYTERANGE="<initLen>@0" and uses #EXT-X-BYTERANGE for each #EXTINF entry, so a typical persisted layout is master.m3u8 at the root with one subdirectory per rendition label containing media.m3u8 and <label>.mp4.
import com.davotoula.lightcompressor.HlsPreparer
import com.davotoula.lightcompressor.VideoCodec
import com.davotoula.lightcompressor.hls.HlsConfig
import com.davotoula.lightcompressor.hls.HlsError
import com.davotoula.lightcompressor.hls.HlsLadder
import com.davotoula.lightcompressor.hls.HlsListener
import com.davotoula.lightcompressor.hls.HlsRenditionSummary
import com.davotoula.lightcompressor.hls.HlsSegment
import com.davotoula.lightcompressor.hls.Rendition
import com.davotoula.lightcompressor.hls.suggestedFilename
import java.io.File
val outputRoot = File(context.filesDir, "hls-out").apply { mkdirs() }
val config = HlsConfig(
ladder = HlsLadder.default().drop("4K"),
codec = VideoCodec.H264,
segmentDurationSeconds = 6,
disableAudio = false,
)
HlsPreparer.start(
context = applicationContext,
uri = videoUri,
config = config,
listener = object : HlsListener {
override fun onStart(renditionCount: Int) { /* prep UI */ }
override fun onRenditionStart(rendition: Rendition) { /* optional */ }
override fun onSegmentReady(rendition: Rendition, segment: HlsSegment) {
// Called on a background thread. Copy synchronously — the temp
// file is deleted as soon as this method returns.
val dest = File(outputRoot, rendition.suggestedFilename(segment))
dest.parentFile?.mkdirs()
segment.file.copyTo(dest, overwrite = true)
}
override fun onRenditionComplete(rendition: Rendition, summary: HlsRenditionSummary) {
val mediaPlaylistFile = File(outputRoot, summary.playlistFilename)
mediaPlaylistFile.parentFile?.mkdirs()
mediaPlaylistFile.writeText(summary.mediaPlaylist)
}
override fun onComplete(masterPlaylist: String) {
val master = File(outputRoot, "master.m3u8").apply { writeText(masterPlaylist) }
// Hand off to ExoPlayer (requires androidx.media3:media3-exoplayer-hls):
// val source = HlsMediaSource.Factory(DefaultDataSource.Factory(context))
// .createMediaSource(MediaItem.fromUri(Uri.fromFile(master)))
// exoPlayer.setMediaSource(source); exoPlayer.prepare()
}
override fun onFailure(error: HlsError) { /* handle error */ }
override fun onProgress(rendition: Rendition, percent: Float) { /* update UI */ }
override fun onCancelled() { /* cleanup */ }
},
)
// To cancel:
HlsPreparer.cancel()Most real integrations transcode → upload each segment → rewrite the playlist filenames to URLs → publish the rewritten master. The library ships the pieces you need.
The uploader lambda returns HlsUploaded<T>(url, metadata) where T is a caller-chosen type. Use it to thread per-upload data you need later — content hashes, sizes, server IDs, anything — without maintaining a side-channel map. Callers who only want URLs use T = Unit.
import com.davotoula.lightcompressor.hls.HlsConfig
import com.davotoula.lightcompressor.hls.HlsContentTypes
import com.davotoula.lightcompressor.hls.HlsUploaded
import com.davotoula.lightcompressor.hls.HlsUploadHelper
import com.davotoula.lightcompressor.hls.HlsUploadResult
data class UploadedBlob(val sha256: String, val sizeBytes: Long)
suspend fun uploadHls(context: Context, videoUri: Uri): String {
val result: HlsUploadResult<UploadedBlob> = HlsUploadHelper.run(
context = context,
uri = videoUri,
config = HlsConfig(),
) { file, suggestedFilename ->
// Invoked on Dispatchers.IO. Upload the file and return the URL + any metadata
// you need downstream (e.g. for NIP-71 `imeta` tags, signed manifests, analytics).
val contentType = if (suggestedFilename.endsWith(".m3u8")) {
HlsContentTypes.HLS_PLAYLIST
} else {
HlsContentTypes.FMP4_SEGMENT
}
val blob = myUploader.upload(file, filename = suggestedFilename, contentType = contentType)
HlsUploaded(url = blob.url, metadata = UploadedBlob(blob.sha256, blob.sizeBytes))
}
// Look up any upload's metadata by the same identifiers the library already gave you:
// result.uploads[summary.combinedFilename] // single-file rendition
// result.uploads[summary.playlistFilename] // media playlist
// result.uploads[rendition.suggestedFilename(segment)] // individual segment
result.renditions.forEach { summary ->
val renditionFile = summary.combinedFilename ?: return@forEach
val blob = result.uploads[renditionFile]?.metadata ?: return@forEach
println("${summary.rendition.resolution.label}: ${summary.width}x${summary.height}, sha256=${blob.sha256}, ${blob.sizeBytes} bytes")
}
// result.masterPlaylist is already rewritten to point at the uploaded URLs.
// Publish it however you want — write to disk, post to your CDN, insert into a DB row…
return myUploader.uploadText(
content = result.masterPlaylist,
filename = "master.m3u8",
contentType = HlsContentTypes.HLS_PLAYLIST,
).url
}If you only need URLs and don't want to define a metadata type, use Unit:
val result: HlsUploadResult<Unit> = HlsUploadHelper.run(ctx, videoUri) { file, name ->
HlsUploaded(url = myUploader.upload(file).url, metadata = Unit)
}HlsUploadResult.renditions carries per-rendition HlsRenditionSummary objects — use summary.width, summary.height, and summary.codecString to build downstream metadata (e.g. Nostr imeta tags) without re-parsing the master playlist. HlsUploadResult.uploads is a LinkedHashMap preserving the upload timeline: all segments first (across renditions, in emission order), then all media playlists (in rendition order). Map keys match exactly what rendition.suggestedFilename(segment), summary.playlistFilename, and summary.combinedFilename return — consumers can look up entries by the same identifiers they already hold.
If you need custom orchestration (retry, concurrency, progress reporting), wire the pieces yourself:
import com.davotoula.lightcompressor.hls.HlsRenditionSummary
import com.davotoula.lightcompressor.hls.PlaylistRewriter
import com.davotoula.lightcompressor.hls.SimpleHlsListener
import com.davotoula.lightcompressor.hls.suggestedFilename
class UploadingListener(private val uploader: Uploader) : SimpleHlsListener() {
private val segmentUrls = mutableMapOf<Rendition, MutableMap<String, String>>()
private val renditionPlaylistUrls = mutableMapOf<String, String>()
override fun onSegmentReady(rendition: Rendition, segment: HlsSegment) {
val key = rendition.suggestedFilename(segment)
val url = uploader.upload(segment.file, filename = key)
segmentUrls.getOrPut(rendition) { mutableMapOf() }[key] = url
}
override fun onRenditionComplete(rendition: Rendition, summary: HlsRenditionSummary) {
// The media playlist references segments by bare filename (e.g. "init.mp4",
// "segment_000.m4s"), while the rewrite map is keyed by the library's full
// rendition.suggestedFilename(segment) output (e.g. "720p/init.mp4"). Strip the
// "<label>/" prefix before rewriting so the keys match what the playlist actually
// contains. Combined-rendition keys like "720p.mp4" have no prefix to strip.
val prefix = "${rendition.resolution.label}/"
val perRenditionMap =
(segmentUrls[rendition] ?: emptyMap()).entries.associate { (key, url) ->
(if (key.startsWith(prefix)) key.removePrefix(prefix) else key) to url
}
val rewritten = PlaylistRewriter.rewrite(
playlist = summary.mediaPlaylist,
urlMap = perRenditionMap,
)
val url = uploader.uploadText(rewritten, filename = summary.playlistFilename)
renditionPlaylistUrls[summary.playlistFilename] = url
}
override fun onComplete(masterPlaylist: String) {
val rewrittenMaster = PlaylistRewriter.rewrite(masterPlaylist, renditionPlaylistUrls)
uploader.uploadText(rewrittenMaster, filename = "master.m3u8")
}
}Rewrite-map keys are whatever Rendition.suggestedFilename(segment) / HlsRenditionSummary.playlistFilename return — the library guarantees the two are consistent, so your rewrite map just needs to match its own lookups.
.m3u8 playlists must be served as application/vnd.apple.mpegurl. Android's MimeTypeMap does not know this type, so if your upload pipeline derives content types from file extensions you must special-case it. Use HlsContentTypes.HLS_PLAYLIST / HlsContentTypes.FMP4_SEGMENT as the canonical source.
HlsRenditionSummary carries width, height, codecString, playlistFilename, and combinedFilename. Consumers building manifest metadata (e.g. Nostr imeta tags with variant, dim, codec) should read these from the summary rather than regex-parsing the master playlist.
HLS playback on the consumer side requires the Media3 HLS module:
implementation "androidx.media3:media3-exoplayer-hls:$media3_version"The app/ module contains a Jetpack Compose sample app demonstrating the library. Install it via:
Minimum Android SDK: API level 21
Upgrading from 2.2.x to 2.3.0: source compatible, but not binary compatible, so code compiled against 2.2.x must be recompiled (a normal JitPack dependency always is). Two changes cause it: adding hdrMode to Configuration changed the signatures Kotlin compiles default arguments and copy() into, and VideoCompressor.start() now returns a CompressionHandle instead of nothing, which changes its signature for Kotlin and Java callers alike. A prebuilt library compiled against 2.2.x that calls start() or creates a Configuration from Kotlin fails at runtime with NoSuchMethodError until it is rebuilt against 2.3.0.
Kotlin version: consuming 2.3.0 needs Kotlin 2.3 or newer. The AAR carries Kotlin 2.4 metadata, and a Kotlin compiler only reads metadata one minor version ahead of itself.
Originally forked from AbedElazizShe/LightCompressor. Based on Telegram for Android.

