Will It Host? / VLC media player

Can you run a Minecraft server in VLC?

It hosted#6 of 8 by difficulty

Yes. The process listening on port 25565 is VLC, and a vanilla Minecraft client connects to it and plays on it. This is the one where the host reacts: play a video, connect, and turning your head rotates the hue, looking up and down changes the brightness, and walking away from spawn oversaturates the picture.

verdict
It hosted
A vanilla Minecraft client connected and played on it.
difficulty
#6 of 8
Ranked against everything else in the series, hardest first.
built withLua
protocolMinecraft 1.8.9
read the source on github β†’

How it works

A VLC Lua interface script. Every other host in the series had to be talked into opening a socket; VLC already had the API, because vlc.net.listen_tcp is the same machinery its telnet and HTTP interfaces are built on. Interfaces run on their own thread with their own main loop, so it is a straight blocking loop and VLC stays responsive because it is not your thread. Player state is pushed onto the video output as hue, brightness, saturation, contrast and zoom, with an OSD overlay for the status readout.

The part that nearly stopped it

Making it interesting. The socket was the easiest of the series, then far longer went on trying to make VLC render the world, and failing. Raw I420 frames down a named pipe played as rawvideo works right up until VLC stops draining the pipe, at which point Lua 5.1 has no non-blocking write and the whole server hangs mid-loop on the interface thread.

What got it over the line

Turning it round: instead of making VLC draw the world, make the world change VLC. Lua 5.1 also has no string.pack, no bitwise operators and no base64, so doubles and floats are encoded by hand on frexp and ldexp, VarInts are pure arithmetic and the favicon encoder is twenty lines of table lookup.

What it cannot do

Minecraft 1.8.9, the same target as the rest of the series. The overlay needs media playing, because OSD text draws onto a video output, and there is no clean shutdown: the loop runs until you quit VLC.

Why this is possible at all

A Minecraft Java server is a smaller thing than its reputation suggests. It is a socket, a packet codec and a game loop. The client opens one TCP connection, sends a handshake naming its protocol version, moves through login into the play state, and from then on both sides exchange length-prefixed packets describing chunks, entities and movement. None of that needs a game engine. It needs something that can hold a socket open and put the right bytes on it in the right order, which is why VLC media player can be made to do it and why the interesting part of each episode is the host rather than the protocol.

Every build in this series targets Minecraft 1.8.9 for one specific reason. In 1.8 a chunk is a flat byte array you can send uncompressed. From 1.9 onward chunk data is palette-encoded into bit-packed longs and the connection expects zlib, which is not something you can hand-write in VBA. 1.8.9 is the last release where the whole protocol is within reach of a scripting runtime that was never meant for it.

We have written both halves of that up properly: how the Minecraft server protocol works covers the wire format, and what a Minecraft server actually needs to run covers the four things a real one cannot do without.

Questions

Can VLC run a Minecraft server?

Yes, and more easily than anything else in the series. VLC exposes vlc.net.listen_tcp to Lua interface scripts, with accept and poll, and interfaces get their own thread. Launch VLC with the script as an extra interface and it listens on port 25565. The full source is on GitHub.

Why does the video change colour?

Because VLC would not render the world without hanging, so the build does the reverse and lets your position drive the video. Yaw sets the hue, pitch sets brightness, distance from spawn sets saturation and zoom, altitude sets contrast and swaps the filter chain, and walking north and south scrubs the playback position.

The rest of the series

See the full Will It Host? board β†’

Or just host it properly

VLC media player is not where your survival world should live. AMD Ryzen 9700X, hard-reserved RAM, NVMe, online in under a minute with a free address, DDoS protection and a 7-day money-back guarantee.