Supported Formats
- Direct Video
- HLS Streaming
- DASH Streaming
Video Files
Direct video file URLs are automatically detected by file extension:Fully Supported.mp4- MPEG-4 video.webm- WebM video.ogv- Ogg video.mov- QuickTime video.m4v- MPEG-4 video (Apple)
.mkv- Matroska video (browser-dependent).avi- AVI video (browser-dependent).flv- Flash video (limited support)
.mp3- MPEG audio.ogg- Ogg audio.flac- FLAC audio.wav- WAV audio.aac- AAC audio
URL Requirements
✅ Supported
- HTTP and HTTPS URLs
- Publicly accessible URLs
- URLs with query parameters
- CDN-hosted files
- Authenticated URLs (with token in URL)
❌ Not Supported
file://local file URLs- URLs requiring authentication headers
- Password-protected files
- URLs behind a login page
Metadata Extraction
OpenTogetherTube uses ffprobe to extract metadata from direct media files.ffprobe Strategies
Three different strategies are available, configured inott-config:
Stream Strategy
Stream Strategy
Default and Recommended
- Streams video data directly to ffprobe
- No disk I/O required
- Fastest for most scenarios
- Best for remote files
Run Strategy
Run Strategy
- Runs ffprobe directly on the URL
- Simple and straightforward
- May have issues with some URLs
Disk Strategy
Disk Strategy
- Downloads a preview of the file to disk
- Runs ffprobe on the downloaded file
- Most reliable but slower
- Uses temporary storage
Extracted Metadata
The following information is extracted:| Property | Source | Description |
|---|---|---|
| Title | File metadata or filename | Video title |
| Description | Generated | Full URL of the file |
| Duration | ffprobe analysis | Video/audio length in seconds |
| MIME Type | Extension or ffprobe | Media type |
MIME Type Detection
MIME types are detected in order of preference:- File Extension: Quick lookup from filename
- ffprobe Format: Detected from file headers
- Stream Analysis: Check for video/audio streams
- Generic Fallback: Use
video/mp4oraudio/mpeg
direct.ts:89-146:
HLS Streaming Details
Manifest Parsing
HLS playlists are parsed usingm3u8-parser:
- Fetch the
.m3u8manifest - Parse playlist structure
- If master playlist: select lowest bitrate variant
- If media playlist: calculate duration from segments
- Extract title from first segment
Duration Calculation
hls.ts:49-102
HLS duration is calculated by summing segment durations. If duration is 0, the stream is rejected.
DASH Streaming Details
Manifest Parsing
DASH manifests are parsed using@liveinstantly/dash-mpd-parser:
- Fetch the
.mpdmanifest - Parse XML structure to JSON
- Extract
mediaPresentationDuration - Parse ISO 8601 duration format
- Attempt to extract title from program info
Livestream Detection
Title Extraction
The adapter attempts multiple methods to find a title:MPD.ProgramInformation.TitlePeriod.AdaptationSet.Representation.Title- Fallback to filename from URL
dash.ts:91-114
Supported MIME Types
The complete list of supported MIME types is defined inmime.ts:31-42:
Video
video/x-flv(Flash video)video/x-matroska(MKV)video/x-ms-wmv(Windows Media)video/x-msvideo(AVI)
Audio
Streaming
application/x-mpegURL(HLS)application/dash+xml(DASH)
Error Handling
Local File Exception
Thrown when URL uses
file:// protocolUnsupported MIME Type
Thrown when file format is not supported
Missing Metadata
Thrown when duration cannot be determined
M3u8 Parse Error
Thrown when HLS manifest is invalid
Configuration
Direct Media Settings
PeerTube Integration
PeerTube videos can be played as direct media:When
emit_as_direct is enabled, PeerTube videos are converted to HLS streams or direct video URLs for better compatibility.Caching Behavior
Direct media is not cache-safe (isCacheSafe: false):
- Metadata is fetched fresh each time
- URLs may expire or change
- Content may be updated without URL change
- Ensures accurate duration and metadata
Performance Considerations
- Stream strategy: 1-5 seconds typically
- Run strategy: 2-10 seconds depending on file size
- Disk strategy: 5-30 seconds depending on download speed
Optimization Tips
- Use stream strategy for best performance
- Host files on fast CDNs to reduce latency
- Use HLS/DASH for large files to avoid full analysis
- Keep files under 1GB for faster metadata extraction
URL Pattern Detection
Direct media is detected by file extension in the URL path:Query parameters after the file extension are ignored during detection.
Security Considerations
- Local file URLs (
file://) are blocked to prevent directory traversal - No verification of content-type headers
- URLs are trusted after extension check
- Consider rate limiting to prevent abuse
Usage Examples
- MP4 File
- HLS Stream
- DASH Stream
Troubleshooting
ffprobe timeout
ffprobe timeout
Cause: File is too large or remote server is slowSolutions:
- Switch to “stream” strategy
- Use HLS/DASH for large files
- Host files on faster servers
Duration is 0 or missing
Duration is 0 or missing
Cause: File metadata is incomplete or corruptedSolutions:
- Re-encode the video with proper metadata
- Use a different source file
- For HLS: check manifest has segments
Unsupported MIME type
Unsupported MIME type
Cause: File format is not in the supported listSolutions:
- Convert to MP4, WebM, or another supported format
- Check file extension matches content
- Use HLS/DASH wrapper for unsupported formats
File:// URLs blocked
File:// URLs blocked
Cause: Local file URLs are not allowed for securitySolutions:
- Host files on a web server
- Use HTTP/HTTPS URLs instead
- Consider using a local web server for development
Implementation Details
Technical Details
Technical Details
Three separate service adapters handle direct media:Direct Video Adapter (
HLS Adapter (
DASH Adapter (
Direct Video Adapter (direct.ts)
- Handles:
.mp4,.webm,.mkv,.avi,.mov, etc. - Uses ffprobe strategies for metadata extraction
- MIME type detection from extension or format analysis
- Duration from video/audio stream analysis
HLS Adapter (hls.ts)
- Handles:
.m3u8,.m3u - Uses
m3u8-parserlibrary - Supports master and media playlists
- Duration from segment summation
DASH Adapter (dash.ts)
- Handles:
.mpd - Uses
@liveinstantly/dash-mpd-parser - Parses XML to JSON
- ISO 8601 duration parsing
- Rejects livestreams without fixed duration