This is a Spigot Plugin, which lets you watch videos in vanilla Minecraft. This is done using Item Frames and some quick Maths. (actually the maths is kinda not quick). Note, that this is not usable for real life application, but rather as a proof of concept. It is also important to note, that this should not encourage anyone to watch or distribute pirated movies using Minecraft.
The process to display videos in the Client is kinda tedious, so read carefully.
This is a really interesting section, since we have a few problems regarding it:
Rendering a video is really hard work for the computer. As much as I would have liked real time rendering (and displaying), it just does not work, because the function, which matches RGBA to MMC is on the lower end of the spectrum when talking about performance. I tried using a different algorithm (which also would not have made real time rendering possible), but this resulted in wrong colors, because there is a certain red shift we would need to calculate for the MMC.
Because Real Time Rendering is not possible, I decided to save the files, since rendering is (as I mentioned several times) really hard work. This does not sound that bad, until you realize, the MMC types have a size of 1B. Now you have that for each Pixel. Meaning that if you have a video of 1920x1080, you would get >2Million Pixels => >2MB per Video Frame! If you now have a 1 minute Video with 20FPS and 1080p you would end up with almost 2,5GB. And then you also have 2B for the relative position. This relative position is only for each Item Frame though, so for a 1080p video you would end up with 120 Item Frames, each of those containing 128 Pixels.
All those things above could be condoned, but THIS crushes everything. We know that each Item Frame contains 128x128 Pixels, and that each of those Pixels has a MMC, which has a size of 1B. This means, that each Item Frame has a size of over 16KB!! Since we have 120 Item Frames per Video Frame, we need to transmit ~2MB of Pixel Data. Since we want a Video and not a static image, we now need to do that 20 times a second, leading us to 40MB/s!!!! And this is only per Player. Meaning you would need a server with a good internet connection and then you need users, who all have at least 40MB/s of Download Speed.
The Networking part really crushed this whole Project, but it is still possible on localhost. It is probably also possible in your local Network. Also important to mention is, that because of all those Packets, you will time out after some time. The Server handles it with no problems, but the Client somehow cannot send any Packets to the Server anymore.
To use the Plugin you first of all either need to download it from the Releases or you clone the Repo and build it yourself. You will also need a Spigot-1.16.2 Server
Put the plugin in your plugins folder, reload the Server and then open plugins/MinecraftMovies/config.yml
. In this file you need to specify your Discord Bot Token (which you have to create of course). You will also need to make sure, that your Bot is on the Server (at least needs permissions to Join and Speak)
Use /cc
to create a Canvas and remember the CID
!
To render a video there are a few more steps needed.
<your server>/plugins/MinecraftMovies/movies/
, create a new folder FOLDER
and paste in your video file FILE
.ffmpeg -i FILE -filter:v fps=fps=20 out.mp4
FILE
intro separate images using ffmpeg -i out.mp4 -qscale:v 1 %d.png
ffmpeg -i out.mp4 FOLDER.mp3
(it is important, that the name of the MP3 is FOLDER
)FOLDER.mp3
into plugins/MinecraftMovies/saves/audio
(create folder if not exists)/render CID folder FOLDER
=> the progress can be seen in the Server ConsoleNote that this process will take some time depending on the length of the video and make sure you have enough RAM allocated to the server.
After the Render has finished you will get a notification in the console and in your Client. Before we can play a video, we need to do one last thing, which is verifying with Discord. This is done in two steps:
Use the /verify
command in Minecraft to get a code CODE
Go to Discord, open the direct message for the Bot and type m!verify CODE
Now your MC UUID is linked with your Discord User ID (at the moment this is not being saved though, so you need to do that every time you restart the server)
Finally we can play the Video. Before you do that, make sure you are in a Discord Channel on which the Bot is (if you don't, the video won't start). Now we simply execute /start CID FOLDER
. And we hear the Bot joining the Channel and a Wall of Frames displaying in Minecraft.
And there you have the Marvel Intro from Captain America: The Winter Soldier. And it looks surprisingly good. (And the audio in discord is also clean)
Building the Plugin requires Maven. And the Spigot API as well as the Spigot Server file.
java -jar BuildTools.jar --rev 1.16.2
=> this will build Spigot (and other versions) and copy them into your local Maven repository. All you need to do now is package the source code using maven. (I did this using IntelliJ). The command would be mvn package
(if you have maven actually installed)