• This repository has been archived on 05/Dec/2021
  • Stars
    star
    128
  • Rank 279,760 (Top 6 %)
  • Language
    C++
  • License
    MIT License
  • Created almost 6 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Fast video playback on Unity using GPU Decoding

Note .

Thanks to xue-fei for identifying the original authors of the CPP code. Please refer to MediaPlayback for a more suitable solution.

This repository is not being actively maintained. Issues may not be addressed.

GPUVideoPlayer

Alternative to Unity's VideoPlayer component. Run HEVC/H265 videos with GPU decoding, lower loading times and better performance.

API/Usage

The GPUVideoPlayer class derives from MonoBehaviour and needs to be on the scene. GPUVideoPlayer component also provides some primitive auto play features.

Methods:

  • Load(string) : void
    Where the passed parameter is the URL or path of the video
  • Play() : bool
    Which plays (or resumes) the video playback and returns a boolean based on whether the command was successful
  • Pause() : bool
    Pauses the video and returns if the command was successful
  • Stop() : bool
    Stops the video playback and returns if the command was successful
  • GetPlaybackRate() : double
    Returns the rate at which the video is being played
  • GetDuration() : long
    Returns the length of the video in 1/10^7 seconds
  • SeekByRatio(float ratio) : bool
    Sets the position of the video player at ratio completion stage and returns if the attempt was successful
  • SeekByTime(long position) : bool
    Sets the position of the video player at position time. position is in 1/10^7 second units

C# Properties:

  • MediaTexture
    Returns the Texture2D object that is updated by the plugin with video frames
  • MediaDescription
    Returns some information of the video being played. These include the video width, height, duration and whether it can be seeked on.

States and Events:

The states of a GPUVideoPlayer instance is represented using an enum called `GPUVideoPlayer.State' and has the following values:

  • Idle
  • Loaded
  • Failed
  • Playing
  • Paused
  • Stopped
  • Ended

The current state can be obtained using GPUVideoPlayer.MediaState which derives from UnityEvent<GPUVideoPlayer.State>

Performance

  • GPUVideoPlayer was tested with an 800mb 8192x4096 30FPS H265 MP4 video file. Loading took 195 ms. Video playback was at 30FPS with Unity's framerate at 60.

Getting Started

  • A simple video player app with load, pause, stop, 5sec FWD, 5sec BWD is available inside the Demo folder. The demo should be a good example to see how to get started.

Notes

  • Currently runs only on Microsoft Windows. Tested on 64 bit OS.
  • May require HEVC Video Extensions based on your usage.

Contact

@github
@www

More Repositories

1

tork

Arcade vehicle physics for Unity
C#
428
star
2

univoice

Voice chat/VoIP solution for unity.
C#
348
star
3

unimic

Unity's Microphone class, enhanced.
C#
111
star
4

unex

Unity3D, extended. Includes hotkeys, C# extensions, utilities and more.
C#
61
star
5

UniGOAP

A work-in-progress Unity3D solution for intellignt NPCs for use in video games, simulations and similar media.
C#
57
star
6

UniDLL

Editor window to create DLLs from C# code in Unity
C#
51
star
7

airpeer

A WebRTC based networking plugin for Unity
C#
48
star
8

UniLang

Translate text from one language to another using Google Translate
C#
37
star
9

UniVRMedia

Stream 360 videos in Unity using its VideoPlayer component entirely through code and not editor setup.
C#
33
star
10

UniCV

[WIP] OpenCV for Unity with boilerplate code
C#
26
star
11

mediaplayer

A standardised media player interface for Unity with subtitle parser.
C#
21
star
12

upm-template

A template for making UPM based Unity packages
20
star
13

UniCull

[WIP] A renderer culling library for Unity. Includes distance based frustum culling. Hoping to make screen space occlusion culling too.
C#
16
star
14

RestSharp.Unity

A UPM package for RestSharp with some extensions and extra stuff.
C#
15
star
15

UniSpeech

A simple to use Speech Recognition library for Unity based on the Microsoft Cognitive Services
C#
15
star
16

ugx

UGX: UGUI Extended is a high-level library over Unity's inbuilt uGUI.
C#
12
star
17

univoice-sample

A sample voice chat app using univoice
C#
11
star
18

BeneDict

A code generating wizard that works on Fredrik Ludvigsen's SerializableDictionary on wiki.unity3d.com
C#
10
star
19

UniSpline

A Unity tool for creating curves
C#
9
star
20

airsignal

Node base WebRTC Signalling server. Used with AirPeer.
8
star
21

Xavier

A Networking solution for Unity based on Telepathy
C#
8
star
22

UniFace

A C# API for modifying UV spaces in Unity3D
C#
7
star
23

trill

Data transmission using sound waves
C#
6
star
24

unity-3.x-car-tutorial

The good old Unity car tutorial.
C#
6
star
25

univoice-mirror-network

A Mirror based implementation for UniVoice voice network
C#
6
star
26

mongodb.entities.unity

A UPM package of MongoDB.Entities for the Unity game engine
C#
5
star
27

UniDecal

🚧 A real-time + baked decal solution for Unity
5
star
28

surge.tween

UPM project for Tween features in the Surge toolset by Pixel Placement
C#
4
star
29

univoice-unimic-input

C#
4
star
30

UniStream

Read/Write Unity objects from/to byte streams
C#
4
star
31

UniGenVR

Make interactive VR experiences for mobile devices without writing any (or much) code
C#
3
star
32

CsvUtility

A small tool for reading CSV files in C#. Made for Unity
C#
3
star
33

univoice-audiosource-output

C#
3
star
34

UniCDN

CDN adapter for Unity. Currently supports PlayerIO GameFS CDN out of the box
C#
3
star
35

adrenak.github.io

Personal website
CSS
2
star
36

github-gameoff-2020

Entry for the Github Gameoff game jam 2020. Retro fighter jet game.
C#
2
star
37

univoice-telepathy-network

C#
2
star
38

AmazonFlingUnity

A Unity wrapper over Amazon Fling SDK to cast videos to FireTV and Firestick devices. Currently supports only Android and only second screen applications (phone controller/remote).
C#
2
star
39

vboard

C#
1
star
40

spatial

C#
1
star
41

utf8json

A UPM friendly repo of utf8json for Unity
C#
1
star
42

NewMorning

A quick VR game made with primitive Unity models, NewtonVR for Oculus Rift (and other VR devices)
C#
1
star