All Projects → keijiro → Klakhap

keijiro / Klakhap

Licence: other
HAP video player plugin for Unity

Projects that are alternatives of or similar to Klakhap

Lomenui
Stylish UI package for Unity engine.
Stars: ✭ 199 (-4.78%)
Mutual labels:  unity, unity3d
Unitysingleton
The best way to implement singleton pattern in Unity.
Stars: ✭ 185 (-11.48%)
Mutual labels:  unity, unity3d
Oxide.rust
Rust game extension for the Oxide modding framework
Stars: ✭ 185 (-11.48%)
Mutual labels:  unity, unity3d
Unitylive2dextractor
Unity Live2D Cubism 3 Extractor
Stars: ✭ 183 (-12.44%)
Mutual labels:  unity, unity3d
Asynccapturetest
Non-blocking screen capture example with asynchronous GPU readback
Stars: ✭ 191 (-8.61%)
Mutual labels:  unity, unity3d
Unityanime4k
Anime4K upscaler for Unity
Stars: ✭ 183 (-12.44%)
Mutual labels:  unity, unity3d
Unity Shaders
✨ Shader demo - More than 300 examples
Stars: ✭ 198 (-5.26%)
Mutual labels:  unity, unity3d
Htframework
Unity HTFramework, a rapid development framework of client to the unity.
Stars: ✭ 179 (-14.35%)
Mutual labels:  unity, unity3d
Shinyeffectforugui
Shiny effect of uGUI, which does not need mask or normal map.
Stars: ✭ 204 (-2.39%)
Mutual labels:  unity, unity3d
Isaura
An attempt at making a aura thingie with a isoline shader.
Stars: ✭ 187 (-10.53%)
Mutual labels:  unity, unity3d
Vfxpyro
Fireworks particle effect with Unity VFX Graph
Stars: ✭ 181 (-13.4%)
Mutual labels:  unity, unity3d
Vfxgraphtestbed
My testbed for Unity VFX Graph
Stars: ✭ 209 (+0%)
Mutual labels:  unity, unity3d
Kinobinary
Binary image effect for Unity
Stars: ✭ 180 (-13.88%)
Mutual labels:  unity, unity3d
Nice Lua
基于xlua的MVVM框架,支持Addressables, 统一渲染管线等Unity新特性
Stars: ✭ 207 (-0.96%)
Mutual labels:  unity, unity3d
Unitybarcodescanner
Simple Unity Barcode Scanner
Stars: ✭ 180 (-13.88%)
Mutual labels:  unity, unity3d
Videolabtest
OP-Z videolab examples
Stars: ✭ 186 (-11%)
Mutual labels:  unity, unity3d
Geovfx
Examples of geographical data visualization with Unity VFX Graph
Stars: ✭ 179 (-14.35%)
Mutual labels:  unity, unity3d
Lwrpambientocclusion
Post-Processing Stack v2 Ambient Occlusion works on Lightweight Render Pipeline
Stars: ✭ 179 (-14.35%)
Mutual labels:  unity, unity3d
Deadsimple Pixel Perfect Camera
An exceedingly easy-to-use pixel perfect orthographic camera script for 2D scenes in Unity. Punch in a few specs and you've got a working pixel perfect camera. It's that easy.
Stars: ✭ 186 (-11%)
Mutual labels:  unity, unity3d
Fluent State Machine
Fluent API for creating state machines in C#
Stars: ✭ 195 (-6.7%)
Mutual labels:  unity, unity3d

KlakHAP

GIF

KlakHAP is a Unity plugin that allows playing back a video stream encoded with the HAP video codecs.

HAP is a fast and high-quality video codec often used in real-time interactive applications. From the HAP Codecs website:

The HAP codecs are designed to fit the needs of a variety of real-time video workflows where ultra high resolution video is needed such as live event production, set design, 360 video for gaming, projection mapping and creative coding.

KlakHAP provides video frames as textures that can be used in any way on Unity's rendering pipeline — attaching to a material, presenting a full-screen video, animating a UI element, etc. Thanks to the performant design and implementation of the HAP codecs, it can dynamically control the playback time/speed without any hiccups.

System requirements

  • Unity 2019.4 or later

At the moment, KlakHAP only supports 64-bit desktop platforms (Windows, macOS and Linux).

Supported formats

KlakHap supports HAP, HAP Alpha and HAP Q. At the moment HAP Q Alpha is not supported.

KlakHap only supports QuickTime File Format as a container — in other words, it only supports .mov files.

Installation

This package uses the scoped registry feature to resolve package dependencies. Please add the following sections to the manifest file (Packages/manifest.json).

To the scopedRegistries section:

{
  "name": "Keijiro",
  "url": "https://registry.npmjs.com",
  "scopes": [ "jp.keijiro" ]
}

To the dependencies section:

"jp.keijiro.klak.hap": "0.1.18"

After changes, the manifest file should look like below:

{
  "scopedRegistries": [
    {
      "name": "Keijiro",
      "url": "https://registry.npmjs.com",
      "scopes": [ "jp.keijiro" ]
    }
  ],
  "dependencies": {
    "jp.keijiro.klak.hap": "0.1.18",
    ...

How to specify a video file

There are two methods to specify a video file in the plugin:

  • Streaming Assets Mode: Put a video file in the Streaming Assets directory and specify its file name.
  • Local File System Mode: Put a video file somewhere in local drive and specify its full path name.

The former method is recommended when the video file is delivered within the application. The latter method is useful when it needs to play an external content.

Hap Player component

Inspector

File Path and Path Mode are used to specify a source video file. Please see the previous section for details.

Time, Speed and Loop are used to set the initial playback state. You can also use these values to change the current state while playing.

Target Texture is used to store decoded frames into a render texture. Note that it allocates a small amount of GPU time for data transfer.

Target Renderer is used to apply a decoded texture to a specific material property. Although it's the most performant way to render video frames, it needs a few additional steps to be rendered correctly. The following points should be taken into account:

  • UV coordinate incompatibility: Decoded textures will be upside-down due to the difference in the UV coordinates conventions between Unity and HAP. It can be fixed using a vertically-inverted texture scale/offset. You can also use the Klak/Hap shader for this purpose.
  • Color space conversion for HAP Q: YCoCg conversion must be added to a shader when using HAP Q. You can also use the Klak/HAP Q for this purpose.

How to control playback

HapPlayer only provides a few properties/methods for controlling playback. This is an intentional design choice; I don't like to introduce ambiguity by adding common methods like Play, Stop or Pause. You can use the basic properties/methods to control playback instead.

  • To jump to a specific point: Assign a time in seconds to time.
  • To jump to a specific frame: Calculate the time in seconds using frameCount and streamDuration then assign it to time.
  • To reverse the playback direction: Assign a negative value to speed.
  • To pause: Assign 0 to speed.
  • To resume: Assign 1 to speed.
  • To stop: Assign false to enabled.
  • To close the video file: Destroy the HapPlayer component.
  • To open another video file: AddComponent<HapPlayer> then call Open.

Timeline support

GIF

The HAP Player component implements the ITimeControl interface that makes it able to control the playback time from a Control Track in a Timeline. You can easily create a control track with drag-and-dropping a HAP Player game object into the Timeline Editor, or manually create a Control Track/Clip and set the source game object.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].