devejesus / video-encoder
A simple PHP-based video encoder that converts raw RGB24 frames to YUV420p format using custom pixel processing.
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/devejesus/video-encoder
Requires
- php: >=8.0
Requires (Dev)
- laravel/pint: ^1.22
- pestphp/pest: ^3.0
- phpstan/phpstan: ^2.1
README
A simple PHP-based video encoder that converts raw RGB24 frames to YUV420p format using custom pixel processing.
Features
- Convert RGB24 frames to YUV420p format
- Efficient pixel processing
- Simple and easy-to-use interface
- No external dependencies required
Requirements
- PHP >= 8.0
Installation
You can install the package via composer:
composer require devejesus/video-encoder
Usage
use Devejesus\VideoEncoder\Encoder\RGB24ToYUV420Encoder; use Devejesus\VideoEncoder\Model\VideoConfig; // Create a video configuration $config = new VideoConfig(384, 216); // width and height must be even numbers // Initialize the encoder $encoder = new RGB24ToYUV420Encoder(); // Convert the video try { $encoder->encode( 'input.rgb24', // Input file path (RGB24 format) 'output.yuv', // Output file path (YUV420p format) $config ); echo "Conversion completed successfully!\n"; } catch (\Exception $e) { echo "Error: " . $e->getMessage() . "\n"; }
Input Format Requirements
- The input file must be in RGB24 format
- Width and height must be even numbers
- Each pixel is represented by 3 bytes (R, G, B)
- No headers or metadata in the file
Testing
composer test
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This package is licensed under the MIT License - see the LICENSE file for details.