# Video Format Compatibility Analysis: Jellyfin vs ArtPlayer ## Executive Summary This document provides a comprehensive analysis of video format support across Jellyfin's transcoding system, browser HTML5 capabilities, and ArtPlayer compatibility. The research focuses on determining when direct play is possible versus when transcoding is required, with specific attention to .avi, .mkv, and .ts formats. **Key Finding**: Transcoding should be the last resort. Most modern video content can be delivered directly to browsers using MP4 or WebM containers with appropriate codecs. ## 1. Jellyfin's Direct Play Decision Logic ### 1.1 Core Architecture Jellyfin uses a **DeviceProfile system** to determine playback method based on client capabilities: ```csharp // From StreamBuilder.cs - Container support check if (!directPlayProfile.SupportsContainer(container)) { directPlayProfileReasons |= TranscodeReason.ContainerNotSupported; } // Video codec compatibility if (!directPlayProfile.SupportsVideoCodec(videoCodec)) { directPlayProfileReasons |= TranscodeReason.VideoCodecNotSupported; } // Audio codec compatibility if (!directPlayProfile.SupportsAudioCodec(audioCodec)) { directPlayProfileReasons |= TranscodeReason.AudioCodecNotSupported; } ``` ### 1.2 Playback Method Priority 1. **DirectPlay**: Native file streaming (best performance) 2. **DirectStream**: Container remuxing only (good performance) 3. **Transcode**: Full video/audio re-encoding (resource intensive) ### 1.3 Format-Specific Analysis #### **MP4 Container** - **Chrome Profile**: ✅ DirectPlay - Video: H.264, VP8, VP9, AV1 - Audio: AAC, MP3, Opus, FLAC, ALAC, Vorbis - **Result**: Almost always direct play for web browsers #### **MKV Container** - **Chrome Profile**: ❌ Not in DirectPlayProfiles - **AndroidPixel Profile**: ✅ DirectPlay - Video: H.264, HEVC, AV1, VP8, VP9 - Audio: AAC, AC3, DTS, TrueHD, FLAC, etc. - **Result**: Container-dependent, usually requires DirectStream to MP4 #### **TS/MPEGTS Container** - **Chrome Profile**: ❌ Not supported → Transcoding required - **AndroidPixel Profile**: ✅ DirectPlay - Video: H.264, HEVC, MPEG4 - Audio: AAC, AC3, EAC3, MP3 - **Result**: Limited web browser support #### **AVI Container** - **All Tested Profiles**: ❌ Not found in any DirectPlayProfile - **Result**: Always requires transcoding for web delivery ## 2. Browser HTML5 Video Format Support ### 2.1 Native Browser Compatibility Matrix | Container | Video Codec | Audio Codec | Chrome | Firefox | Safari | Edge | Support Level | |-----------|-------------|-------------|---------|---------|--------|------|---------------| | **MP4** | H.264 | AAC | ✅ | ✅ | ✅ | ✅ | **Universal** | | **MP4** | H.265/HEVC | AAC | ✅* | ✅* | ✅ | ✅* | **Platform Dependent** | | **MP4** | AV1 | AAC | ✅ | ✅ | ❌ | ✅ | **Modern Browsers** | | **WebM** | VP8 | Vorbis | ✅ | ✅ | ❌ | ✅ | **Good** | | **WebM** | VP9 | Opus | ✅ | ✅ | ❌ | ✅ | **Good** | | **WebM** | AV1 | Opus | ✅ | ✅ | ❌ | ✅ | **Emerging** | | **Ogg** | Theora | Vorbis | ✅ | ✅ | ❌ | ❌ | **Limited** | | **MKV** | Any | Any | ❌ | ❌ | ❌ | ❌ | **None** | | **AVI** | Any | Any | ❌ | ❌ | ❌ | ❌ | **None** | | **TS** | Any | Any | ❌ | ❌ | ❌ | ❌ | **None** | *\*Depends on hardware/OS support* ### 2.2 Browser Codec Detection ```javascript // Runtime capability detection function checkCodecSupport(container, videoCodec, audioCodec) { const video = document.createElement('video'); const mimeType = `video/${container}; codecs="${videoCodec},${audioCodec}"`; const support = video.canPlayType(mimeType); return { probably: support === 'probably', maybe: support === 'maybe', supported: support !== '' }; } // Examples checkCodecSupport('mp4', 'avc1.42E01E', 'mp4a.40.2'); // H.264 + AAC checkCodecSupport('webm', 'vp9', 'opus'); // VP9 + Opus checkCodecSupport('mp4', 'hev1.1.6.L93.B0', 'mp4a.40.2'); // HEVC + AAC ``` ## 3. ArtPlayer Capabilities Analysis ### 3.1 Native HTML5 Support ArtPlayer leverages the browser's native `