VidWeave is a lightweight, Zig-powered backend designed for efficient video processing. It handles tasks like transcoding, chunking videos into multiple quality levels, and saving metadata to an SQLite database. VidWeave also provides a REST API for seamless integration with other services.
- Video Processing: Transcode videos into multiple quality chunks.
- SQLite Integration: Save video metadata and processing details in an SQLite database.
- REST API: Easily integrate with your frontend or other services.
- Zig (latest version)
- FFmpeg (for video processing)
- SQLite3
- Zap
-
Clone this repository:
git clone https://github.com/yourusername/VidWeave.git cd VidWeave -
Install dependencies (ensure FFmpeg and SQLite are installed on your system).
-
Build the project:
zig build
Run the application:
zig build runThe provided API and database schema define a clear workflow for uploading, managing, and streaming videos. Below is a summary and clarification for ease of understanding:
- Endpoint:
/api/upload - Method:
POST - Purpose: Allows uploading a video with metadata like name, description, quality, and a thumbnail.
- Required Fields:
name,description,quality,thumbname,video.
- Endpoint:
/api/video/{vid} - Method:
GET - Purpose: Retrieves video details using the video ID.
- Response Data:
- Metadata (
name,description,quality, etc.). - Video paths.
- Metadata (
- Endpoint:
/api/video/{vid} - Method:
DELETE - Purpose: Deletes a specific video by its ID.
- Response: Success message.
- Endpoint:
/api/video/{vid} - Method:
PUT - Purpose: Updates metadata and video files for a specific video.
- Request Fields: Similar to the upload endpoint.
- Endpoint:
/api/player - Method:
GET - Purpose: Fetches player configuration settings, including video and audio files at different resolutions.
The Video table structure supports the following:
- Unique identifiers for users (
uid) and videos (vid). - Fields for metadata (
name,description,quality). - JSON structure for video paths, e.g.,
{ "720p:1": "/path/to/part1", ... }. - Timestamps for creation and updates.
- Streams videos and handles buffering.
- Synchronizes playback with client-side players.
- Configuration is stored in a JSON-like structure.
├── src/
│ ├── main.zig # Main application file
│ ├── api.zig # API endpoint handlers
│ ├── video_processor.zig # Video processing logic
│ ├── db.zig # SQLite database integration
├── build.zig # Build script
├── README.md # Project documentation
- Video Splitting: The server should handle segmenting videos into parts for efficient streaming (e.g.,
320p:1,720p:1). - Buffer Management: Ensure the buffer size and synchronization intervals in
playerConfigmatch the expected client performance. - Security: Protect endpoints, especially upload and delete, with authentication/authorization.
- Error Handling: Define error responses for cases like invalid video IDs, incomplete uploads, or configuration mismatches.
Contributions are welcome! Please open an issue or submit a pull request with your improvements.
This project is licensed under the MIT License. See LICENSE for details.