{"id":20944459,"url":"https://github.com/numq/klarity","last_synced_at":"2025-05-14T01:31:13.176Z","repository":{"id":190799294,"uuid":"683026324","full_name":"numq/Klarity","owner":"numq","description":"FFmpeg and Portaudio based media player library for Jetpack Compose Desktop","archived":false,"fork":false,"pushed_at":"2024-11-02T22:37:37.000Z","size":1339,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-02T23:22:19.756Z","etag":null,"topics":["audioplayer","ffmpeg","jetpack-compose-desktop","jni","kotlin","mediaplayer","mediaplayer-library","multimedia-library","portaudio","time-stretching","video-rendering","videoplayer"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/numq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-25T12:24:36.000Z","updated_at":"2024-11-02T22:37:41.000Z","dependencies_parsed_at":"2023-08-26T12:58:05.972Z","dependency_job_id":"46600947-62ff-4a54-8456-5fc8e2d50c2b","html_url":"https://github.com/numq/Klarity","commit_stats":null,"previous_names":["numq/jcmp"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numq%2FKlarity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numq%2FKlarity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numq%2FKlarity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/numq%2FKlarity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/numq","download_url":"https://codeload.github.com/numq/Klarity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225268841,"owners_count":17447421,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audioplayer","ffmpeg","jetpack-compose-desktop","jni","kotlin","mediaplayer","mediaplayer-library","multimedia-library","portaudio","time-stretching","video-rendering","videoplayer"],"created_at":"2024-11-18T23:42:19.005Z","updated_at":"2025-05-14T01:31:13.164Z","avatar_url":"https://github.com/numq.png","language":"Kotlin","funding_links":["https://www.buymeacoffee.com/numq","https://img.buymeacoffee.com/button-api/?text=Buy"],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://www.buymeacoffee.com/numq\"\u003e\u003cimg src=\"https://img.buymeacoffee.com/button-api/?text=Buy me a one way ticket\u0026emoji=✈️\u0026slug=numq\u0026button_colour=5F7FFF\u0026font_colour=ffffff\u0026font_family=Inter\u0026outline_colour=000000\u0026coffee_colour=FFDD00\" /\u003e\u003c/a\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003ch1\u003eKlarity\u003c/h1\u003e\n\u003cimg src=\"media/logo.png\" alt=\"logo\" height=\"128px\"/\u003e\n\u003c/div\u003e\n\n### Klarity is an FFMpeg-based media player library written in C++ and Kotlin, and supports use in Jetpack Compose Desktop projects.\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"media/screenshot.png\" alt=\"screenshot\"/\u003e\n\u003c/div\u003e\n\n---\n\n## Table of Content\n\n* [Features](#features)\n* [Architecture](#architecture)\n    * [Dependency graph](#dependency-graph)\n    * [State diagram](#state-diagram)\n    * [Transition table](#transition-table)\n* [Supported formats](#supported-formats)\n* [Modules](#modules)\n    * [Core](#core)\n    * [Compose](#compose)\n    * [Example](#example)\n* [Components](#components)\n* [Installation](#installation-and-usage)\n\n# Features\n\n- Media playback (audio, video)\n- Change playback speed with time stretching (without affecting pitch)\n- Continuous preview for timeline-like features\n- Creation of snapshots by timestamps\n- Coroutines/Flow based API\n- Compose video rendering\n\n## Architecture\n\n### Dependency graph\n\n```mermaid\ngraph TD\n    KlarityPlayer --\u003e PlayerController\n    PlayerController --\u003e Pipeline\n    PlayerController --\u003e BufferLoop\n    PlayerController --\u003e PlaybackLoop\n    PlayerController --\u003e Settings\n    PlayerController --\u003e PlayerState\n    PlayerController --\u003e BufferTimestamp\n    PlayerController --\u003e PlaybackTimestamp\n    PlayerController --\u003e Renderer\n    PlayerController --\u003e Events\n    BufferLoop --\u003e Pipeline\n    PlaybackLoop --\u003e BufferLoop\n    PlaybackLoop --\u003e Pipeline\n    PlayerController --\u003e Pipeline\n    subgraph Pipeline\n        Pipeline.AudioVideo --\u003e Media\n        Pipeline.AudioVideo --\u003e AudioDecoder\n        Pipeline.AudioVideo --\u003e VideoDecoder\n        Pipeline.AudioVideo --\u003e AudioBuffer\n        Pipeline.AudioVideo --\u003e VideoBuffer\n        Pipeline.AudioVideo --\u003e Sampler\n        Pipeline.AudioVideo --\u003e Renderer\n        Pipeline.Audio --\u003e Media\n        Pipeline.Audio --\u003e AudioDecoder\n        Pipeline.Audio --\u003e AudioBuffer\n        Pipeline.Audio --\u003e Sampler\n        Pipeline.Video --\u003e Media\n        Pipeline.Video --\u003e VideoDecoder\n        Pipeline.Video --\u003e VideoBuffer\n        Pipeline.Video --\u003e Renderer\n    end\n    Sampler --\u003e JNI\\nNativeSampler --\u003e C++\\nSampler\n    AudioDecoder --\u003e JNI\\nNativeDecoder\n    VideoDecoder --\u003e JNI\\nNativeDecoder\n    JNI\\nNativeDecoder --\u003e C++\\nDecoder\n```\n\n### State diagram\n\n```mermaid\nstateDiagram-v2\n    state PlayerState {\n        [*] --\u003e Empty\n        Empty --\u003e Preparing: Prepare Media\n        Preparing --\u003e Ready: Media Ready\n        Preparing --\u003e Empty: Release\n\n        state Ready {\n            [*] --\u003e Stopped\n            Stopped --\u003e Playing: Play\n            Playing --\u003e Paused: Pause\n            Playing --\u003e Stopped: Stop\n            Playing --\u003e Seeking: SeekTo\n            Paused --\u003e Playing: Resume\n            Paused --\u003e Stopped: Stop\n            Paused --\u003e Seeking: SeekTo\n            Stopped --\u003e Completed: Playback Completed\n            Stopped --\u003e Seeking: SeekTo\n            Completed --\u003e Stopped: Stop\n            Completed --\u003e Seeking: SeekTo\n            Seeking --\u003e Seeking: SeekTo\n            Seeking --\u003e Paused: Seek Completed\n            Seeking --\u003e Stopped: Stop\n        }\n\n        Ready --\u003e Empty: Release\n    }\n```\n\n### Transition table\n\n| Current State \\ Target State | Empty | Preparing | Ready (Stopped) | Ready (Playing) | Ready (Paused) | Ready (Completed) | Ready (Seeking) | Released |\n|------------------------------|-------|-----------|-----------------|-----------------|----------------|-------------------|-----------------|----------|\n| **Empty**                    | N/A   | Prepare   | N/A             | N/A             | N/A            | N/A               | N/A             | N/A      |\n| **Preparing**                | N/A   | N/A       | Media Ready     | N/A             | N/A            | N/A               | N/A             | Release  |\n| **Ready (Stopped)**          | N/A   | N/A       | N/A             | Play            | N/A            | N/A               | SeekTo          | Release  |\n| **Ready (Playing)**          | N/A   | N/A       | Stop            | N/A             | Pause          | N/A               | SeekTo          | N/A      |\n| **Ready (Paused)**           | N/A   | N/A       | Stop            | Resume          | N/A            | N/A               | SeekTo          | N/A      |\n| **Ready (Completed)**        | N/A   | N/A       | Stop            | N/A             | N/A            | N/A               | SeekTo          | N/A      |\n| **Ready (Seeking)**          | N/A   | N/A       | Stop            | N/A             | Seek Completed | N/A               | SeekTo          | N/A      |\n\n## Supported formats\n\n[Full list of formats supported by FFmpeg](https://ffmpeg.org/ffmpeg-formats.html)\n\n## Modules\n\n### Core\n\n\u003e Contains basic components such as: controller, player, preview manager, snapshot manager\n\n#### Dependencies\n\n- [klarity-decoder](https://github.com/numq/klarity-decoder)\n    - [FFmpeg](https://www.ffmpeg.org/)\n\n- [klarity-sampler](https://github.com/numq/klarity-sampler)\n    - [PortAudio](https://github.com/PortAudio/portaudio/)\n    - [Signalsmith Audio](https://github.com/Signalsmith-Audio/signalsmith-stretch)\n\n### Compose\n\n\u003e Contains a Compose component for rendering video\n\n#### Dependencies\n\n- [Core Module](#core)\n\n### Example\n\n\u003e Contains a demo application\n\n#### Dependencies\n\n- [Core Module](#core)\n- [Compose Module](#compose)\n\nTo run demo application place the binaries appropriate to your platform into the `example/bin` folder and run\nthe [Application](example/src/main/kotlin/application/Application.kt).\n\n### Components\n\n- [KlarityPlayer](core/src/main/kotlin/com/github/numq/klarity/core/player/KlarityPlayer.kt) - contains the media player\n  logic.\n- [SnapshotManager](core/src/main/kotlin/com/github/numq/klarity/core/snapshot/SnapshotManager.kt) - allows to get\n  frames (snapshots) with a\n  specified timestamp once per session. Use case - previewing keyframes.\n- [PreviewManager](core/src/main/kotlin/com/github/numq/klarity/core/preview/PreviewManager.kt) - allows to get frames (\n  snapshots) with a\n  specific timestamp during a continuous session. Use case - previewing the timeline.\n- [Renderer](compose/src/main/kotlin/com/github/numq/klarity/compose/renderer/Renderer.kt) - Provides functionality for\n  rendering background and\n  foreground.\n\n### Installation and usage\n\n\u003e [!IMPORTANT]\n\u003e Binaries must be located in the filesystem, however, they can be part of a jar - for this the binaries must be\n\u003e opened as temporary files whose path can be used by the loader.\n\n- Include the library jars in project\n- Place binaries in folder\n- Load binaries by specifying path in calls to `loadDecoder` and `loadSampler` functions\n  of [Klarity](core/src/main/kotlin/com/github/numq/klarity/core/loader/Klarity.kt) loader object\n- Instantiate and use **core** media player components located in `com.github.numq.klarity.core`\n- Instantiate and use specific **Jetpack Compose** components located in `com.github.numq.klarity.compose`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumq%2Fklarity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnumq%2Fklarity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnumq%2Fklarity/lists"}