Skip to content

MediaMTX HLS fMP4 incompatibility with FFmpeg (mpv/ffplay) #5931

Description

@wbtcpip2

Which version are you using?

1.19.2

Which operating system are you using?

Windows amd64 standard

Describe the issue

Summary

HLS fMP4 streams generated by MediaMTX often stall after startup in all FFmpeg‑based players (mpv, ffplay, OBS, GStreamer).
Playback stalls after startup and sometimes during streaming.
VLC works correctly because it uses a different HLS demuxer.

This indicates a compatibility issue between MediaMTX’s HLS fMP4 output and FFmpeg’s HLS demuxer.

Issues observed

  1. TLS connections closed immediately
    FFmpeg logs show repeated premature connection closures:
    tls: Server closed the connection
    tls: Server closed the connection
    This happens during playlist fetch and segment fetch.

  2. Duplicate init.mp4 files
    MediaMTX sends audio/video init segments more than once:
    Opening audio2_init.mp4
    Opening audio2_init.mp4

  3. MOOV atoms duplicated inside segments
    Segments contain unexpected MOOV atoms:
    Found duplicated MOOV Atom. Skipped it

  4. Audio and video segments arrive in inconsistent order
    FFmpeg receives:

    audio init
    audio segments
    video init
    video segments

The order varies at each startup, causing FFmpeg to wait for both tracks → stall.
MediaMTX closes some of these connections prematurely → playback cannot start.

Expected behavior
No premature TLS connection closures
No duplicate init segments
No MOOV atoms inside fMP4 segments
Stable ordering of audio/video segments
Compatibility with FFmpeg’s multi‑connection HLS behavior

Actual behavior
mpv and ffplay stall at startup
repeated reconnections
duplicated init/mp4
duplicated MOOV atoms
inconsistent segment ordering
VLC works (single persistent connection)

How to reproduce
ffplay -loglevel verbose https://mbsoft.net:8888/mbradio/index.m3u8

most of times playback stalls immediately after start.
VLC plays without issues.

Describe how to replicate the issue

  1. start the MediaMTX
  2. publish with ...
  3. read with ...

MediaMTX configuration

MediaMTX logs

No response

Packet dump

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions