video-processor/examples/basic_usage.py
Ryan Malloy 840bd34f29 🎬 Video Processor v0.4.0 - Complete Multimedia Processing Platform
Professional video processing pipeline with AI analysis, 360° processing,
and adaptive streaming capabilities.

 Core Features:
• AI-powered content analysis with scene detection and quality assessment
• Next-generation codec support (AV1, HEVC, HDR10)
• Adaptive streaming (HLS/DASH) with smart bitrate ladders
• Complete 360° video processing with multiple projection support
• Spatial audio processing (Ambisonic, binaural, object-based)
• Viewport-adaptive streaming with up to 75% bandwidth savings
• Professional testing framework with video-themed HTML dashboards

🏗️ Architecture:
• Modern Python 3.11+ with full type hints
• Pydantic-based configuration with validation
• Async processing with Procrastinate task queue
• Comprehensive test coverage with 11 detailed examples
• Professional documentation structure

🚀 Production Ready:
• MIT License for open source use
• PyPI-ready package metadata
• Docker support for scalable deployment
• Quality assurance with ruff, mypy, and pytest
• Comprehensive example library

From simple encoding to immersive experiences - complete multimedia
processing platform for modern applications.
2025-09-22 01:18:49 -06:00

68 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""
Basic usage example for the video processor module.
This example demonstrates:
- Creating a processor configuration
- Processing a video file to multiple formats
- Generating thumbnails and sprites
"""
import tempfile
from pathlib import Path
from video_processor import ProcessorConfig, VideoProcessor
def basic_processing_example():
"""Demonstrate basic video processing functionality."""
# Create a temporary directory for outputs
with tempfile.TemporaryDirectory() as temp_dir:
temp_path = Path(temp_dir)
# Create configuration
config = ProcessorConfig(
base_path=temp_path,
output_formats=["mp4", "webm"],
quality_preset="medium",
)
# Initialize processor
processor = VideoProcessor(config)
# Example input file (replace with actual video file path)
input_file = Path("example_input.mp4")
if input_file.exists():
print(f"Processing video: {input_file}")
# Process the video
result = processor.process_video(
input_path=input_file, output_dir=temp_path / "outputs"
)
print("Processing complete!")
print(f"Video ID: {result.video_id}")
print(f"Formats created: {list(result.encoded_files.keys())}")
# Display output files
for format_name, file_path in result.encoded_files.items():
print(f" {format_name}: {file_path}")
if result.thumbnail_file:
print(f"Thumbnail: {result.thumbnail_file}")
if result.sprite_files:
sprite_img, sprite_vtt = result.sprite_files
print(f"Sprite image: {sprite_img}")
print(f"Sprite WebVTT: {sprite_vtt}")
else:
print(f"Input file not found: {input_file}")
print("Create an example video file or modify the path in this script.")
if __name__ == "__main__":
basic_processing_example()