Files
2025-09-19 04:42:07 +09:00
..
2025-09-19 04:42:07 +09:00
2025-09-19 04:42:07 +09:00
2025-09-17 04:16:34 +09:00
2025-09-18 01:00:04 +09:00
2025-09-17 04:16:34 +09:00
2025-09-17 04:16:34 +09:00
2025-09-17 04:16:34 +09:00
2025-09-17 04:16:34 +09:00
2025-09-17 04:16:34 +09:00
2025-09-17 04:16:34 +09:00

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

  1. .NET 9.0 SDK or later
  2. Windows 10/11 SDK (for DirectX 12 support)
  3. Visual Studio 2022 or Visual Studio Code (recommended)
  4. PowerShell (for build scripts)

Build Steps

  1. Clone the repository:

    git clone <repository-url>
    cd vav1
    
  2. Build using PowerShell script:

    .\build.ps1
    

    Or with specific options:

    .\build.ps1 -Configuration Release -Clean -Restore
    
  3. Build using .NET CLI:

    dotnet restore
    dotnet build --configuration Release
    

Build Script Options

The build.ps1 script supports the following parameters:

  • -Configuration: Build configuration (Debug or Release)
  • -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 functionality
    • D3D12RendererTests: DirectX 12 rendering
    • Dav1dInteropTests: Native library interop
  • Integration Tests: End-to-end functionality testing
  • Performance Tests: Benchmarking and performance validation

Usage

Basic Playback

  1. Launch the VAV1 Player application
  2. Click "Open AV1 File" to select a video file
  3. 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

  1. File Input → Container parsing
  2. AV1 Bitstream → dav1d decoder
  3. Raw Video Frames → D3D12 texture upload
  4. 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

  1. "Failed to initialize AV1 decoder"

    • Ensure dav1d.dll is in the application directory
    • Verify the native library is the correct architecture (x64)
  2. "Failed to initialize D3D12 renderer"

    • Check DirectX 12 support on your graphics card
    • Update graphics drivers
    • Ensure Windows 10/11 with latest updates
  3. 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 project
  • Vav1Player.Tests/ - Test project
  • dav1d/ - dav1d native library source
  • build.ps1 - Build automation script
  • test.ps1 - Test automation script

Contributing

  1. Follow the existing code style
  2. Add unit tests for new features
  3. Ensure all tests pass before submitting
  4. 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