v1.14.0 β Compositor export β H.264 MP4 π¬
Compositor export β H.264 MP4 π¬
The on-device compositor could already export a shareable animated GIF (1.13.0). 1.14.0 adds a second export target: the same OGComposition renders to a real H.264 MP4 with OGComposition.exportMp4() β driving the device's own video encoder, with no third-party dependency.
Added
OGComposition.exportMp4(bitRate = defaultMp4BitRate(width, height, fps), background = Color.Black)β renders every frame offscreen at the composition'sfps, flattens it onto an opaquebackground(H.264 has no alpha), and encodes a real H.264 MP4 with the OS video encoder: AndroidMediaCodec+MediaMuxer, iOSAVAssetWriter. Returns the encodedByteArray; saving/sharing stays the app's call.defaultMp4BitRate(width, height, fps)β a resolution/fps-scaled default average bit rate, clamped to a 0.75β16 Mbps band.
The byte stream isn't identical across platforms (each OS has its own encoder), but the input is: compositing and the RGBβYUV / RGBβBGRA colour maths live in shared, tested commonMain, so both encoders compress the same rendered frames. H.264 needs even dimensions. Purely additive β one new extension, nothing existing changed. Completes Bet 3 β on-device compositor + export beyond GIF.
Verified: 10 new tests green on JVM + iOS; Android live (MediaCodec β a valid 288Β² @20fps 40-frame H.264, played back through OGAVPlayer); iOS live (AVAssetWriter on the simulator β a valid standard High-profile H.264, ffprobe-confirmed). See docs/COMPOSITOR.md.
implementation("se.solidkey:kmpmedia-lib:1.14.0")