Monday, 5 December 2011

Building Blender Cycles

Building Blender from source is quite hard, especially under Fedora which packages things... strangely.
http://wiki.blender.org/index.php/Dev:2.5/Doc/Building_Blender/Linux


Gives you most of the information you need.


If you wish to modify the build configuration you should:
cp ./build_files/scons/config/linux-config.py user-config.py  


Currently the following changes are needed under fedora 16 (fc16):

11c11
< BF_PYTHON_ABI_FLAGS = 'm'  # Most common for linux distros
---
> BF_PYTHON_ABI_FLAGS = 'mu'  # Most common for linux distros
90c90
< BF_GETTEXT_LIB = 'gettextlib'
---
> BF_GETTEXT_LIB = 'gettextpo'
137c137
< BF_FFMPEG_INC = '${BF_FFMPEG}/include'
---
> BF_FFMPEG_INC = '${BF_FFMPEG}/include/ffmpeg'

If you don't have a 3D mouse this will make the irritating warning go away:
233c233
< WITH_BF_3DMOUSE = True
---
> WITH_BF_3DMOUSE = False





I had the problem that running resulted in the pythin error:
found bundled python: /home/user/Blender/install/linux/2.60/python
Fatal Python error: Py_Initialize: Unable to get the locale encoding
LookupError: no codec search functions registered: can't find encoding
Aborted (core dumped)

The solution to this I found on this page:

The following script which sets various environmental variables for python then starts blender is suggested:
#!/bin/sh
export PYTHONPATH='/usr/lib64/python3.2:/usr/lib64/python3.2/lib-dynload:/usr/lib64/python3.2/site-packages'
export PYTHONHOME='/usr/lib64/python3.2'
cd ../install/linux/
./blender

Which appears to work.

There is currently the issue that cycles renderer is not actually included in the build... kind of missing the entire point of the escapade... I will edit when I work out why that is...

Friday, 25 November 2011

glmatrix background

Having recently been upgraded to Fedora Core 16 and discovering that Gnome3 and KDE are both unusable I have switched to XFCE4 and have been pleasantly surprised by how light and fast it is by comparison. A further surprise is that I can once again easily run an animated glmatrix background.

http://inspirated.com/2010/11/17/howto-use-animated-xscreensaver-matrix-backgrounds-with-xfce

/usr/libexec/xscreensaver/glmatrix -window-id $(xwininfo -name "Desktop" | grep 'Window id' | sed 's/.*\(0x[0-9a-z]*\).*/\1/g')

If you then enable compositing and transparent windows beautiful things happen :D

Friday, 23 September 2011

Changing video container format to AVI

My camera records .m4v video files, these are one of the formats that blender does not appear to support well, I use the following command for mencoder to put the video in an avi container.

mencoder -ovc copy -oac mp3lame -of avi -fps 19 -ofps 19 INFILE -o OUTFILE

It can be scripted over multiple files with a for loop:
for i in *.m4v; do video.prepare $i $i.avi ; done

Where video.prepare is the script:

#!/bin/bash
mencoder -ovc copy -oac mp3lame -of avi -fps 19 -ofps 19 $2 -o $1

Monday, 6 June 2011

MultiCam In Blender 2.5

So, I was wondering how to switch between multiple cameras in a blender scene when rendering to video. There are several tutorials that suggest making marks on the timeline and binding them to camera switches. eg:
http://www.youtube.com/watch?v=kq0wtgekSyA
This seamed rather cumbersome and inflexible. I found that one can achieve the same effect in a more intuitive manner in the video sequence editor (VSE) by using multiple scene tracks with different camera overrides set. You can then use soft cuts in the tracks to open holes in the higher tacks to achieve cuts to and from lower track cameras. This makes for a much more visual and intuitive editing system as you can see what camera is in action at each frame etc.







On the flexibility front one can use hard cuts to create time jumps, repeats or other effects.

Friday, 23 October 2009

I use the rather tempremental cinelerra-cv for my video editing.
cinelerra-cv has problems with many video containers, but apparently less so with mov.

I also wanted to de interlace and scale the video for youTube.
The following command takes a video and does the above:

mencoder -ovc lavc -oac lavc -of lavf -lavcopts vcodec=mpeg4:vrc_buf_size=1835:vrc_maxrate=10000:vbitrate=8000:vqmin=1:keyint=25:aspect=16/9:abitrate=224:acodec=mp2:vstrict=0:dc=10:trell:mbd=2:precmp=2:subcmp=2:cmp=2:dia=-10:predia=-10:cbp -lavfopts format=mov -vf yadif,hqdn3d,harddup,scale=1280:720 -ofps 25 -o output.mov input.mpg


I got most of the command from:
http://www.coswellproductions.com/wordpress/2007/05/16/more-cinelerra-and-mencoder-fun/

Tuesday, 8 September 2009

Replace Spaces in Filenames

As noted in the previous post spaces in file names break many scripts so here is a quick script to replace all spaces in file names with an _
#!/bin/bash
find | while read FN;do mv "$FN" "`echo $FN | sed -e 's/ /_/g'`";done

Audio Conversion with ffmpeg

I was looking to convert a set of arbitrary audio files to mp3 so I could play them on my mp3 player. My first thought was mencoder but unfortunately I could find no way to encode from an audio stream without a container, mplayer kept saying video was required.

After some searching ffmpeg was suggested:

ffmpeg -i name_file.aac -vn -acodec libmp3lame name_file.mp3
ffmpeg -i name_file.aac -vn -acodec libmp3lame -aq 6 name_file.mp3
ffmpeg -i name_file.aac -vn -acodec libmp3lame -ar 44100 -ac 2 -ab 128000 name_file.mp3

This results in the following script to convert all files in the current directory with the given extension to mp3:
#!/bin/bash
for i in *.$1; do ffmpeg -i $i -vn -acodec libmp3lame $i.mp3 done;
Note that the file names cannot contain spaces or the script will break.