An advanced C/C++ library for accelerated media encoding and decoding supporting modern codecs and GPU acceleration
libMediaCodec v1.0.0 has been released! See the release notes to learn about new features, enhancements, and breaking changes.
If you aren’t ready to upgrade yet, check the tags for previous stable releases.
We appreciate your feedback! Feel free to open GitHub issues or submit changes to stay updated in development and connect with the maintainers.
libMediaCodec is distributed as a pure C/C++ library. To integrate it into your project, ensure you have a compatible C/C++ compiler and the necessary build tools. Clone the repository and link against the library in your build system.
Encoding | Decoding |
---|---|
#include <mediacodec.h>
media::VideoEncoderConfig config {
.gpu_acceleration = true,
.input_format = media::PixelFormat::NV12,
.output_codec = media::CodecType::AV1,
.params = {
.width = 1920,
.height = 1080,
.bitrate = 5000000,
.framerate = 60,
}
};
auto encoder = media::VideoEncoder::Create(config);
if(!encoder) {
}
std::vector<uint8_t> yuv_data;
std::vector<uint8_t> av1_frame;
int success = encoder->Encode(yuv_data, &av1_frame);
if(!success) {
} |
#include <mediacodec.h>
media::VideoDecoderConfig dec_cfg {
.gpu_acceleration = true,
.input_codec = media::PixelFormat::NV12,
.output_format = media::PixelFormat::AV1
};
auto decoder = media::VideoDecoder::Create(dec_cfg);
if(!decoder) {
}
std::vector<uint8_t> av1_frame;
std::vector<uint8_t> yuv_data;
int success = decoder->Decode(av1_frame, &yuv_data);
if(!success) {
} |
Example Applications contain code samples demonstrating common use cases with libMediaCodec.
API Documentation provides a comprehensive reference of our Public APIs.
Now go build something amazing! Here are some ideas to spark your creativity:
- Accelerate media streaming services with optimized encoding and decoding.
- Develop a real-time video processing application with GPU-accelerated codec support.
- Create high-performance media servers utilizing modern codec standards.
- Implement fast transcoding systems for large video libraries.
- Integrate advanced video effects and filters leveraging GPU capabilities.
See BUILDING.md for building instructions.
- Supports a wide range of modern codecs: AV1, H264, HEVC, Opus, VP8, VP9.
- Seamless GPU acceleration for both encoding and decoding tasks.
- Built for speed and efficiency to handle large media files effortlessly.
- Parallel processing capabilities to maximize hardware utilization.
- Simplified API design for easy integration and use.
- Customizable parameters for fine-tuning performance and output.
- Comprehensive security features ensuring data integrity and protection.
- Regular updates to mitigate emerging vulnerabilities.
- Written entirely in C/C++ with minimal dependencies for maximum performance.
- Wide platform support: Windows, macOS, Linux, FreeBSD, and more.
Check out the contributing guide to join the team of dedicated contributors making this project possible.
MIT License - see LICENSE for full text