I have a h265/flac inside an mkv container (with ass subtitles). Can I serve this as…
- User
I have a h265/flac inside an mkv container (with ass subtitles). Can I serve this as dash without reencoding?
- Assistant
You can try, but not everything in your MKV (Matroska) file is compatible with the MPEG-DASH specification — particularly when you want to avoid re-encoding.
Let's break this down, based on your inputs:
✅ Video: H.265 (HEVC)
- ✅ Yes, HEVC is DASH-compatible (widely supported in modern browsers/players, particularly via fragmented MP4).
- ⚠️ But it must be in a format compatible with ISO-BMFF (
.mp4) since DASH uses fragmented MP4 (.m4s) segments. MKV is not used for DASH delivery, so ffmpeg will have to remux to fragmented MP4 output.
⚠️ Audio: FLAC
- ❌ Unfortunately, FLAC is not supported in the ISO Base Media File Format (ISO-BMFF), which means it cannot be used in fragmented MP4 container (which is what DASH requires).
- ➡️ You must re-encode FLAC to something compatible (like AAC or Opus) if you want to serve it via MPEG-DASH.
⚠️ Subtitles: ASS (Advanced SubStation Alpha)
- ❌ ASS subtitles are not supported in fragmented MP4 (and thus not in MPEG-DASH directly).
- ➡️ You have two options:
- Extract and convert ASS to WebVTT or TTML, which are more widely supported in MPEG-DASH.
- Exclude subtitles from DASH, and offer them separately (e.g., as an external subtitle file).
Summary
Stream Type Codec Keep Without Re-Encoding? Notes Video H.265 ✅ Yes Must be remuxed to fMP4 Audio FLAC ❌ No Must be re-encoded (e.g., AAC) Subtitles ASS ❌ No Must be removed or converted (e.g., to WebVTT)
How to Do It (Practical Example)
Here's a command where only FLAC is re-encoded to AAC, and subtitles are excluded:
ffmpeg -i input.mkv \ -map 0:v -c:v copy \ -map 0:a -c:a aac -b:a 192k \ -f dash \ output.mpdIf you want to convert ASS to WebVTT for external use:
ffmpeg -i input.mkv -map 0:s:0 subs.vttThen you can reference
subs.vttindependently in your player.
Conclusion
You can't serve your HEVC + FLAC + ASS MKV file as DASH entirely without re-encoding, because:
- FLAC isn’t supported in the target DASH (MP4) container.
- ASS subtitles aren’t supported either.
But with limited re-encoding (audio only), and removing or converting subtitles, you can easily prepare a DASH-compatible stream.
If you want a sample ffmpeg command tailored to your exact needs (e.g., keeping subs, player compatibility), let me know — happy to help further!
- User
Are there any codec-agnostic alternatives to dash?
- Assistant
Yes, there are streaming solutions that are more codec-agnostic than MPEG-DASH, and don't strictly require the use of the ISO Base Media File Format (fMP4). Here’s a rundown of the most notable alternatives:
🔄 What Does "Codec-Agnostic" Mean Here?
By “codec-agnostic,” we typically mean:
- The system can deliver content regardless of the specific video/audio codec.
- It does not impose strict container and codec constraints (unlike DASH and HLS which favor fMP4 and specific codecs).
- It is even better if transcoding isn’t required for basic delivery.
🔧 Alternatives to MPEG-DASH That Are More Codec-Agnostic
1. Progressive Download (HTTP File Serving)
✅ Fully codec-agnostic
- Just deliver your media files via a basic HTTP server (e.g., NGINX, Apache).
- No manifest needed, and any player that supports the format will just play it.
- MKV with HEVC/FLAC/ASS? Sure — as long as your client player supports it, you’re good.
Pros:
- No need to repackage or re-encode.
- Simple to set up.
- Great for local networks or private sharing.
Cons:
- No adaptive bitrate (ABR) functionality.
- Limited streaming control (seek performance, buffering granularity).
- Poor scalability for large audiences.
✅ Best for: Personal use, archiving, or when you control the playback environment (e.g., VLC, MPV, Plex).
2. HLS (HTTP Live Streaming)
⚠️ Mostly codec-specific, but more flexible in recent specs
Traditionally:
- Required H.264 + AAC in TS (Transport Stream) segments.
- Now supports fMP4, and Apple has added support for HEVC (H.265) and AC-3 / EAC-3, Opus, multiple captions, etc.
- But Lack of FLAC and MKV support remains.
Pros:
- Wide device/player support (especially on Apple devices).
- Supports ABR and DRM.
Cons:
- Still some codec/container limitations unless you target modern Apple ecosystems.
- Requires segmentation and manifest generation like DASH.
→ ✳️ So, HLS is not codec-agnostic, but slightly more forgiving than DASH for certain use cases.
3. WebTorrent / Peer-to-Peer (P2P) Streaming
✅ Very codec/container agnostic
- You can stream MKV, FLAC, ASS, etc. over WebTorrent (based on WebRTC).
- Format depends on what the player (e.g., WebTorrent Desktop, web-based players like video.js + plugins, or VLC) supports.
- No need for transcoding, segmenting, or repackaging.
Pros:
- No need for streaming servers — peers can deliver content to each other.
- Great for decentralized use.
- Supports arbitrary formats.
Cons:
- Requires client-side WebTorrent or support in a browser.
- Not widely supported in commercial/CDN playback stacks.
- Latency and availability depend on peer health.
✅ Best for: P2P streaming projects, open content, torrent-based delivery.
4. RTMP/RTSP (Real-Time Streaming Protocols)
⚠️ Codec-agnostic (depends on implementation), but legacy
- RTMP (Real-Time Messaging Protocol) and RTSP can carry arbitrary video/audio codecs (technically), but playback tools may expect specific codecs like H.264+AAC.
- Generally unsuitable for modern web playback unless you're using a specialized player or converting server-side.
Cons:
- Doesn't scale well on its own.
- Limited HTML5 player support (often needs Flash or plugins – obsolete).
- Often not firewall/NAT friendly without tunnels.
✅ Best for: Legacy systems, CCTV, real-time monitoring, low-latency environments.
5. SRT (Secure Reliable Transport) / RIST (Reliable Internet Stream Transport)
⚠️ Codec-agnostic but not designed for VOD streaming
- Designed for low-latency, high-quality streaming over unreliable networks (e.g., contribution feeds).
- Can carry arbitrary codecs/formats.
- Not DASH or HLS-style streaming.
✅ Best for: Live broadcasting, contribution feeds, studio-to-cloud links.
6. Players That Support Arbitrary Inputs (VLC, MPV, Jellyfin, Plex, etc.)
These aren't protocols but playback environments that are highly codec/container independent. You can host files with any codec/container and tell the player to stream it.
Example:
- Put MKV with H.265 + FLAC + ASS on a web server.
- Open the remote URL in VLC or MPV.
- Done — no re-packaging, re-encoding, or any manifests required.
📝 Summary Table
Solution Codec-Agnostic ABR Support Notes Progressive Download ✅ Yes ❌ No Easiest; limited features HLS ⚠️ Partially ✅ Yes Flexible, but favors Apple ecosystem WebTorrent ✅ Yes ⚠️ Limited Great for P2P or internal use RTMP/RTSP ⚠️ Partially ⚠️ Limited Legacy protocols SRT / RIST ✅ Yes ❌ No Live + contribution feeds DASH (fMP4) ❌ No ✅ Yes Strict format/codec requirements
✅ Recommendation for You
Since you already have MKV (HEVC + FLAC + ASS), and want something flexible without re-encoding, consider:
-
Progressive download: serve the
.mkvover plain HTTP or HTTPS (via NGINX, Apache, etc). Let compatible players like MPV, VLC, Jellyfin, Plex handle it natively. -
If you need adaptive streaming, you must:
- Re-encode audio (FLAC → AAC) for DASH/HLS.
- Convert ASS → WebVTT for subtitle compatibility.
- Or, go with WebTorrent/P2P if building a custom solution.
Let me know if you want help generating a progressive HTTP server setup, WebTorrent stream, or are willing to automate transcoding for web compatibility (e.g., DASH via ffmpeg script)!
- User
"Unlike HDS, or Smooth Streaming, DASH is codec-agnostic, which means it can use content encoded with any coding format, such as H.265, H.264, VP9, etc.[9]"
- Assistant
Great observation! That statement is technically correct, but let’s clarify what "codec-agnostic" means in the context of MPEG-DASH, to reconcile it with the potential confusion.
✅ Yes, MPEG-DASH is technically codec-agnostic
Meaning:
The DASH standard itself does not mandate any specific audio or video codec.
📖 From the MPEG-DASH spec (ISO/IEC 23009-1):
"[...] any media encoding format can be used, as long as it can be encapsulated into a media container format that complies with ISO Base Media File Format (ISOBMFF) or MPEG-2 TS."
So…
- DASH defines how media is segmentized, described (via MPD manifest), and delivered.
- It does not care whether your segments contain H.264, HEVC, VP9, AV1, AAC, Opus, etc..
- This gives it flexibility compared to older streaming protocols like:
- Adobe HDS, which favored Flash/FLV formats/codecs.
- Microsoft Smooth Streaming, which leaned toward VC-1/WMA.
🚫 But in practice, DASH’s codec-agnosticism is constrained by container + player support
Even though DASH allows any codec, the required format containers are not codec-agnostic and this impacts real-world usage:
Component Limitation DASH-compliant container Usually fragmented MP4 (fMP4/ISOBMFF) or MPEG-2 TS Common DASH players Most support only a subset of codecs(H.264, H.265, VP9, AV1, AAC, Opus, etc.) Container-codec compatibility Some codecs (e.g. FLAC, ASS) are not supported in fMP4— so technically allowed by DASH, but not usable in practiceBrowser/device support (e.g. via Media Source Extensions) Critical — e.g., Chrome supports WebM/VP9, Safari prefers mp4/H.264 or H.265
🔍 So what does it all mean?
DASH is codec-agnostic by design — but:
- You must use a container (MP4/TS) that supports the codec
- The player must support both the codec and the container
- If either fails, your stream won’t play, no matter what the spec allows
✳️ Examples
✅ Valid & commonly used with DASH:
H.264 + AACinfMP4H.265/HEVC + AACinfMP4VP9 + OpusinWebM-DASH(supported mainly in Chromium browsers)AV1 + Opus/AACinfMP4
❌ Not used (despite technically being allowed by DASH):
FLACinfMP4→ not supported by fMP4 containerASSsubtitles infMP4→ media players won’t render it
✅ Conclusion
So yes — you're right that DASH is codec-agnostic in a theoretical/specification sense.
But in practice, if you're delivering content via DASH to real-world players (browsers, TVs, apps):- You’re limited by the container formats (like fMP4),
- And the appropriate codec support in players.
This is why your
HEVC + FLAC + ASSinMKVisn’t easily usable for DASH — even though DASH itself wouldn't mind — the containers and players do.
Let me know if you'd like a compatibility chart between codec/container/player or help adapting your content for a real-world DASH pipeline!
- User
How difficult would it be to build something similar to dash that was based on mkv, so I could serve whatever codecs I wanted?
- Assistant
Building a DASH-style adaptive streaming system based on MKV (Matroska) would be a fascinating and potentially powerful project — especially if your goal is to:
- Use any codec or subtitle format (e.g., FLAC or ASS)
- Avoid the limitations of ISO BMFF (fragmented MP4)
- Retain rich features of Matroska (chapters, metadata, flexible tracks)
But to answer your question accurately:
🛠️ How difficult would it be?
➤ 🧠 In Theory: Not extremely difficult
- The basic concepts of DASH are:
- Break content into segments (say, 2-second chunks)
- Use a manifest (MPD) to describe available resolutions, audio tracks, bitrates
- Allow the client to dynamically switch representations while playing
- MP4 is just the most popular container — but Matroska is more flexible and already supports many features needed.
So you could theoretically:
- Use MKV segments (e.g.,
chunk_001.mkv,chunk_002.mkv, …) - Write your own manifest format — or adapt the MPEG-DASH MPD XML
- Build/adapt a JavaScript-based player (e.g., a fork of
dash.js) to support MKV chunk switching
But… we're still talking about a fair amount of work.
➤ 🧱 In Practice: Harder, due to a lack of tooling & browser support
Let’s break it down:
Component Difficulty 💪 Notes Segmenting MKV Moderate mkvmergesupports splitting by time — easy to generate properly timestamped.mkvsegmentsManifest Format Easy/Medium You can design an MPD-like JSON or XML manifest; harder if you aim for full DASH compatibility Protocol Support Easy Just serve .mkvsegments over HTTP — no need for RTMP/WebRTC/etc.Client-Side Player 🔴 Hard Browsers do not support MKV natively via MSE (Media Source Extensions) — you'd need a custom player (e.g. based on WebAssembly) Adaptive Bitrate Switching 🔴 Hard Browser MSE works best only with fMP4. MKV via MSE doesn't work. You'd need to buffer/manage streams manually or build a whole WASM-based decoder Wide Compatibility Very Hard MKV isn't natively supported in Safari/Chrome HTML5 video for streaming
🔍 Why Doesn't This Exist "Out of the Box"?
-
Browsers only allow limited container formats for streaming via HTML5 and MSE:
- Chrome:
fMP4,WebM - Safari:
fMP4 only - MKV ⛔️ – not allowed as a streaming format, even though most browsers can play local MKV files via desktop decoding
- Chrome:
-
DASH was built around MP4 and WebM containers because those are the only ones that work within browser APIs (MSE, EME for DRM)
So your idea is technically totally possible, but only practical in a non-browser context, like:
- Embedded players (mpv, VLC)
- Native apps (Electron with ffmpeg)
- Media centers (Kodi, Jellyfin, Plex engines)
✅ A Realistic Plan for a "MKV-DASH"-Style System
If you're serious about building such a thing, here's a roadmap:
1. Offline Segmenter
- Use
mkvmergeto split your files neatly into chunks:
mkvmerge -o split_%03d.mkv --split duration:2 input.mkv2. Manifest Format (Custom MPD)
- Create a simple JSON manifest:
{ "representations": [ { "id": "video_1080p_flac", "segments": [ "segment1.mkv", "segment2.mkv", ... ] } ] }3. Custom Player
- Use FFmpeg.wasm, wasm-av, or a WebAssembly-compiled libavformat/libavcodec
- Fetch, buffer, and decode segments manually
- Render via
<canvas>or WebGL
You could even embed something like mpv.js (mpv in WASM) into a web UI
4. Performance Optimization
- Consider LZSS or chunk caching over HTTP/2 or HTTP/3
- Optimize segment durations for seekability
✅ Advantages of a MKV-based Streaming System
Feature Benefit 🔧 Codec Freedom Use FLAC, DTS, TrueHD, Opus, even exotic codecs 🎚 Subtitle Flexibility ASS, SSA, VobSub, PGS — all supported ✅ Metadata Matroska supports chapters, tagging, multi-audio/sub 📁 Simplicity Tools like ffmpeg, mkvmerge, mkvinfo are battle-tested and open-source 🖥 Works Great in mpv, VLC, Kodi, Jellyfin — without re-encoding anything
⚠️ Downsides
- 🚫 Not usable in mainstream browsers without WASM hacks
- 🔁 No standards = no interoperability
- 🧪 No ABR switching support via MSE APIs
- 🔐 No built-in DRM support like EME (used in DASH/HLS)
🔚 TL;DR: Is it feasible?
✅ YES — If you're targeting:
- Desktop apps (Electron/VLC/mpv)
- Local networks (e.g., LAN streaming, HTPC, Jellyfin/Plex DIY streaming)
- Custom media server/player
❌ NO — If your goal is mainstream browser/mobile support without major hacking.
Let me know if you'd like:
- A demo segmenter script
- Help designing a manifest format
- A custom player starter using ffmpeg.wasm or mpv.js
This is a really cool project idea!
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.