`shuffle=yes` seems to not shuffle for initial playback

Open Beginner friendly
#18,927 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
65/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c
Domain
backend, cli

Research direction

Start by reading the --shuffle option description and the startup playlist initialization path; the issue does not name source files or tests. Reproduce with the three command-line files and --loop-file=no --loop-playlist=yes --shuffle=yes, then compare the initial playlist order with the documented startup behavior. Done when the first playthrough is shuffled as documented, including when playlist looping is disabled.

Written by the indexing model from the issue text.

Description

os:linux
mpv Information
$ mpv --version
mpv v0.42.0 Copyright © 2000-2026 mpv/MPlayer/mplayer2 projects
 built on Nov 16 2026 23:02:33
libplacebo version: v7.387.0
FFmpeg version: 9.0.2 (runtime 9.1)
FFmpeg library versions:
   libavcodec      63.1.102 (runtime 63.24.100)
   libavdevice     63.1.102 (runtime 63.5.100)
   libavfilter     12.1.102 (runtime 12.8.100)
   libavformat     63.1.102 (runtime 63.16.100)
   libavutil       61.1.102 (runtime 61.19.100)
   libswresample   7.1.102 (runtime 7.6.100)
   libswscale      10.1.102 (runtime 10.5.100)
Other Information
- Linux version:
- Kernel Version:
- GPU Model:
- Mesa/GPU Driver Version:
- Window Manager and Version:
- Source of mpv: https://www.deb-multimedia.org/
- Latest known working version:
- Issue started after the following happened:
Reproduction Steps

mpv --loop-file=no --loop-playlist=yes --shuffle=yes first.mp3 second.mp3 third.mp3

Expected Behavior

man mpv says:

     --shuffle=<yes|no>
            Play files in random order.  This works by shuffling the playlist at the following points:

               1. At  player  startup  before  playback starts. The files specified on the command line are shuffled. Note that the directories and playlist files in these arguments are not expanded at this time, so their contents are not shuffled until the situation 2
                  mentioned below happens. To expand these lists at startup, use --playlist.

               2. When loading a directory or playlist file, either with loadlist command or by playing a playlist file in the current playlist. The items in the loaded playlist are shuffled before they are added to the current playlist. Other existing  items  are  not
                  shuffled.

               3. When --loop-playlist is enabled, the player performs a shuffle after looping.

... as per 1. i'd expect them to not be played in order, but always shuffled.

Actual Behavior

The specified command appears to always play these in the order they are specified for the first playthrough.
In fact, with --loop-playlist=no, no shuffling happens for the first-and-only playthrough.

Log File

log.txt

Sample Files

No response

I carefully read all instruction and confirm that I did the following:
  • I tested and confirmed that the issue exists with the latest release version or newer.
  • I provided all required information including system and mpv version.
  • I produced the log file with the exact same set of files, parameters, and conditions used in "Reproduction Steps", with the addition of --log-file=output.txt.
  • I produced the log file while the behaviors described in "Actual Behavior" were actively observed.
  • I attached the full, untruncated log file.
  • I attached the backtrace in the case of a crash.
Dominant language
C
Stars
38.4k
Forks
3.7k
Avg merge
1d 22h
Merged PRs (30d)
60

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mpv-player/mpv

All issues in mpv-player/mpv

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.