{"id":15065764,"url":"https://github.com/keijiro/klakhap","last_synced_at":"2025-08-31T17:34:22.556Z","repository":{"id":50961630,"uuid":"166191417","full_name":"keijiro/KlakHap","owner":"keijiro","description":"HAP video player plugin for Unity","archived":false,"fork":false,"pushed_at":"2023-12-29T06:03:16.000Z","size":10081,"stargazers_count":343,"open_issues_count":11,"forks_count":29,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-04-04T11:16:52.136Z","etag":null,"topics":["codec","hap","unity","unity3d","video"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/keijiro.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}},"created_at":"2019-01-17T08:43:00.000Z","updated_at":"2025-01-30T04:03:01.000Z","dependencies_parsed_at":"2024-01-15T15:11:29.470Z","dependency_job_id":"f0ca610d-e803-4e6a-a086-cf8f0b66ede9","html_url":"https://github.com/keijiro/KlakHap","commit_stats":{"total_commits":96,"total_committers":1,"mean_commits":96.0,"dds":0.0,"last_synced_commit":"968ef4979700416cf80b5ee644375fd1a64048d3"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keijiro%2FKlakHap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keijiro%2FKlakHap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keijiro%2FKlakHap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/keijiro%2FKlakHap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/keijiro","download_url":"https://codeload.github.com/keijiro/KlakHap/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247166171,"owners_count":20894654,"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":["codec","hap","unity","unity3d","video"],"created_at":"2024-09-25T00:47:35.473Z","updated_at":"2025-04-04T11:17:00.032Z","avatar_url":"https://github.com/keijiro.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"KlakHAP\n=======\n\n![GIF](https://i.imgur.com/exuJAIA.gif)\n\n**KlakHAP** is a Unity plugin that allows playing back a video stream encoded\nwith the [HAP video codecs].\n\nHAP is a fast and high-quality video codec often used in real-time interactive\napplications. From the HAP Codecs website:\n\n\u003e The HAP codecs are designed to fit the needs of a variety of real-time video\n\u003e workflows where ultra high resolution video is needed such as live event\n\u003e production, set design, 360 video for gaming, projection mapping and creative\n\u003e coding.\n\nKlakHAP provides video frames as textures that can be used in any way on\nUnity's rendering pipeline — attaching to a material, presenting a full-screen\nvideo, animating a UI element, etc. Thanks to the performant design and\nimplementation of the HAP codecs, it can dynamically control the playback\ntime/speed without any hiccups.\n\n[HAP video codecs]: https://hap.video/\n\nSystem requirements\n-------------------\n\n- Unity 2019.4 or later\n\nAt the moment, KlakHAP only supports 64-bit desktop platforms (Windows, macOS\nand Linux).\n\nSupported formats\n-----------------\n\nKlakHap supports **HAP**, **HAP Alpha** and **HAP Q**. At the moment **HAP Q\nAlpha** is not supported.\n\nKlakHap only supports QuickTime File Format as a container — in other words,\nit only supports `.mov` files.\n\nInstallation\n------------\n\nThis package uses the [scoped registry] feature to resolve package\ndependencies. Please add the following sections to the manifest file\n(Packages/manifest.json).\n\n[scoped registry]: https://docs.unity3d.com/Manual/upm-scoped.html\n\nTo the `scopedRegistries` section:\n\n```\n{\n  \"name\": \"Keijiro\",\n  \"url\": \"https://registry.npmjs.com\",\n  \"scopes\": [ \"jp.keijiro\" ]\n}\n```\n\nTo the `dependencies` section:\n\n```\n\"jp.keijiro.klak.hap\": \"0.1.20\"\n```\n\nAfter changes, the manifest file should look like below:\n\n```\n{\n  \"scopedRegistries\": [\n    {\n      \"name\": \"Keijiro\",\n      \"url\": \"https://registry.npmjs.com\",\n      \"scopes\": [ \"jp.keijiro\" ]\n    }\n  ],\n  \"dependencies\": {\n    \"jp.keijiro.klak.hap\": \"0.1.20\",\n    ...\n```\n\nHow to specify a video file\n---------------------------\n\nThere are two methods to specify a video file in the plugin:\n\n- **Streaming Assets Mode**: Put a video file in the [Streaming Assets]\n  directory and specify its file name.\n- **Local File System Mode**: Put a video file somewhere in local drive\n  and specify its full path name.\n\nThe former method is recommended when the video file is delivered within the\napplication. The latter method is useful when it needs to play an external\ncontent.\n\n[Streaming Assets]: https://docs.unity3d.com/Manual/StreamingAssets.html\n\nHap Player component\n--------------------\n\n![Inspector](https://i.imgur.com/pIACL4W.png)\n\n**File Path** and **Path Mode** are used to specify a source video file. Please\nsee the previous section for details.\n\n**Time**, **Speed** and **Loop** are used to set the initial playback state.\nYou can also use these values to change the current state while playing.\n\n**Target Texture** is used to store decoded frames into a render texture. Note\nthat it allocates a small amount of GPU time for data transfer.\n\n**Target Renderer** is used to apply a decoded texture to a specific material\nproperty. Although it's the most performant way to render video frames, it\nneeds a few additional steps to be rendered correctly. The following points\nshould be taken into account:\n\n- UV coordinate incompatibility: Decoded textures will be upside-down due to\n  the difference in the UV coordinates conventions between Unity and HAP. It can\n  be fixed using a vertically-inverted texture scale/offset. You can also use\n  the `Klak/Hap` shader for this purpose.\n- Color space conversion for HAP Q: [YCoCg conversion] must be added to a\n  shader when using HAP Q. You can also use the `Klak/HAP Q` for this purpose.\n\n[YCoCg conversion]:\n  https://gist.github.com/dlublin/90f879cfe027ebf5792bdadf2c911bb5\n\nHow to control playback\n-----------------------\n\n`HapPlayer` only provides a few properties/methods for controlling playback.\nThis is an intentional design choice; I don't like to introduce ambiguity by\nadding common methods like `Play`, `Stop` or `Pause`. You can use the basic\nproperties/methods to control playback instead.\n\n- To jump to a specific point: Assign a time in seconds to `time`.\n- To jump to a specific frame: Calculate the time in seconds using `frameCount`\n  and `streamDuration` then assign it to `time`.\n- To reverse the playback direction: Assign a negative value to `speed`.\n- To pause: Assign `0` to `speed`.\n- To resume: Assign `1` to `speed`.\n- To stop: Assign `false` to `enabled`.\n- To close the video file: Destroy the `HapPlayer` component.\n- To open another video file: `AddComponent\u003cHapPlayer\u003e` then call `Open`.\n\nTimeline support\n----------------\n\n![GIF](https://i.imgur.com/efrvvye.gif)\n\nThe HAP Player component implements the [ITimeControl] interface that makes\nit able to control the playback time from a Control Track in a [Timeline].\nYou can easily create a control track with drag-and-dropping a HAP Player\ngame object into the Timeline Editor, or manually create a Control Track/Clip\nand set the source game object.\n\n[ITimeControl]: https://docs.unity3d.com/ScriptReference/Timeline.ITimeControl.html\n[Timeline]: https://docs.unity3d.com/Manual/TimelineSection.html\n\nPlatform differences (internal latency)\n----------------------------------------\n\nOn Windows, KlakHAP uses the [Custom Texture Update] feature to hide the\nsynchronization point in the background thread. It guarantees exact-frame\nplayback with minimum load on the main thread.\n\nOn macOS and Linux, the Custom Texture Update feature for this purpose is\nunavailable[^1]. Instead, KlakHAP delays synchronization to the successive\nframe to avoid main thread stalls. In other words, it guarantees exact-frame\nplayback but with a single-frame latency.\n\nYou can turn off this behavior by adding `HAP_NO_DELAY` to the\n[Scripting Define Symbols] in the project settings. It stalls the main thread\nfor every frame decoding. It would significantly slow down the application but\nis useful when exact frame matching is essential (e.g.,\n[volumetric video playback] with Alembic animation).\n\n[Custom Texture Update]:\n  https://github.com/keijiro/TextureUpdateExample\n\n[Scripting Define Symbols]:\n  https://docs.unity3d.com/Manual/CustomScriptingSymbols.html\n\n[volumetric video playback]:\n  https://github.com/keijiro/Abcvfx\n\n[^1]: The Custom Texture Update feature is available even on macOS/Linux but\n      doesn't support compressed texture formats, which are essential for HAP\n      decoding.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeijiro%2Fklakhap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkeijiro%2Fklakhap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkeijiro%2Fklakhap/lists"}