{"id":45448702,"url":"https://github.com/leocodeio/synctest","last_synced_at":"2026-02-22T04:36:27.440Z","repository":{"id":337359253,"uuid":"1150413773","full_name":"leocodeio/synctest","owner":"leocodeio","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-09T05:45:48.000Z","size":40,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-09T10:52:46.796Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leocodeio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"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":"2026-02-05T08:50:26.000Z","updated_at":"2026-02-09T05:45:51.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/leocodeio/synctest","commit_stats":null,"previous_names":["leocodeio/synctest"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/leocodeio/synctest","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocodeio%2Fsynctest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocodeio%2Fsynctest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocodeio%2Fsynctest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocodeio%2Fsynctest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leocodeio","download_url":"https://codeload.github.com/leocodeio/synctest/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leocodeio%2Fsynctest/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29704838,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T03:17:42.375Z","status":"ssl_error","status_checked_at":"2026-02-22T03:17:31.622Z","response_time":110,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-02-22T04:36:26.775Z","updated_at":"2026-02-22T04:36:27.429Z","avatar_url":"https://github.com/leocodeio.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Beat-Synced Video Generator\n\nAn intelligent video segmentation and assembly system that automatically creates synchronized videos from raw footage and music tracks using AI-powered beat detection and motion analysis.\n\n## Features\n\n- **Beat Detection**: Automatically analyzes music tracks to identify beats and tempo using librosa\n- **Scene Detection**: Intelligently segments videos into scenes using PySceneDetect\n- **Motion Analysis**: Calculates motion intensity using OpenCV optical flow\n- **Smart Assembly**: Matches video segments to beat intervals for perfect synchronization\n- **Modern UI**: Clean, intuitive interface built with TailwindCSS\n- **Real-time Progress**: Live status updates during processing\n\n## Architecture\n\nThe system uses a layered architecture:\n\n- **Frontend**: HTML/JavaScript/TailwindCSS single-page application\n- **API Layer**: FastAPI backend with REST endpoints\n- **Service Layer**: \n  - `AudioService`: Beat tracking with librosa\n  - `VideoService`: Scene detection with PySceneDetect and motion analysis with OpenCV\n  - `AssemblyService`: Video compilation with MoviePy\n\n## Prerequisites\n\n- Python 3.8+\n- FFmpeg (required for MoviePy)\n\n### Installing FFmpeg\n\n**Windows**:\n```bash\n# Using Chocolatey\nchoco install ffmpeg\n\n# Or download from https://ffmpeg.org/download.html\n```\n\n**macOS**:\n```bash\nbrew install ffmpeg\n```\n\n**Linux (Ubuntu/Debian)**:\n```bash\nsudo apt update\nsudo apt install ffmpeg\n```\n\n## Installation\n\n1. **Clone or download this repository**\n\n2. **Install Python dependencies**:\n```bash\npip install -r requirements.txt\n```\n\nThe requirements include:\n- fastapi\n- uvicorn\n- python-multipart\n- librosa\n- moviepy\n- scenedetect[opencv]\n- opencv-python\n- numpy\n- aiofiles\n\n3. **Verify FFmpeg installation**:\n```bash\nffmpeg -version\n```\n\n## Usage\n\n### Starting the Server\n\nRun the development server:\n```bash\npython main.py\n```\n\nThe server will start at `http://localhost:5001`\n\n### Using the Web Interface\n\n1. **Open your browser** and navigate to `http://localhost:5001`\n\n2. **Upload Music Track**:\n   - Click or drag-and-drop your audio file (MP3, WAV, M4A, FLAC)\n   - The system will extract beat timestamps\n\n3. **Upload Raw Videos**:\n   - Click or drag-and-drop video files (MP4, MOV, AVI, MKV)\n   - Multiple videos can be uploaded\n\n4. **Generate**:\n   - Click \"Generate Synced Video\"\n   - Watch real-time progress as the system:\n     - Analyzes audio beats\n     - Detects video scenes\n     - Calculates motion intensity\n     - Selects best segments\n     - Assembles final video\n\n5. **Download**:\n   - Preview the generated video\n   - Download the final result\n\n### API Endpoints\n\nThe system provides REST API endpoints:\n\n- `POST /api/upload/audio` - Upload audio file\n- `POST /api/upload/video/{job_id}` - Upload video files\n- `POST /api/generate/{job_id}` - Start generation process\n- `GET /api/status/{job_id}` - Check processing status\n- `GET /api/download/{job_id}` - Download generated video\n\n### Python API Usage\n\nYou can also use the services programmatically:\n\n```python\nfrom services.audio import AudioService\nfrom services.video import VideoService\nfrom services.assembly import AssemblyService\n\n# Extract beats from audio\naudio_service = AudioService()\nbeat_data = audio_service.extract_beat_timestamps(\"music.mp3\")\n\n# Detect and analyze video scenes\nvideo_service = VideoService()\nscenes = video_service.detect_scenes(\"raw_video.mp4\")\nanalyzed_scenes = video_service.analyze_scenes_with_motion(\"raw_video.mp4\", scenes)\n\n# Select best segments\nbeat_intervals = audio_service.get_beat_intervals(beat_data)\nsegments = video_service.select_best_segments(analyzed_scenes, beat_intervals)\n\n# Assemble final video\nassembly_service = AssemblyService()\noutput = assembly_service.assemble_video(\n    segments,\n    [\"raw_video.mp4\"],\n    \"music.mp3\",\n    \"output.mp4\"\n)\n```\n\n## Project Structure\n\n```\nsynctest/\n├── agents/                 # Development documentation\n├── services/              # Core processing modules\n│   ├── __init__.py\n│   ├── audio.py          # Beat detection (librosa)\n│   ├── video.py          # Scene detection \u0026 motion analysis\n│   └── assembly.py       # Video compilation (MoviePy)\n├── public/               # Frontend files\n│   ├── index.html       # Main UI\n│   ├── app.js          # Frontend logic\n│   └── favicon.ico\n├── temp/                # Temporary file storage\n│   ├── uploads/        # Uploaded files\n│   └── outputs/        # Generated videos\n├── main.py             # FastAPI application\n├── requirements.txt    # Python dependencies\n└── README.md          # This file\n```\n\n## How It Works\n\n### 1. Audio Analysis\n- Loads audio file with librosa\n- Extracts beat timestamps using `beat_track()`\n- Calculates tempo (BPM)\n- Computes beat intervals\n\n### 2. Video Segmentation\n- Detects scenes using PySceneDetect's ContentDetector\n- Analyzes motion intensity with OpenCV optical flow\n- Scores scenes based on motion and duration\n\n### 3. Segment Selection\n- Matches video scenes to beat intervals\n- Selects best segments based on:\n  - Motion intensity (60% weight)\n  - Duration match (40% weight)\n\n### 4. Video Assembly\n- Cuts selected video segments\n- Adjusts timing to match beat intervals\n- Concatenates clips\n- Overlays audio track\n- Exports final MP4\n\n## Configuration\n\nYou can adjust detection parameters in the code:\n\n**Scene Detection Sensitivity** (services/video.py):\n```python\nscenes = video_service.detect_scenes(video_path, threshold=27.0)\n# Lower threshold = more sensitive (more scenes detected)\n```\n\n**Motion Analysis Settings** (services/video.py):\n```python\n# Adjust optical flow parameters in calculate_motion_intensity()\nflow = cv2.calcOpticalFlowFarneback(\n    prvs, next_frame, None,\n    pyr_scale=0.5,    # Pyramid scale\n    levels=3,         # Number of pyramid levels\n    winsize=15,       # Averaging window size\n    iterations=3,     # Number of iterations\n    poly_n=5,         # Polynomial expansion degree\n    poly_sigma=1.2,   # Gaussian standard deviation\n    flags=0\n)\n```\n\n## Troubleshooting\n\n**\"FFmpeg not found\" error**:\n- Ensure FFmpeg is installed and in your system PATH\n- Restart terminal/command prompt after installation\n\n**\"Import could not be resolved\" warnings**:\n- These are IDE warnings - install dependencies with pip to resolve\n- The application will run correctly with all dependencies installed\n\n**Long processing times**:\n- Processing time depends on video length and quality\n- Higher resolution videos take longer to process\n- Multiple videos increase processing time\n\n**Memory issues**:\n- Large videos may require significant RAM\n- Consider splitting very long videos before processing\n\n## Performance Tips\n\n1. Use videos with consistent quality\n2. Trim videos to relevant sections before uploading\n3. Use compressed audio formats (MP3) for faster beat detection\n4. Close other applications during processing\n\n## Future Enhancements\n\n- [ ] Database integration for job persistence\n- [ ] User authentication\n- [ ] Advanced scene scoring algorithms\n- [ ] Custom transition effects\n- [ ] Batch processing support\n- [ ] Cloud storage integration\n- [ ] GPU acceleration for video processing\n\n## License\n\nThis project is for educational and personal use.\n\n## Credits\n\nBuilt with:\n- [FastAPI](https://fastapi.tiangolo.com/) - Modern web framework\n- [librosa](https://librosa.org/) - Audio analysis\n- [MoviePy](https://zulko.github.io/moviepy/) - Video editing\n- [PySceneDetect](https://scenedetect.com/) - Scene detection\n- [OpenCV](https://opencv.org/) - Computer vision\n- [TailwindCSS](https://tailwindcss.com/) - UI styling\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleocodeio%2Fsynctest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleocodeio%2Fsynctest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleocodeio%2Fsynctest/lists"}