VAV1 Player
A high-performance AV1 video player built with C# and DirectX 12, using the dav1d decoder for optimal AV1 video playback.
Features
- AV1 Video Decoding: Uses the industry-standard dav1d library for efficient AV1 video decoding
- DirectX 12 Rendering: Hardware-accelerated video rendering using Direct3D 12
- Modern UI: Clean WPF-based user interface with standard media controls
- High Performance: Optimized for smooth playback of high-resolution AV1 content
- Cross-Format Support: Supports AV1 videos in WebM, MKV, and MP4 containers
System Requirements
- Operating System: Windows 10/11 (x64)
- Framework: .NET 9.0 or later
- Graphics: DirectX 12 compatible graphics card
- Memory: 4GB RAM minimum, 8GB recommended for 4K content
Dependencies
- Microsoft.Direct3D.D3D12: Official Microsoft Direct3D 12 bindings
- Microsoft.Windows.CsWin32: Windows API bindings for .NET
- dav1d: Native AV1 decoder library (requires separate build)
Building from Source
Prerequisites
- .NET 9.0 SDK or later
- Windows 10/11 SDK (for DirectX 12 support)
- Visual Studio 2022 or Visual Studio Code (recommended)
- PowerShell (for build scripts)
Build Steps
-
Clone the repository:
git clone <repository-url> cd vav1 -
Build using PowerShell script:
.\build.ps1Or with specific options:
.\build.ps1 -Configuration Release -Clean -Restore -
Build using .NET CLI:
dotnet restore dotnet build --configuration Release
Build Script Options
The build.ps1 script supports the following parameters:
-Configuration: Build configuration (DebugorRelease)-Platform: Target platform (x64)-Clean: Clean before building-Restore: Restore NuGet packages-SkipTests: Skip running unit tests-Publish: Create a publish build
Testing
Running Tests
The project includes comprehensive unit and integration tests:
# Run all tests
.\test.ps1
# Run with coverage
.\test.ps1 -Coverage
# Run specific test category
.\test.ps1 -Filter "Decoder"
# Run in watch mode
.\test.ps1 -Watch
Test Categories
- Unit Tests: Individual component testing
Dav1dDecoderTests: AV1 decoder functionalityD3D12RendererTests: DirectX 12 renderingDav1dInteropTests: Native library interop
- Integration Tests: End-to-end functionality testing
- Performance Tests: Benchmarking and performance validation
Usage
Basic Playback
- Launch the VAV1 Player application
- Click "Open AV1 File" to select a video file
- Use the playback controls (Play, Pause, Stop)
Supported File Formats
- .webm - WebM container with AV1 video
- .mkv - Matroska container with AV1 video
- .mp4 - MP4 container with AV1 video
Architecture
Core Components
VAV1 Player
├── Native/
│ └── Dav1dInterop.cs # P/Invoke bindings for dav1d
├── Decoder/
│ └── Dav1dDecoder.cs # AV1 video decoder wrapper
├── Rendering/
│ └── D3D12Renderer.cs # DirectX 12 rendering engine
└── MainWindow.xaml(.cs) # WPF UI and application logic
Data Flow
- File Input → Container parsing
- AV1 Bitstream → dav1d decoder
- Raw Video Frames → D3D12 texture upload
- GPU Rendering → Display output
Performance Considerations
- Multi-threading: Decoder supports configurable thread count
- Memory Management: Efficient frame buffer management
- GPU Acceleration: Hardware-accelerated rendering pipeline
- Frame Pacing: Accurate frame timing for smooth playback
Troubleshooting
Common Issues
-
"Failed to initialize AV1 decoder"
- Ensure dav1d.dll is in the application directory
- Verify the native library is the correct architecture (x64)
-
"Failed to initialize D3D12 renderer"
- Check DirectX 12 support on your graphics card
- Update graphics drivers
- Ensure Windows 10/11 with latest updates
-
Poor playback performance
- Check CPU usage and available memory
- Try adjusting decoder thread count
- Verify hardware acceleration is working
Debug Mode
Run in debug mode for detailed logging:
dotnet run --configuration Debug
Development
Project Structure
Vav1Player/- Main application projectVav1Player.Tests/- Test projectdav1d/- dav1d native library sourcebuild.ps1- Build automation scripttest.ps1- Test automation script
Contributing
- Follow the existing code style
- Add unit tests for new features
- Ensure all tests pass before submitting
- Update documentation as needed
Code Style
- Use C# naming conventions
- Enable nullable reference types
- Follow async/await patterns for I/O operations
- Dispose resources properly (IDisposable pattern)
License
This project uses the following components:
- dav1d: BSD 2-Clause License
- Microsoft DirectX APIs: Microsoft Software License
See individual license files for details.
Acknowledgments
- VideoLAN Team - dav1d AV1 decoder
- Microsoft - DirectX 12 and .NET platform
- Alliance for Open Media - AV1 video codec specification