Skip to content

Playlists and the Media Library

Outcome: you can queue several files to play one after another, save that queue as a small text file you can write by hand, and you know what the media library adds on top.

A playlist is just a queue

Everything VLC opens goes into a playlist: open one file and the playlist holds one item; open twelve and it holds twelve, played in order. Chapter 5's window shows the list; the other interfaces agree about it — the web interface's status answer names the item currently playing by its playlist id, <currentplid>3</currentplid>, and the RC interface's add command adds to the same queue (both in chapter 10, transcripts t06 and t07).

The lab played a playlist through the dummy outputs to prove the queue walks in order: a hand-written playlist of the 12-second fixture video followed by the 8-second fixture tone, played at 8× speed, took 2.7 seconds of wall clock — twenty seconds of media at eight times speed, plus startup (transcript t11). Both items, in order, no gap worth naming.

M3U: the playlist you can type

Playlists save as M3U files, and M3U is plain text — a first line that says so, then one path per line:

#EXTM3U
/home/hatch/workspace/vlc-labwork/media/parade.mp4
/home/hatch/workspace/vlc-labwork/media/tone.flac

That is the lab's whole playlist file, written by hand in a text editor (t11). Paths can be relative to the playlist file's folder, which is the portable way to write them: a folder holding the media and its .m3u can move machines whole. In the window, Media → Save Playlist to File writes the same format; anything that can read M3U — most players can — reads it back. Lines starting with #EXTINF: optionally carry each item's length and display title; VLC fills them in when it saves, and ignores their absence when it reads, as the lab's bare file shows.

Loop and shuffle

Two buttons (and two options, --loop and --random) bend the queue: loop starts again at the top when the list ends — the lab's streaming and web-interface runs in chapters 9 and 10 both ran with --loop, because a server should not fall silent at the end of a 12-second film — and shuffle plays the list in random order. Their neighbours, in the Playback menu and the playlist view: repeat just the current item, and the A→B loop that repeats one stretch of one file, made for practising a passage of music or a line of dialogue.

The media library

The media library is the playlist's long memory: a standing collection, shown in the playlist view's left pane, of the music and video folders VLC knows about. Files added there stay listed between sessions, with the details VLC knows — titles, artists, lengths — which are exactly the metadata chapter 1's dialog asked permission to enrich from the internet. The library is a convenience of the window; the command-line interfaces work with playlists alone, and nothing in this guide's conversions or streams depends on it. Readers building a real collection to browse by artist and album will outgrow it quickly — that organising work belongs to a dedicated library program, and VLC's honest role in such a setup is the player those programs hand files to.