Skip to content

Nelonn/OpenMedia

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

45 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

OpenMedia

Open Media codecs abstraction - A modern, modular multimedia framework with a clean C++ API.

Overview

OpenMedia is a next-generation multimedia library designed to provide decoding, encoding, and demuxing capabilities for audio, video, and image formats. Built with modern C++20, it offers a flexible plugin-style architecture for codec integration while maintaining a simple, intuitive API.

Note: Not all codecs currently support encoding yet and is currently a work in progress. The library currently focuses on decoding and demuxing.

Key Features

  • Audio Codecs: AAC, ALAC, FLAC, Opus, Vorbis, MP3, AAC, PCM, and more
  • Video Codecs: AV1, H.264/AVC, H.265/HEVC, H.266/VVC, EVC, VP8, VP9, and more
  • Image Formats: PNG, JPEG, WebP, GIF, BMP, TIFF, TGA
  • Container Support - Matroska (MKV/MKA/WebM), MP4, Ogg, Wav, and more
  • Modular Architecture - Enable/disable codecs at compile-time via CMake options
  • Hardware Acceleration - Support for Vulkan Video, DirectX 11/12 Video, VA-API
  • Modern C++20 API - Clean, type-safe interfaces, exception-free, rtti-free
  • Example Player - SDL3-based reference player

Implemented Codecs

Audio Codecs

Status: โœ… Implemented | ๐Ÿ”ง Planned

Codec Decoding Encoding Backends
AAC โœ… โœ… libfdk-aac, WMF, FFmpeg
ALAC โœ… โœ… libalac, FFmpeg
FLAC โœ… ๐Ÿ”ง libFLAC, FFmpeg
Opus โœ… โœ… libopus, FFmpeg
Vorbis โœ… โœ… libvorbis, FFmpeg
MP3 โœ… ๐Ÿ”ง minimp3, WMF, FFmpeg
WAV/PCM โœ… โœ… OpenMedia

Video Codecs

Status: โœ… Implemented | ๐Ÿ”ง Planned

Codec Decoding Encoding Backends
AV1 โœ… ๐Ÿ”ง Hardware, dav1d (decoding only)
VP8/VP9 โœ… โœ… Hardware, libvpx
H264/AVC โœ… โœ… Hardware, OpenH264, FFmpeg
H265/HEVC โœ… โœ… Hardware, FFmpeg
H266/VVC โœ… ๐Ÿ”ง VVdeC (Broken), VVenC, FFmpeg
Apple ProRes โœ… ๐Ÿ”ง Apple Hardware + FFmpeg only
EVC Untested Untested xevd, xeve

Image Codecs

Status: โœ… Implemented | ๐Ÿ”ง Planned

Codec Decoding Encoding Backends
PNG โœ… ๐Ÿ”ง Portable Network Graphics (decoder & demuxer)
JPEG โœ… ๐Ÿ”ง Joint Photographic Experts Group
WebP โœ… ๐Ÿ”ง Modern image format by Google
GIF โœ… ๐Ÿ”ง Graphics Interchange Format
BMP โœ… ๐Ÿ”ง Bitmap image format
TIFF โœ… ๐Ÿ”ง Tagged Image File Format
TGA โœ… ๐Ÿ”ง Truevision TARGA
EXR ๐Ÿ”ง ๐Ÿ”ง OpenEXR

Hardware Acceleration

OpenMedia provides interfaces for hardware-accelerated decoding and encoding:

Status: โœ… Implemented | ๐Ÿ”ง Planned

API Status Platform
VideoToolbox Done macOS
VA-API Only H264 High Linux
AMF Decoding Only Windows
Vulkan Video Only H264 Decode Windows/Linux
DirectX 11 Video Mostly done but unstable Windows
DirectX 12 Video Mostly done but unstable Windows
CUDA/NVDEC TBD Windows/Linux
NVENC TBD Windows/Linux
Intelยฎ Media SDK ๐Ÿ”ง Windows
MediaCodec Untested Android

Container Formats

Status: โœ… Implemented | ๐Ÿ”ง Planned

Format Demuxing Muxing Description
Matroska (MKV/MKA/WebM) โœ… โœ… Matroska container (libwebm)
MP4/MOV/M4A (BMFF) โœ… ๐Ÿ”ง ISO Base Media File Format
MOV/QuickTime (BMFF) โœ… ๐Ÿ”ง Apple QuickTime format
Ogg โœ… โœ… Ogg container
WAV โœ… โœ… WAV container
FLAC โœ… ๐Ÿ”ง FLAC container
MP3 โœ… ๐Ÿ”ง MP3 container
AVI ๐Ÿ”ง Not planned Audio Video Interleave

Building

Requirements

  • CMake 3.21+
  • C++20 compatible compiler (Clang, MSVC, GCC)

Example Build

mkdir build && cd build
cmake .. -DOPENMEDIA_EXAMPLES=ON
cmake --build .

Usage Example

#include <openmedia/codec_api.hpp>
#include <openmedia/format_detector.hpp>
#include <openmedia/codec_registry.hpp>
#include <openmedia/format_registry.hpp>

using namespace openmedia;

int main() {
    // Initialize registries
    CodecRegistry codec_registry;
    FormatRegistry format_registry;
    FormatDetector format_detector;
    
    // Register built-in codecs and formats
    registerBuiltInCodecs(&codec_registry);
    registerBuiltInFormats(&format_registry);
    format_detector.addAllStandard();
    
    // Create decoder for a specific codec
    auto decoder = codec_registry.createDecoder(OM_CODEC_AV1);
    if (decoder) {
        DecoderOptions options;
        options.format = /* ... */;
        decoder->configure(options);
        
        auto result = decoder->decode(packet);
        if (result.isOk()) {
            auto frames = result.unwrap();
            // Process decoded frames...
        }
    }
    
    return 0;
}

License

OpenMedia is provided under the terms of its respective license. See LICENSE for details.


Contributing

Contributions are welcome! Whether it's adding new codecs, improving existing implementations, or fixing bugs, please feel free to submit issues and pull requests.


About

OpenMedia

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages