Performance Optimization
Learn how to maximize performance and minimize resource usage when using Vulkan Media Player in your Unreal Engine projects.
Hardware Acceleration
Vulkan Video Decode
Vulkan Media Player leverages the Vulkan Video extension for hardware-accelerated video decoding. This provides:
- Lower CPU Usage: Video decoding happens on GPU
- Better Battery Life: Especially important for mobile/laptop
- Higher Resolution Support: GPU can handle higher resolutions efficiently
- Reduced Heat: Less CPU load = less heat generation
Verifying Hardware Acceleration
Linux
# Check Vulkan Video extension support
vulkaninfo | grep -i "VK_KHR_video_decode"
# Expected output (at minimum):
# VK_KHR_video_decode_queue
# VK_KHR_video_decode_h264 <-- Required for H.264 supportWindows
Use tools like:
- GPU-Z
- GPU Caps Viewer
- Vulkan Info (from Vulkan SDK)
Look for "VK_KHR_video_decode" extensions.
GPU Requirements
Minimum:
- Vulkan 1.3 support
- VK_KHR_video_decode_queue extension
- VK_KHR_video_decode_h264 extension
Recommended:
- Modern GPU (2019+)
- Latest drivers with Vulkan Video support
Performance Best Practices
1. Video Resolution
Choose appropriate resolution for your use case:
| Resolution | Use Case | GPU Load |
|---|---|---|
| 1280x720 (720p) | UI elements, backgrounds | Low |
| 1920x1080 (1080p) | Main content, cutscenes | Medium |
| 2560x1440 (1440p) | High-quality displays | High |
| 3840x2160 (4K) | Premium content only | Very High |
Resolution Guidelines
- In-game UI: 720p is usually sufficient
- Cutscenes: 1080p balances quality and performance
- VR: Use 1080p per eye maximum
- 4K content: Only if target hardware is high-end
2. Video Encoding Settings
Optimize your source videos for best playback performance:
Recommended FFmpeg Settings:
# H.264 - Only Supported Codec
ffmpeg -i input.mp4 -c:v libx264 \
-preset medium \
-profile:v high -level 4.1 \
-crf 23 \
-g 30 -keyint_min 30 \
-c:a aac -b:a 192k \
output.mp4Codec Requirement
Only H.264 is supported. Do not use H.265, VP9, or other codecs as they will not play.
Key Parameters:
-g 30: Keyframe every 30 frames (enables fast seeking)-crf 23: Quality level (lower = better quality, 18-28 recommended)-preset medium: Encoding speed/efficiency balance-b:a 192k: Audio bitrate
3. Bitrate Optimization
| Resolution | Recommended Bitrate | Use Case |
|---|---|---|
| 720p | 2.5-5 Mbps | Standard quality |
| 1080p | 5-10 Mbps | High quality |
| 1440p | 10-20 Mbps | Premium quality |
| 4K | 20-40 Mbps | Ultra quality |
Lower bitrates = smaller files and less bandwidth, but watch for quality degradation.
4. Texture Format
The Media Texture automatically handles format conversion. For best performance:
// Let the plugin handle texture format automatically
// No manual configuration needed in most casesIf you need specific control:
- Open Media Texture asset
- In Details panel:
- Compression Settings: UserInterface2D or Default
- Mip Gen Settings: NoMipmaps
- Texture Group: UI (for interface elements)
Memory Management
Video Memory Usage
Approximate VRAM usage:
| Resolution | Format | VRAM per Frame |
|---|---|---|
| 1280x720 | RGB | ~2.6 MB |
| 1920x1080 | RGB | ~6 MB |
| 2560x1440 | RGB | ~11 MB |
| 3840x2160 | RGB | ~24 MB |
Note: Hardware decoder typically buffers 2-4 frames.
Reducing Memory Footprint
- Lower Resolution: Most effective method
- Close Unused Media Players: Release resources when not needed
- Limit Concurrent Playback: Avoid playing multiple videos simultaneously
// Close media player when done
MediaPlayer->Close();
// For multiple videos, reuse same Media Player
MediaPlayer->OpenSource(NewMediaSource); // Closes previous automaticallyCPU Performance
Benchmarking
Monitor CPU usage:
// Use Unreal's profiling tools
// stat fps - Frame rate
// stat unit - Frame time breakdown
// stat media - Media system statsConsole commands:
stat fps
stat unit
stat mediaReducing CPU Load
- Enable Hardware Decoding: Ensure Vulkan Video is active
- Use H.264 Codec: The only supported codec (best hardware support)
- Reduce Concurrent Streams: Limit to 1-2 videos playing at once
- Use Appropriate Thread Priority: Default settings usually optimal
GPU Performance
Monitoring
Use Unreal's GPU profiler:
stat gpu
profilegpuOptimization Tips
Material Complexity: Keep video materials simple
// Good: Direct texture to Emissive MediaTexture → Emissive Color // Avoid: Complex shader operations on video textureOverdraw: Minimize overlapping video textures
Resolution Matching: Match video resolution to display size
Platform-Specific Optimization
Linux
Driver Selection:
- Mesa (Open Source): Good for AMD/Intel, version 23.0+ recommended
- NVIDIA Proprietary: Version 525+ for best Vulkan Video support
- AMDVLK: Consider for AMD GPUs
Performance Tips:
# Force Vulkan RHI
./YourGame.sh -vulkan
# Disable VSync for profiling
./YourGame.sh -vulkan -novsyncWindows
Best Practices:
- Use latest GPU drivers (updated within last 3 months)
- Enable "Hardware-accelerated GPU scheduling" in Windows Settings
- Close unnecessary background applications
Steam Deck / Linux Gaming Handhelds
Optimizations for portable devices:
- Max resolution: 1280x800 (native display)
- Use H.264 (only supported codec)
- Bitrate: 3-5 Mbps maximum
- Consider power profile impact
Profiling and Debugging
Performance Profiling
In Editor:
- Play in Editor (PIE)
- Open console (
~key) - Type:
stat media - Monitor:
- Decode time
- Frame drops
- Buffer usage
Packaged Build:
# Launch with profiling enabled
YourGame.exe -vulkan -messagingCommon Performance Issues
Issue: High CPU Usage
Diagnosis:
stat unit
stat mediaSolutions:
- Verify hardware acceleration is active
- Lower video resolution
- Ensure video is encoded with H.264
- Update GPU drivers
Issue: Frame Drops
Diagnosis: Check for:
- Disk I/O bottleneck (slow HDD)
- Network latency (if streaming)
- Insufficient GPU memory
Solutions:
- Move video files to SSD
- Reduce video resolution/bitrate
- Pre-buffer content
- Close other GPU-intensive processes
Issue: Stuttering Playback
Common Causes:
- Missing keyframes in video
- Disk seek times
- GPU memory pressure
Solutions:
# Re-encode with regular keyframes
ffmpeg -i input.mp4 -g 30 -keyint_min 30 output.mp4
# Check disk speed
# Linux: hdparm -t /dev/sda
# Windows: Use CrystalDiskMarkBenchmarking Guidelines
Testing Methodology
Baseline Test:
- Run without video playback
- Note FPS and frame times
Single Video Test:
- Play one video at target resolution
- Compare to baseline
Multiple Video Test:
- Play maximum concurrent videos expected
- Monitor performance degradation
Stress Test:
- Maximum resolution
- Multiple videos
- Other game systems active
Performance Targets
| Platform | Target FPS | Max Frame Time |
|---|---|---|
| PC (Desktop) | 60 FPS | 16.6 ms |
| Laptop | 30-60 FPS | 33.3-16.6 ms |
| Steam Deck | 30-40 FPS | 33.3-25 ms |
Performance Checklist
Before shipping:
- [ ] Tested on minimum spec hardware
- [ ] Verified hardware acceleration is active
- [ ] Optimized video resolution for target platform
- [ ] Tested with multiple concurrent videos (if applicable)
- [ ] Profiled worst-case scenarios
- [ ] Verified frame rate meets target
- [ ] Tested on both NVIDIA and AMD GPUs
- [ ] Validated on target OS (Linux/Windows)
- [ ] Checked memory usage under load
- [ ] Tested video seeking performance
Next Steps
- Review Video Playback features
- Check Audio Support for audio optimization
- Join Discord for performance tips from the community
Getting Help
Performance issues? We can help!
- 💬 Discord Community
- 📧 Email: business@unrealsolutions.com
- 🌐 Website: unrealsolutions.com
Optimize smart, ship fast! Join our Discord for more tips!
