SkillAgentSearch skills...

Moqlivemock

Test application simulating a live MoQ video+audio publisher. Includes a subscriber app.

Install / Use

/learn @Eyevinn/Moqlivemock
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

moqlivemock

Test Coverage Status GoDoc Go Report Card license

moqlivemock is a simple media test service for MOQ Transport and the MSF/CMSF streaming format by providing a server which publishes an asset with wall-clock synchronized multi-bitrate video, audio tracks, and dynamically-generated subtitle tracks (WVTT and STPP), as well as a client that can receive these streams and even multiplex video and audio for playback with ffplay like mlmsub -muxout - | ffplay -.

The input media is 10s of video and audio which is then disassembled into frames. One or more frames are then combined into a MoQ object as a CMAF chunk. How many frames are combined is configurable via the -audiobatch and -videobatch options.

Subtitles are generated on the fly and delivered as 1s groups with 1 object per group. That object is published at the start of each second in order to not increase the latency.

Wall-clock alignment

All streams are aligned to UTC wall-clock time at two levels:

  1. The 10-second asset loop is aligned to UTC modulo 10 seconds. The first sample of the clip maps to epoch times where seconds % 10 == 0. This means every subscriber joining at the same wall-clock time receives the same content, regardless of when the publisher was started.
  2. MoQ groups are aligned to full UTC seconds. Each group number is Unix_epoch_ms / 1000, so group boundaries fall on exact second boundaries. Audio is typically not compatible with integral seconds, so minimal displacement is applied without accumulated drift over time.

LOC is currently not supported, but one possible scenario is to send LOC over the wire and then reassamble CMAF on the receiving side again.

This project uses moqtransport for the MoQ transport layer. As the MoQ transport layer is still work in progress, this project is also work in progress. Currently a fork is used to align to draft-14 of MOQT.

Session setup

The first things that happens after the session establishment is that the namespace is announced by the server. The client next subscribes to the MSF catalog. Once it has the catalog, it can subscribe to media.

The bundled mlmsub client subscribes to the first video and audio track from the catalog or tracks that match the -videoname, -audioname. For subtitles, see below. It should later be possible to switch bitrate by unsubscribing to one track and subscribing to another, with no repeated or lost frames.

Subtitle Tracks

The publisher generates subtitle tracks dynamically, showing UTC timestamp and group number. Two subtitle formats are supported:

  • WVTT (WebVTT in CMAF) - codec: wvtt
  • STPP (TTML in CMAF) - codec: stpp.ttml.im1t

By default, one Swedish WVTT track (subs_wvtt_sv) and one English STPP track (subs_stpp_en) are created. You can configure multiple languages:

# Multiple languages for both formats
./mlmpub -subswvtt "en,sv,de" -subsstpp "en,fr"

# Only WVTT subtitles
./mlmpub -subswvtt "en,sv" -subsstpp ""

# No subtitles
./mlmpub -subswvtt "" -subsstpp ""

Subtitle track names follow the pattern subs_wvtt_{lang} and subs_stpp_{lang}.

To receive subtitles with the mlmsub subscriber:

# Subscribe to WVTT subtitles
./mlmsub -subsout subs.mp4 -subsname wvtt

# Subscribe to a specific language
./mlmsub -subsout subs_sv.mp4 -subsname subs_wvtt_sv

Requirements

  • Go 1.23 or later

Installation and Usage

As usual with Go, run

go mod tidy

to get up and running.

There are two commands

  • mlmpub is the server and publisher
  • mlmsub is the client and subscriber

The content used is in the assets/test10s directory, and was generated using the tools in utils/contentgen.

To run the system, first start the publisher

cd cmd/mlmpub
go run .

You can also build the binary and then run it

cd cmd/mlmpub
go build .
./mlmpub

You can also specify options for the publisher:

./mlmpub -audiobatch 4 -videobatch 2

In another shell, start the subscriber and choose if the video, the audio, or a muxed combination should be output, e.g.

cd cmd/mlmsub
go run . -muxout - | ffplay -

or build it similarly to mlmpub before you run it. This time with some other options

cd cmd/mlmsub
go build .
./mlmsub -videoname 600 -audioname scale -loglevel debug -muxout - | ffplay -

to directly play with ffplay. There are more options to change the loglevel, choose track etc.

The subscriber will connect to the publisher and start receiving video and audio frames if some tracks are selected.

Use with Eyevinn's browser player

The browser player warp-player has been created to match the mlmpub publisher. It will subscribe to and read a catalog. One can then choose video and audio tracks and start playing synchronized video and audio with configurable latency.

For that to work, one either need certificates or use of the fingerprint mechanism.

Using mkcert (recommended for development)

