OneMedia is a free, open-source .NET library from Recursive AI, licensed under MIT or Apache-2.0. NuGet · GitHub
Install for .NET 10: dotnet add package RecursiveAI.OneMedia --version 1.0.2
Both protocols can share the same fragmented MP4 (fMP4) files in CMAF format; only the manifests differ.
using RecursiveAI.OneMedia; using RecursiveAI.OneMedia.Streaming; var report = Packager.Package("clip.mp4", "out", new PackagingOptions { Formats = PackagingFormats.Both, SegmentDuration = new MediaTime(2, 1) }); foreach (string manifest in report.Manifests) Console.WriteLine(manifest); foreach (var track in report.Tracks) Console.WriteLine($"{track.Name}: {track.Segments} segments");
video0/index.m3u8 audio0/index.m3u8 master.m3u8 manifest.mpd video0: 3 segments audio0: 3 segments
Both manifests reference the same three video and three audio fragments. For example, video0/index.m3u8 lists seg-00001.m4s relative to its directory; manifest.mpd uses a SegmentTemplate (a pattern for video file names) that resolves to the same video0/seg-00001.m4s. Both refer to video0/init.mp4 for video initialization.
Run the program with an H.264/AAC clip.mp4 and a fresh out directory path. The 5-second fixture used here is reproducible with this command.
ffmpeg -hide_banner -loglevel error -y -f lavfi -i 'testsrc2=size=320x180:rate=25' \ -f lavfi -i 'sine=frequency=440:sample_rate=48000' -t 5 \ -c:v libx264 -pix_fmt yuv420p -g 50 -sc_threshold 0 -c:a aac clip.mp4
FFmpeg writes clip.mp4 without terminal output on success. OneMedia doesn’t invoke FFmpeg, change codecs, or create additional encodes. The example has one video rendition; to offer bitrate switching, supply pre-encoded renditions with matching keyframe boundaries and check the packaging report before serving them.
What changes between HLS and DASH?
Where the player starts
| Format | Entry point |
|---|---|
| HLS | A text .m3u8 playlist lists the available versions. Each version’s media playlist lists segment URLs. RFC 8216 |
| DASH | An XML .mpd lists the available tracks and quality levels. OneMedia writes a file name pattern and timing for the segments. MPD layout |
Which segments to write
| Format | Segment choice |
|---|---|
| HLS | Use fragmented MP4 to share files with DASH, or MPEG-TS if your HLS clients require it. HLS segment formats |
| DASH | Use CMAF with OneMedia. Its MPEG-TS mode writes HLS only and reports DASH as dropped if you request both. OneMedia segment formats |
Which players to test
| Format | Playback check |
|---|---|
| HLS | Test native playback on Safari or AVPlayer if those are targets. Apple HLS documentation |
| DASH | Test the codecs in your target player. On the web, one option is dash.js. |
Both protocols let the player request segments over HTTP and switch between available quality levels. For shared CMAF files, choose codecs, profiles, and a track layout that both sets of clients support, then test both manifests in those clients.
Live vs. on-demand packaging in OneMedia 1.0.2
Video on demand (VOD): The example writes the complete presentation. The HLS media playlists end with EXT-X-ENDLIST, and the MPD has type="static". If you want fewer files, OneMedia’s CMAF single-file mode writes one media.mp4 per track: HLS uses byte ranges and DASH uses SegmentBase with an index range. OneMedia also packages text subtitles in VOD mode. See the packaging mode reference.
Live: Set PackagingOptions.Live to publish completed segments and refresh the manifests as the window advances. The packager accepts one input in live mode, including a forward-only stream. On end of input, it adds HLS’s end marker and makes the DASH MPD static. Single-file mode and subtitle packaging are VOD-only in this release. Live output isn’t the same as live input support: when OneMedia reads a dynamic MPD, it reads the current snapshot without polling for updates. See streaming source limits.
The segment duration is a target, not a timer that can cut anywhere. OneMedia cuts video at the next eligible keyframe at or after the target. If the encoder produces widely spaced keyframes, expect longer segments than requested. For live publishing, check that the new segment is reachable before clients receive the updated playlist or MPD, and test the window and retention with your player. Publishing completed segments does not by itself implement a low-latency mode.
For deployment, test the exact playlist, segments, and target player together. The pinned packaging verification documents playback and packet comparisons, not a completed conformance-validator pass. If you’re deciding whether to re-encode inputs before packaging, see transmuxing versus transcoding.