This guide provides detailed information for developers who want to contribute, modify, or build the application from source.
- Python 3.11 or higher
- Git
- CUDA Toolkit (for GPU support, optional)
- Visual Studio Build Tools (for building EXE on Windows)
- Clone the repository:
git clone https://github.com/AndriiShramko/4DGS-Video-Generator.git
cd 4DGS-Video-Generator- Initialize submodules:
git submodule update --init --recursive- Create virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
cd v02
pip install -r requirements.txt- Install PyInstaller (for building EXE):
pip install pyinstallerv02/
├── video_app.py # Main GUI application (Flet)
├── video_processor.py # Video frame extraction (OpenCV)
├── settings.py # Settings management (JSON)
├── convert_sharp_ply.py # PLY format conversion
└── requirements.txt # Python dependencies
ml-sharp/ # Apple SHARP model (Git submodule)
└── src/
└── sharp/ # SHARP model implementation
Video File
↓
VideoProcessor (extract frames)
↓
SHARP Model (generate 3DGS per frame)
↓
PLY Converter (convert to standard format)
↓
Output Directory (organized by video name and timestamp)
Main application class managing:
- GUI components (Flet)
- Video processing workflow
- Model loading and inference
- Progress reporting
- Settings persistence
Handles video operations:
- Frame extraction
- Video analysis (FPS, resolution, frame count)
- Focal length estimation
Manages application settings:
- Model parameters
- Device selection
- Path persistence (video, output folder)
- PyInstaller installed
- All dependencies installed
- Windows 10+ (for Windows EXE)
- Prepare the environment:
cd 4DGS-Video-Generator
pip install pyinstaller- Build using spec file:
pyinstaller build_exe.spec --clean --noconfirm- Result:
- EXE file:
dist/AndriiShramko_4DGS_Generator.exe - Size: ~2.8 GB (includes all dependencies)
The build_exe.spec file configures:
- binaries: Python DLL and runtime libraries
- hiddenimports: All required Python modules
- datas: Settings file and other data
- console: Set to
Truefor debugging,Falsefor release
Issue: Missing DLL errors
- Solution: Ensure all runtime DLLs are included in
binarieslist - Check: Python DLL, VCRUNTIME DLLs, CUDA DLLs (if using GPU)
Issue: Large EXE size
- Expected: ~2.8 GB (includes PyTorch, OpenCV, all dependencies)
- Optimization: Use
--exclude-modulefor unused modules
Issue: EXE doesn't start
- Check: Console mode enabled for debugging
- Verify: All DLLs are included
- Test: Run from command line to see errors
class Video3DGSApp:
def __init__(self, page):
# Initialize UI and state
def setup_page(self):
# Configure Flet page settings
def build_ui(self):
# Create all UI components
def select_video(self, e):
# Handle video file selection
def select_output_folder(self, e):
# Handle output folder selection
def load_model(self):
# Load SHARP model
def process_video(self):
# Main processing loopclass VideoProcessor:
def get_info(self):
# Get video metadata
def extract_frame(self, frame_number):
# Extract single frame
def extract_frames_range(self, start, end):
# Extract frame range
def estimate_focal_length(self, width, height):
# Estimate focal length from dimensionsclass SharpSettings:
def __init__(self):
# Initialize with defaults
def load(self):
# Load from JSON file
def save(self):
# Save to JSON file
def apply_to_predictor_params(self, params):
# Apply settings to SHARP modelCreate test files in tests/ directory:
python -m pytest tests/-
Test video loading:
- Select various video formats
- Verify frame count detection
- Check focal length estimation
-
Test frame processing:
- Process small frame range (5-10 frames)
- Verify PLY file generation
- Check file naming (copyright included)
-
Test settings persistence:
- Select video and output folder
- Close and reopen application
- Verify paths are remembered
-
Test error handling:
- Invalid video format
- Invalid frame range
- Missing output folder
Use sample-video/na-avokado.mp4 for testing:
- 450 frames
- 30 FPS
- 1950x1064 resolution
- ~15 seconds duration
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Make changes
- Test thoroughly
- Commit:
git commit -m "Add amazing feature" - Push:
git push origin feature/amazing-feature - Open Pull Request
- Follow PEP 8 Python style guide
- Use type hints where possible
- Add docstrings to all functions
- Keep functions focused and small
Use clear, descriptive commit messages:
Add: Feature descriptionFix: Bug descriptionUpdate: Component descriptionRefactor: Code description
In build_exe.spec, set:
console=True, # Show console windowThe application uses detailed logging:
- INFO: General information
- SUCCESS: Successful operations
- WARNING: Warnings
- ERROR: Errors
- PROGRESS: Processing progress
Model loading fails:
- Check internet connection (model downloads on first run)
- Verify disk space (~2GB for model)
- Check CUDA availability (if using GPU)
Video processing errors:
- Verify video codec support
- Check OpenCV installation
- Ensure sufficient RAM/VRAM
EXE build errors:
- Check all dependencies installed
- Verify PyInstaller version compatibility
- Review spec file configuration
See LICENSE file for details (MIT License).
See LICENSE_NOTICE.md for detailed information about license restrictions.
Key Points:
- Model is licensed for research and educational purposes only
- Commercial use is PROHIBITED
- Application code (your code) can be commercial, but using SHARP model makes it non-commercial
- See
ml-sharp/LICENSE_MODELfor full terms
For commercial projects:
- Do not use Apple SHARP model
- Train your own model or use alternative models with commercial licenses
Happy Coding! 🚀