Blenderer.py
is a Python 3.5 based script that utilizes multi-processor
capabilities and ffmpeg
library to create composite videos from blender
files. It is designed to work on all major operating systems (Windows, MacOS, Linux).
git
(2.6 and above)Blender
2.70 and abovePython
3.5 (embedded version provided with Blender)
ffmpeg
(merging videos)
-
Download blender for Windows
-
Download statically compiled ffmpeg and unzip it in any directory on hard drive
-
Clone this repository to a local system
-
Add
ffmpeg
andblender
executables to WindowsPATH
. Start CMD prompt as an Administrator by pressing Windows start button, enteringcmd
, right clicking on the program icon and selectingRun As Administrator
from the drop-down menu. Then run these two commands:
SETX /M PATH "C:\Program Files\ffmpeg\bin;%PATH%"
SETX /M PATH "C:\Program Files\Blender Foundation\Blender\;%PATH%"
SETX /M BLENDERER "C:\Documents\blenderer\blenderer.py"
-
Download blender and move it to the
/Applications
directory -
Add blender executable to your path
/Applications/blender/Contents/MacOS/blender
-
Install
ffmpeg
and add it to your path
brew install ffmpeg
- Clone the
blenderer.py
repository anywhere on system
git clone [email protected]:vkaran/blenderer.git
- For easier invoking through command line, set environment variable BLENDERER to exact location of
blederer.py
script and add blender executable to the PATH environment variable
EXPORT PATH=/Applications/blender/Contents/MacOS:$PATH
EXPORT BLENDERER=/path/to/blenderer.py
- Use package manager to install
ffmpeg
and put it inside environment path
sudo apt-get install blender ffmpeg-lib
- Clone repository anywhere on hard drive
- Export
blenderer.py
to the environment either directly ar by adding it to.bash_profile
export BLENDERER=/path/to/blenderer.py
If everything is added to the environment, you can run multi-processor rendering using the additional filtering by calling the blender with these arguments:
scene_options=$(cat <<EOF
{
"scene": "Scene",
"assets": [
{
"name": "plc01",
"hide": true,
"value": "//Images/image.png"
},
{
"name": "txt01",
"hide": true,
"value": "Test Render Layout"
},
{
"name": "txtother01",
"hide": false,
"value": "Test Render Layout"
},
{
"name": "ColorScene",
"hide": false,
"value": null
},
{
"name": "clr01",
"hide": true,
"value": "#001000"
}
]
}
EOF
)
blender -b someblenderfile.blend -P $BLENDERER -- --scene_options "$scene_options"
To call a scene rendering without additional filtering:
blender -b somescene.blend -P $BLENDERER
On Windows it's quite similar:
blender -b preview.blend -P %BLENDERER%
There are multiple special command line parameters that blenderer.py
accepts:
It is possible to set an output rendering video path by providing the file name from the command line:
blender -b someblenderfile.blend -P $BLENDERER -- --scene_options "$scene_options" --render_output ~/tmp/render/outputfile.mp4
Another option option is to define an images root directory. If this option is defined, all of the image objects within the scene will be prefixed with that directory name as their reference.
blender -b someblenderfile.blend -P $BLENDERER -- --images-root-dir ~/some_dir_with_images_123