{"id":24164522,"url":"https://github.com/ntphuc149/end2endvideoencodevmaf","last_synced_at":"2026-05-17T15:02:39.888Z","repository":{"id":271806412,"uuid":"914624844","full_name":"ntphuc149/End2EndVideoEncodeVMAF","owner":"ntphuc149","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-03T15:32:11.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-03T16:44:45.686Z","etag":null,"topics":["ffmpeg","per-title-encoding","video-encoding","video-processing","vmaf"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ntphuc149.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-10T01:02:59.000Z","updated_at":"2025-05-03T15:32:14.000Z","dependencies_parsed_at":"2025-09-01T12:38:25.221Z","dependency_job_id":null,"html_url":"https://github.com/ntphuc149/End2EndVideoEncodeVMAF","commit_stats":null,"previous_names":["ntphuc149/end2endvideoencodevmaf"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ntphuc149/End2EndVideoEncodeVMAF","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntphuc149%2FEnd2EndVideoEncodeVMAF","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntphuc149%2FEnd2EndVideoEncodeVMAF/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntphuc149%2FEnd2EndVideoEncodeVMAF/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntphuc149%2FEnd2EndVideoEncodeVMAF/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ntphuc149","download_url":"https://codeload.github.com/ntphuc149/End2EndVideoEncodeVMAF/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ntphuc149%2FEnd2EndVideoEncodeVMAF/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273124227,"owners_count":25049990,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-01T02:00:09.058Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ffmpeg","per-title-encoding","video-encoding","video-processing","vmaf"],"created_at":"2025-01-12T19:17:36.732Z","updated_at":"2026-05-17T15:02:34.827Z","avatar_url":"https://github.com/ntphuc149.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# End2EndVideoEncodeVMAF\n\nA comprehensive video encoding automation tool with VMAF (Video Multi-Method Assessment Fusion) quality assessment capabilities. This system automates the process of encoding videos using different codecs and profiles while measuring perceptual quality metrics.\n\n![Python](https://img.shields.io/badge/python-3.x-blue.svg)\n![MySQL](https://img.shields.io/badge/MySQL-8.0+-orange.svg)\n![FFmpeg](https://img.shields.io/badge/FFmpeg-required-green.svg)\n![License](https://img.shields.io/badge/license-MIT-blue.svg)\n\n## 🚀 Features\n\n- **Multi-codec Support**: Encode videos using H.264 and H.265 (HEVC) codecs\n- **Profile Management**: Supports various encoding profiles for different use cases\n- **Resolution Analysis**: Handles multiple resolutions from 240p to 2160p (4K)\n- **VMAF Integration**: Automatically calculates VMAF scores for quality assessment\n- **Batch Processing**: Process multiple video files across different genres\n- **Database Integration**: MySQL-based codec and profile management\n- **Extensive Logging**: Detailed logging for monitoring and debugging\n- **CSV Export**: Generates comprehensive encoding data in CSV format\n\n## 📋 Prerequisites\n\n### System Requirements\n- Python 3.x\n- MySQL 8.0+\n- FFmpeg with VMAF library support\n\n### Dependencies\n```bash\npython-dotenv\nmysql-connector-python\npandas\ntqdm\n```\n\n## 🛠️ Installation\n\n1. **Clone the repository**\n```bash\ngit clone https://github.com/ntphuc149/End2EndVideoEncodeVMAF.git\ncd End2EndVideoEncodeVMAF\n```\n\n2. **Create virtual environment**\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\n```\n\n3. **Install dependencies**\n```bash\npip install -r requirements.txt\n```\n\n4. **Configure environment variables**\n```bash\ncp .env.example .env\n# Edit .env with your database credentials\n```\n\n5. **Prepare directories**\n```bash\n# Create necessary directories\nmkdir -p data/s_video/genre_1\nmkdir -p data/s_video/genre_2\nmkdir -p data/e_video\nmkdir -p logs\n```\n\n## ⚙️ Configuration\n\n### Environment Variables\nThe system uses environment variables for configuration. Create a `.env` file with the following variables:\n\n```env\n# MySQL Configuration\nMYSQL_HOST=your_sql_host\nMYSQL_PORT=your_sql_port\nMYSQL_DB=your_database\nMYSQL_USER=your_username\nMYSQL_PASS=your_password\n\n# H.264 Bitrates (kbps)\nH264_2160P_BITRATES=[19400,19600,19800,20000,20200,20400,20600]\nH264_1440P_BITRATES=[9400,9600,9800,10000,10200,10400,10600]\nH264_1080P_BITRATES=[3800,4000,4200,4400,4600,4800,5000]\n# ... (add remaining bitrate configurations)\n```\n\n### Directory Structure\n```\nEnd2EndVideoEncodeVMAF/\n├── conf/\n│   ├── config.py           # Database and configuration management\n│   └── log_config.py       # Logging configuration\n├── data/\n│   ├── s_video/           # Source videos (organized by genre)\n│   ├── e_video/           # Encoded output videos\n│   └── dataset.csv        # Encoding results log\n├── logs/\n│   └── log.log            # Application logs\n├── process/\n│   └── calculate_vmaf.py  # VMAF calculation utilities\n├── utils/\n│   └── utils.py           # Core utility functions\n├── main.py                # Main application entry point\n├── requirements.txt       # Project dependencies\n└── README.md             # Project documentation\n```\n\n## 🚀 Usage\n\n### Basic Usage\n```bash\npython main.py\n```\n\n### How It Works\n\n1. **Initialization**: The system connects to MySQL database to retrieve available codecs and profiles\n2. **Video Processing**: Iterates through source videos in different genre folders\n3. **Encoding**: For each video, applies different codec/profile combinations with various bitrates\n4. **Quality Assessment**: Calculates VMAF scores comparing original and encoded videos\n5. **Data Collection**: Saves encoding results and VMAF scores to CSV for analysis\n\n### Input Video Placement\nPlace your source videos in the appropriate genre folders:\n```\ndata/s_video/action/video1.mp4\ndata/s_video/drama/video2.mp4\ndata/s_video/comedy/video3.mp4\n```\n\n### Output\n- Encoded videos: `data/e_video/{genre}/{video_name}_encoded_{codec}_{profile}_{bitrate}k.yuv`\n- Encoding log: `data/dataset.csv`\n- Application logs: `logs/log.log`\n\n## 📊 Output Data Format\n\nThe system generates a CSV file with the following columns:\n\n| Column | Description |\n|--------|-------------|\n| s_name | Source video filename |\n| s_width | Source video width |\n| s_height | Source video height |\n| s_size | Source video file size |\n| s_duration | Source video duration |\n| s_scan_type | Scan type (progressive/interlaced) |\n| s_content_type | Video genre/category |\n| e_width | Encoded video width |\n| e_height | Encoded video height |\n| e_aspect_ratio | Encoded video aspect ratio |\n| e_pixel_aspect_ratio | Pixel aspect ratio |\n| e_codec | Codec used (h264/h265) |\n| e_codec_profile | Encoding profile used |\n| e_codec_level | Codec level |\n| e_framerate | Frame rate |\n| e_gop_size | GOP size |\n| e_b_frame_int | B-frame interval |\n| e_scan_type | Scan type |\n| e_bit_depth | Bit depth |\n| e_pixel_fmt | Pixel format |\n| e_bitrate | Target bitrate |\n| e_max_bitrate | Maximum bitrate |\n| e_buffer_size | Buffer size |\n| e_size | Encoded file size |\n| e_duration | Encoded video duration |\n| t_vmaf | VMAF score |\n\n## 🔧 Database Schema\n\nThe system requires MySQL stored procedures:\n- `get_available_codec_name()`: Retrieves available codecs\n- `get_available_profile_name(codec_name)`: Gets profiles for a specific codec\n- `get_profile_detail(codec_name, profile_name)`: Gets detailed profile parameters\n\n## 🛠️ Development\n\n### Class Architecture\n\n1. **Config**: Database configuration and validation\n2. **MySqlConnectionPool**: Singleton connection pool manager\n3. **DBAccess**: Database access layer\n4. **DataProcessor**: CSV data handling\n5. **FFmpegCommandGenerator**: FFmpeg command generation and execution\n6. **VideoAnalyzer**: Video analysis utilities\n7. **VMAFCalculator**: VMAF score calculation\n\n### Extending the System\n\nTo add new codecs or modify encoding parameters:\n1. Update database profiles\n2. Add appropriate bitrate ranges in `.env`\n3. Extend `FFmpegCommandGenerator` if needed\n\n## 📝 Logging\n\nThe system provides comprehensive logging:\n- **Debug level**: Detailed operation information\n- **Info level**: General status updates\n- **Error level**: Error conditions and exceptions\n- **Log rotation**: Daily log file rotation\n\n## 🤝 Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/AmazingFeature`)\n3. Commit your changes (`git commit -m 'Add some AmazingFeature'`)\n4. Push to the branch (`git push origin feature/AmazingFeature`)\n5. Open a Pull Request\n\n## 📄 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## 👤 Author\n\n**Truong-Phuc Nguyen**\n- GitHub: [@ntphuc149](https://github.com/ntphuc149)\n\n## 🙏 Acknowledgments\n\n- FFmpeg community for the powerful encoding tools\n- Netflix for the VMAF metric\n- Contributors and testers\n\n## 📞 Support\n\nFor support, please open an issue in the GitHub repository.\n\n---\n\n**Note**: This tool is designed for research and quality analysis purposes. Ensure you have proper licensing for any content you process with this system.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntphuc149%2Fend2endvideoencodevmaf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fntphuc149%2Fend2endvideoencodevmaf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntphuc149%2Fend2endvideoencodevmaf/lists"}