KOTLIN MULTIPLATFORM · PRE-ALPHA
filmstrip
A Kotlin Multiplatform library for editing, encoding and previewing video. Build a composition, preview it in the player, then export it to a file.
- ANDROID
- IOS
- MACOS
- JVM
- BROWSER
implementation("dev.jordond.filmstrip:filmstrip:0.1.0-SNAPSHOT" ) EDITIMPORT beach.mp400:00:00:00
RAWSUMMER '96
beach.mp4
GRADE
TEXT
Quick start
One composition. Export it or play it.
- 01
DESCRIBE THE EDIT
Trim a clip and stack effects on it. It's plain data, so the player and export take the same one.
- 02
ASK BEFORE YOU DECODE
Find out what this device can do before anything decodes.
- 03
EXPORT AS A FLOW
Progress and results arrive as a flow. Cancel the scope to cancel.
- 02
- 02
REMEMBER A PLAYER
Reloads whenever the composition changes, without rebuilding the pipeline.
- 03
DRAW IT
VideoSurface draws it on every target. Control playback on the player.
- 02
val composition =
compositionOf {
clip(MediaSource.of("beach.mp4")) {
trim(2.seconds..8.seconds)
effects {
saturation(2f)
contrast(1.15f)
textOverlay(
text = "SUMMER '96",
at = 0.seconds..3.seconds,
anchor = Anchor.TopCenter,
animation = fade(inDuration = 500.milliseconds),
)
}
fadeOut(1.seconds)
}
}val filmstrip = Filmstrip { allBackends() }
val plan =
when (val verdict = filmstrip.plan(composition, ExportSpec.Upload)) {
is Verdict.Capable -> verdict.plan
is Verdict.Degraded -> verdict.plan
is Verdict.Incapable -> return
}
filmstrip.export(plan, MediaSink.temporary()).collect { status ->
if (status is ExportStatus.Progress) println(status.fraction)
}@Composable
fun Preview(
filmstrip: Filmstrip,
composition: EditComposition,
) {
val player = rememberFilmstripPlayer(filmstrip, composition)
Column {
VideoSurface(player, Modifier.aspectRatio(16f / 9f))
Row {
BasicText("Play", Modifier.clickable { player.play() })
BasicText("Pause", Modifier.clickable { player.pause() })
}
}
}Try it
EDITIMPORT beach.mp400:00:00:00
RAWSUMMER '96
ABOUT 13 MB DOWNLOAD · STARTS WHEN YOU PRESS LOAD
LOADING beach.mp4TAP TO PLAYTHIS BROWSER HAS NO WEBCODECSTHE DEMO NEEDS IT · OPEN THIS PAGE IN CHROME
beach.mp4
GRADE
TEXT
Want the whole thing? Open the full sample app.
Platforms
Every platform gets a backend built on its own video APIs. The same composition previews and exports on each of them.