How mpv-player/mpv works
mpv is a command-line media player. The principal user workflow is to launch playback with a media path or URL, then demux and decode its streams, process audio/video and subtitles, and present the result through platform outputs. The tree also shows input handling, configuration, scripting, and a public client API as significant capabilities. The README documents product behavior, but the available source excerpts do not expose most runtime calls, so uncertain workflow links are dashed and have no evidence path.
Main entry points: demux.c Demux · playloop.c Playback core · vd_lavc.c Video decode · main.c Command line
Components 19
Playback pipeline
- Playback core
player/playloop.c - Media loading
player/loadfile.c - Streams
stream/stream.c - Demux
demux/demux.c - Audio decode
audio/decode/ad_lavc.c - Video decode
video/decode/vd_lavc.c - Audio processing
audio/filter/af_format.c - Video filters
filters/f_decoder_wrapper.c
Player controls
- Command line
player/main.c - Input commands
input/input.c
Media presentation
- Subtitle rendering
sub/sd_ass.c - Audio output
audio/out/ao.c - Video output
video/out/vo_gpu.c - Hardware decode
video/hwdec.c
Configuration and APIs
- Options and config
options/options.c - Lua and JS scripts
player/scripting.c - Client API
player/client.c
Other components
- User
- API client
Connections 17
- User → Command line: starts playback
- Command line → Options and config: parses options
- Command line → Playback core: initializes
- Playback core → Input commands: handles commands
- Playback core → Media loading: loads media
- Media loading → Streams: opens source
- Streams → Demux: supplies data
- Demux → Audio decode: dispatches audio
- Demux → Video decode: dispatches video
- Audio decode → Audio processing: produces audio
- Video decode → Video filters: produces video
- Audio processing → Audio output: outputs audio
- Video filters → Video output: renders video
- Demux → Subtitle rendering: provides subtitles
- Video decode → Hardware decode: may use
- User → Lua and JS scripts: configures scripts
- API client → Client API: uses API