feat(ffmpeg): migrate from CLI bridge to libav*-based Kotlin API with CLI fallback #31
Merged
Conversation
…I, add bilingual API docs
… in readPacket loop
…DTS discontinuity
…t discontinuities
…areFfmpegAndroidJniLibsTask for Gradle configuration cache compatibility
…ate native libs conflict
…efer self-built so
… so from JavaCPP jars and switching to pure Java API dependency
…x Gradle configuration cache
…check for non-macOS CI
… by using File(uri) instead of URL.path
Him188
approved these changes
May 3, 2026
StageGuard
requested changes
May 4, 2026
Member
StageGuard
left a comment
There was a problem hiding this comment.
Found two blocking regressions in the optimized FFmpegKit path.
…misinterpreting operands as output paths
StageGuard
approved these changes
May 5, 2026
StageGuard
approved these changes
May 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR migrates
mediamp-ffmpegfrom a pure CLI bridge (FFmpegKit.execute(args)callingmain()) to a thin Kotlin Multiplatform wrapper aroundlibavformat/libavcodec, while preserving the CLI bridge as a fallback for unmapped operations.Key Changes
New Kotlin API
MediaTranscoder+MediaOperationfor high-level operations:MediaOperation.Remux— stream copy with automatictime_baserescaling, per-stream BSF, and muxer options.MediaOperation.Probe— read stream info.InputContainer,OutputContainer,Stream,AVPacket,BitstreamFilter,MuxerOptions.internal expect/actualtypealiases, enabling shared logic incommonMain.CLI Bridge Preservation
FFmpegKit.execute(args)remains available as a fallback:Remux,Probe) are routed through the new Kotlin API.ffmpegbinary (Android/Desktop) or throwUnsupportedOperationException(iOS).Android Native Library Consolidation
androidMaindependency tolibs.ffmpeg(pure Java API) to prevent JavaCPP prebuiltlibav*.sofrom entering the AAR.ExtractJavaCppJniTaskto extract JavaCPP JNI bridgelibjni*.sofrom classifier jars.libav*.so+libjni*.so, resolvingmergeNativeLibsconflicts.Breaking Changes
ffmpegkit_jni.c,MediampFFmpegKit.h) andfftoolslinkage.