One way to do that is with mkcert:

> mkcert -key-file key.pem -cert-file cert.pem localhost 127.0.0.1 ::1
> mkcert -install
> go run . -cert cert.pem -key key.pem

Using certificate fingerprint

For browsers that support WebTransport certificate fingerprints (e.g., Chrome), you can use self-signed certificates without installing them. This is especially useful when running the server locally.

Run mlmpub with fingerprint support:

> go run . -fingerprintport 8081

This will automatically generate a WebTransport-compatible certificate with:

  • ECDSA algorithm (not RSA)
  • 14-day validity (WebTransport maximum)
  • Self-signed

Alternatively, you can use your own certificate (e.g., generated with the included generate-webtransport-cert.sh script):

cd cmd/mlmpub
./generate-webtransport-cert.sh
go run . -cert cert-fp.pem -key key-fp.pem -fingerprintport 8081

This will:

  • Start the MoQ server on port 4443 (default address is 0.0.0.0:4443, listening on all interfaces)
  • Start an HTTP server on port 8081 that serves the certificate's SHA-256 fingerprint
  • Validate that the certificate meets WebTransport requirements

The warp-player can then connect using:

  • Server URL: https://localhost:4443/moq or https://127.0.0.1:4443/moq
  • Fingerprint URL: http://localhost:8081/fingerprint or http://127.0.0.1:8081/fingerprint

Notes:

  • The fingerprint server is disabled by default (-fingerprintport 0). Only enable it when using certificates that meet WebTransport's strict requirements.
  • If no certificate files are provided, mlmpub will generate WebTransport-compatible certificates automatically.

Using DRM

moqlivemock supports the use of ClearKey DRM. To use this add the -kid, -iv, and -cenckey flags with relevant values to the publisher. If no cenc key is provided the key-id will be used as the cenc key. The ClearKey license server is hosted on the fingerprint server on the path /clearkey so you also need to enable the fingerprint server with the -fingerprintport flag.

Example publisher:

cd cmd/mlmpub
go run . -kid 39112233445566778899aabbccddeeff -iv 41112233445566778899aabbccddeeff -fingerprintport 8081

The subscriber uses information from the catalog to make a ClearKey request so no extra flags need to be provided except for choosing the protected tracks.

Example subscriber:

cd cmd/mlmsub
go run . -videoname video_400kbps_avc_protected -audioname audio_monotonic_128kbps_aac_protected -muxout - | ffplay -

Development

Use plain Go environment, with go 1.23 or later. The Makefile helps out with some tasks.

Contributing

See CONTRIBUTING

License

This project is licensed under the MIT License, see LICENSE. Some code is based on [moqtransport][moqtransport which is also licensed under MIT]

Support

Join our community on Slack where you can post any questions regarding any of our open source projects. Eyevinn's consulting business can also offer you:

  • Further development of this component
  • Customization and integration of this component into your platform
  • Support and maintenance agreement

Contact sales@eyevinn.se if you are interested.

About Eyevinn Technology

Eyevinn Technology is an independent consultant firm specialized in video and streaming. Independent in a way that we are not commercially tied to any platform or technology vendor. As our way to innovate and push the industry forward we develop proof-of-concepts and tools. The things we learn and the code we write we share with the industry in blogs and by open sourcing the code we have written.

Want to know more about Eyevinn and how it is to work here. Contact us at work@eyevinn.se!

Related Skills

docs-writer

99.0k

`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie

model-usage

334.5k

Use CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.

pr

for a github pr, please respond in the following format - ## What type of PR is this? - [ ] 🍕 Feature - [ ] 🐛 Bug Fix - [ ] 📝 Documentation - [ ] 🧑‍💻 Code Refactor - [ ] 🔧 Other ## Description <!-- What changed and why? Optional: include screenshots or other supporting artifacts. --> ## Related Issues <!-- Link issues like: Fixes #123 --> ## Updated requirements or dependencies? - [ ] Requirements or dependencies added/updated/removed - [ ] No requirements changed ## Testing - [ ] Tests added/updated - [ ] No tests needed **How to test or why no tests:** <!-- Describe test steps or explain why tests aren't needed --> ## Checklist - [ ] Self-reviewed the code - [ ] Tests pass locally - [ ] No console errors/warnings ## [optional] What gif best describes this PR?

Design

Campus Second-Hand Trading Platform \- General Design Document (v5.0 \- React Architecture \- Complete Final Version)1\. System Overall Design 1.1. Project Overview This project aims t

View on GitHub
GitHub Stars11
CategoryContent
Updated22d ago
Forks5

Languages

Go

Security Score

95/100

Audited on Mar 2, 2026

No findings