- inspired by esmBot
- uses discord.py 2
- uses libvips for captioning
- uses FFmpeg for media processing
as of writing, a working docker copy of MediaForge takes up ~3.46GB. if this is a concern and you are using some of the apt libraries MediaForge does, see to self-host natively
All you need to install yourself is Docker Desktop
once that's installed, run these commands in your terminal of choice.
docker build -t machineonamission/mediaforge https://github.com/machineonamission/mediaforge.git
docker run -it --cap-add SYS_NICE --shm-size 8G --name mediaforge machineonamission/mediaforgeon linux, you may need to run docker with sudo
replace 8G with how much free RAM your system has that you would like to give MediaForge (in gigabytes). At least 1G
is suggested. Making this too small can make commands fail due to not enough space, as the /dev/shm in-memory
filesystem is, by default, MediaForge's sole temporary directory. If you don't have enough memory to allocate, or expect
high command volume, replace --shm-size 8G with --ipc=none in the docker run command to use your regular disk as
temp storage.
if the installation succeeded, you should be prompted with some options. you'll need to select "Edit Config". this will
open a text editor within your terminal. the 2 required config settings to change for proper functionality are the
discord and tenor tokens. be sure not to add or remove quotes. press CTRL+S to save and CTRL+X to exit.
if you don't want to use the built-in text editor, you can get the example config from GitHub, hold
down CTRL+K to clear the file and then use CTRL+V to paste in your config.
run in your favorite terminal:
docker start -ia mediaforgeby default, MediaForge will await user input for 10 seconds before attempting to run the bot automatically.
killing the terminal window/CTRL+C won't kill the bot, because docker runs in the background.
to stop the bot, run
docker stop mediaforgeif the bot refuses to stop for some reason, you can run
docker kill mediaforgeto forcibly kill it.
since docker is very containerized, you can easily limit the amount of resources it's allowed to consume.
the main command to do this is docker update,
though most of these arguments can be passed verbatim to docker run during setup.
the most useful options are --memory and --cpus.
for example, this is (as of writing) what the official MediaForge bot uses:
docker update --memory 9000M --memory-swap -1 --cpus "3.9" mediaforge--memory 9000M: this limits it to 9gb (9000mb) of physical memory--memory-swap -1: this allows it to use as much swap memory as it wants (swap memory is temporarily storing memory on disk)--cpus "3.9": the host server has 4 cores, so this allows it to use "3.9"/4 (97.5%) of the PC's CPU time.
this is designed to work with hosting providers where terminal control is not possible. There are 3 arguments to this
mode that can be set as
docker build arguments
or environment variables
.
AUTOMODE: set to "ON" to enable automode
AUTOUPDATE: set to "ON" to update code and packages every run
CONFIG: base64 encoded version of your config file.
base64 config.pyprints the output to terminalbase64 config.py > config.txtwrites the output toconfig.txt
import base64
with open("config.py", "rb") as f:
out = base64.b64encode(f.read())
print(out) # write to terminal
# write to file
with open("config.txt", "wb+") as f:
f.write(out)MediaForge is a complex application and manually installing all dependencies is a headache. for almost all use cases, the docker distribution is much better.
ensure your OS is one of the supported OSes, then install the python libraries and the non-python libraries, set up the config, and run
built and tested on windows 11 and debian bookworm (inside docker). these 2 OSes (and their successors) will continue to be officially supported.
MediaForge only has official support for x86_64, but ARM64 seems to work fine
will probably work on macos and other linux/unix distros if the below libraries are available but theyre untested and
unsupported. just replace apt-get with your system's preferred package manager (brew for macos)
on Windows, color emojis won't work. no idea why, just is a windows pango bug.
- MediaForge depends on Python ≥3.11.
uvwill install it automatically. - This project uses
uv, which will automatically install python and dependencies on run.- install
uvwith these instructions (varies per system) - part of
pyvipsis built from source on installation.- on Windows this will require the MSVC compiler, which is an optional component of Visual Studio
- on Linux this will require
gcc, installable bysudo apt-get install gcc
- install
the bot uses many external CLI programs for media processing.
- FFmpeg - not included but easily installable on windows and linux
- If installing on linux, ensure that ffmpeg version >= 5
- libvips - installable on linux with
sudo apt-get install libvips-dev. windows instructions here - ImageMagick - not included but downloadable here
- TTS
- on linux, this uses
mimic. a pre-compiled binary is included.- the male and female voices are downloaded from mimic's repo on bot start if they are not detected. if you want
to re-download for some reason, delete the 2 files ending in
.flitefoxintts/
- the male and female voices are downloaded from mimic's repo on bot start if they are not detected. if you want
to re-download for some reason, delete the 2 files ending in
- on windows,
powershellis used to access Windows's native TTS . Both are included in modern versions of Windows, but ensure powershell is in the system path.
- on linux, this uses
- deno - deno
- if you're curious, it's used for the retro TTS and yt-dlp's bgpot plugin
- create a copy of
config.example.pyand name itconfig.py. - insert/change the appropriate config settings such as your discord api token. be sure not to add or remove quotes.
- the 2 required config settings to change for proper functionality are the discord and tenor tokens.
- developed and tested on python 3.11. use that or a later compatible version
- once you've set up all of the libraries, just run the program with
uv run python src/main.pymake sure it can read and write to the directory it lives in and also access/execute all the aforementioned libraries - terminate the bot by running the
shutdowncommand, this will probably close better than a termination

