View on GitHub

PopH264

Low-level, minimal H264 decoder & encoder library with wide cross platform support. Doesn't try to be clever. CAPI

Build Status

Build Windows Build Linux Build Apple Build Android Create Release

About

PopH264 was created to provide simple & consistent access to low level/native H264 decoders and encoders across various platforms, for use in C-API apps (eg. PopEngine), and Unity. It is certainly not limited to these engines, but that is the bulk of the use.

It is designed to be incredibly simple; does absolutely no syncronisation, no CPU heavy conversions (it specifically tries to use native paths which avoid ANY conversion) with the idea that the caller will implement this on GPU on demand instead, and intends to be purely data-in-data-out. It internally uses threads where we NEED to, but we try and avoid this, so Push-frame and Pop-frame functions are supposed to be synchronous (although the Pop-frame functions essentially just remove already-buffered data). Again, the intention is for the user to thread these for their own needs.

It is also designed to expose all possible options (encoding and decoding) for obscure edge cases, and expose as much meta information as possible (including timestamps for various parts of encoding/decoding for profiling)

History

The project is basically a re-write of PopMovieTexture https://gitlab.com/NewChromantics/PopMovieTexture / http://popmovie.xyz which was a Unity plugin/lib which tried to decode Mp4s, handle audio streams, blit to RGB textures etc. Since Unity implemented their own video player the need for a simple video player was wiped out. Whilst not perfect, it does handle 99% of use cases.

PopH264 still has a niche to fill where users need very precise synchronisation, or access to raw YUV planes, custom YUV colour matrix implementation etc.

Video Containers

PopH264 does not implement any extractors, neither the native ones (which vary in support from platform to platform), nor custom implementations. Because containers are usually so simple, yet vary so wildly with implementations, it became much more apparent a high-level (c#) decode was much more useful for debugging, workarounds with odd formats etc, when the H264 streams stayed the same.

We have an MP4 decoder implementation here, https://github.com/NewChromantics/PopCodecs but you can implement your own, use libav/ffmpeg, use custom streams, etc etc. Many people use PopH264 with their own minimal container for low overheads, or simplicity.

Future

Sponsorship/Funding

Whilst we do happily accept money, we currently haven’t setup github sponsoring. If you wish to sponsor via a particular method, send bitcoin, leave an issue or get in touch; graham@newchromantics.com / @soylentgraham

Rather than any trickle payments, we do encourage people to ask for commissioned new features/improvements/platform support. Feel free to ask for them in issues, even if you have no budget. (But please submit bugs regardless!)

Financial Contributers (Thank you!)

These people have already contributed money towards the project. (Get in touch ASAP if I have missed you out!)

API Documentation

The bulk of the API documentation is in PopH264.h, which is kept up-to-date as code changes.

Installation

Unity

Install as a unity package using their scoped registry system;

Platform Support

Any empty platforms are generally planned, but not yet implemented.

Platform Software Decoding Hardware Decoding Software Encoding Hardware Encoding
Windows x86        
Windows x64 Broadway MediaFoundation   MediaFoundation
Windows UWP Hololens1        
Windows UWP Hololens2        
Linux arm64 for Nvidia Jetson Nano Broadway   x264 V4L2 (Nvidia)
Linux arm for Raspberry PI 1,2,Zero (untested) Broadway   x264  
Linux arm for Raspberry PI 3 Broadway   x264  
Linux x64 ubuntu Broadway   x264  
Osx Intel Broadway AvFoundation x264 AvFoundation
Osx Arm64 Broadway AvFoundation   AvFoundation
Ios Broadway AvFoundation   AvFoundation
Ios Simulator Untested Untested Untested Untested
Android armeabi-v7a Broadway NdkMediaCodec    
Android x86 Broadway NdkMediaCodec    
Android x86_64 Broadway NdkMediaCodec    
Android arm64-v8a Broadway NdkMediaCodec    
Magic Leap/Luma (Linux x86) Broadway MLMediaCodec Google,Nvidia    
Web Broadway.js*      
Unity WebGL        

Android

Unity Decoder Support

Unity Encoder Support

Unreal Support

Build Instructions

Windows ————-

Osx & Ios

Linux

Start Self Hosted Runner as a Service

Android

Unity Development

Macos ———— When building the plugin, build the OSX framework. The universal framework currently doesn’t “install” (copy to /Unity/PopH264/Assets/PopH264) in PopH264.cs disable the define POPH264_AS_FRAMEWORK

Android

Unity Integration

Web Integration

Misc Notes

The following are various notes which PopH264 handles. (Or at least, it should handle and there should be an issue covering it if not).

MediaFoundation

Broadway

Android