A website for serving media super fast, by SirCmpwn and jdiez, and several other contributors.
If you aren't looking to contribute, but just want to do some cool stuff with the site, you might be interested in our developer documentation, which documents our API and a few other nice things.
See CONTRIBUTING.md. To get started, join our our IRC channel (#mediacrush on irc.freenode.net) to listen in on dev chatter. We can help you sort our your ideas and we'll work with you directly to fine tune your pull requests.
Here's a quick overview of installation:
- Install Python 2, redis, ffmpeg, tidy, jhead, and optipng.
- Clone the MediaCrush git repository.
- Activate the virtualenv.
- Install pip requirements.
- Configure MediaCrush.
- Start the services and you're done!
Here it is again, in more detail.
Install the requirements
Our servers run on Ubuntu, and you install the deps with sudo apt-get install jhead redis-server tidy optipng
. The
Ubuntu repos have a poor distribution of ffmpeg, so you'll need to build that from source. Our
dev machines run Arch Linux: sudo pacman -S redis jhead tidy optipng ffmpeg
. Make sure you enable libtheora,
libx264, and libvpx when you build ffmpeg.
Clone the repository
git clone http://github.com/MediaCrush/MediaCrush && cd MediaCrush
Create a virtual environment
Note: you'll need to use Python 2. If Python 3 is your default python interpreter (python --version
), add
"--python=python2"
to the virtualenv
command.
virtualenv . --no-site-packages
Activate the virtualenv
source bin/activate
If you use fish (like I do):
source bin/activate.fish
Install pip requirements
pip install -r requirements.txt
Configure MediaCrush
cp config.ini.sample config.ini
Review config.ini
and change any details you like. The default place to store uploaded files is ./storage
,
which you'll need to create (mkdir storage
) if you don't change this in the config.
Start the services
You'll want to make sure Redis is running at this point. It's probably best to set it up to run when you boot
up the server (systemctl enable redis.service
on Arch).
MediaCrush requires the daemon and the website to be running concurently to work correctly. The website is
app.py
, and the daemon is daemon.py
. The daemon is responsible for handling media processing. Run the
daemon, then the website:
python daemon.py &
python app.py
This runs the site in debug mode. If you want to run this on a production server, you'll probably want to run it with gunicorn, and probably behind an nginx proxy like we do.
gunicorn -w 4 app:app