danog / php-rtc-codecs
WebRTC audio/video codec and RTP packetization utilities. MadelineProto's PHP 8.2+ fork adds optional transcoding FFI, VP9 packetization, and the modular danog/php-rtc stack.
Fund package maintenance!
Requires
- php: ^8.2
- danog/php-rtc-av: ^1.1.3
- danog/php-rtc-exception: ^1.1.5
- danog/php-rtc-rtp-parameter: ^1.1.4
Requires (Dev)
- bamarni/composer-bin-plugin: ^1.9.1
- phpunit/phpunit: ^11.5 || ^12.0 || ^13.3.2
Suggests
- ext-ffi: Install the FFI extension and libopus/libvpx/libavcodec to transcode media; not required to packetize already-encoded media
Provides
None
Conflicts
None
Replaces
None
README
A comprehensive codec implementation package for WebRTC applications, providing audio/video encoding and decoding capabilities.
About this fork
This is the danog/php-rtc-codecs fork used by MadelineProto. It targets PHP 8.2+, can packetize already-encoded media without FFI, and adds VP9 RTP payload parsing and packetization alongside the existing Opus, VP8, and H.264 support.
All internal Composer dependencies use their danog/php-rtc-* package names directly, so installing a component selects the maintained danog packages throughout the dependency graph.
Features
🎧 Audio Codecs
- Opus (encode/decode)
- PCM A-law (encode/decode)
- PCM μ-law (encode/decode)
📹 Video Codecs
- VP8 (encode/decode)
- H.264 (encode/decode)
🛠Core Functionality
- RTP payload packetization/depacketization(H.264 and VP8)
- Dynamic bitrate control
- Frame timestamp management
- Hardware acceleration support
- Thread-optimized encoding/decoding
Requirements
Requirements
- PHP ≥ 8.2
- FFI and matching native codec libraries only when encoding, decoding, or transcoding media
- Linux (Windows and macOS support planned for future releases)
- FFmpeg/libav shared libraries (libavcodec, libavfilter, etc.)
- Compatible with FFmpeg version 7.1.1
- libopus development libraries
- libvpx development libraries
- Compatible with libvpx version 1.15.0
Documentation
This package is part of the PHP WebRTC library. For complete documentation, examples, and API reference, visit:
Credits
Authors
-
Amin Yazdanpanah
- Website: aminyazdanpanah.com
- Email: github@aminyazdanpanah.com
-
Sana Moniri
- GtiHub: sanamoniri
Reporting Issues
Found a bug? Please report it on our issues.
License
BSD 3-Clause License. See LICENSE for details.