phoboslab/pl_mpeg
FreeSingle file C library for decoding MPEG1 Video and MP2 Audio
About phoboslab/pl_mpeg
PL_MPEG is a single-file, MIT-licensed C/C++ library for decoding MPEG1 video and MP2 audio, as well as demuxing MPEG-PS containers. It is designed to provide a simple way to get video playback into applications and games without the overhead of large libraries like FFmpeg. The library is patent-free (all MPEG1/MP2 patents have expired) and can decode 4K60fps video on a single CPU core (tested on i7-6700K) without SIMD instructions. It includes example applications: a command-line tool to extract frames as BMPs, and video players using SDL2/OpenGL or SDL2's 2D renderer. Limitations include no error reporting (silently ignores invalid data), ignoring presentation timestamps (may cause sync issues), and no support for MPEG2 video.
Key Features
Pros & Cons
- Extremely simple integration – single file, no build system complexity
- No huge library dependencies like FFmpeg or GStreamer
- All patents related to MPEG1 and MP2 have expired, ensuring legal safety
- Fast enough for 4K60fps decoding on a modern CPU without SIMD
- Open source under permissive MIT license
- Includes ready-to-use example programs for quick testing
- No error reporting – invalid data is silently ignored, making debugging hard
- Ignores presentation timestamps (PTS), which may cause audio/video sync issues
- Supports only MPEG1 video and MP2 audio; no MPEG2, H.264, or other modern codecs
- No SIMD optimizations – performance relies on CPU clock speed
- Only handles MPEG-PS (.mpg) containers; not MP4, AVI, etc.
- Library is minimal – lacks advanced features like seeking, streaming, or container parsing beyond demuxing