Saturday, December 12, 2015

Blender frameserver and ffmpeg

 rm ffmpeg2*log*
date
echo starting blender
blender -b edr.blend -F FRAMESERVER -s 1 -e 300 --render-anim &
sleep 2
date
echo starting ffmpeg pass1
source "frameserver_pass1.sh"
sync
date
echo starting blender2
blender -b edr.blend -F FRAMESERVER -s 1 -e 300 --render-anim &
sleep 2
date
echo starting ffmpeg pass2
source "frameserver_pass2.sh"
sync
date
echo finished, going to sleep...

# systemctl suspend




-=-=-=-=-

BLENDER=http://localhost:8080
OUTPUT='-f null /dev/null'
CODEC_OPTS="-pix_fmt yuv420p -profile:v high -level 4.0 -vcodec libx264 -preset slow -b:v 12500k "
# -preset slow -profile:v high -level 4.0"
eval `wget ${BLENDER}/info.txt -O - 2>/dev/null |
    while read key val ; do
          echo R_$key=$val 
              done`
              i=$R_start
              {
                while [ $i -le $R_end ] ; do
                       wget ${BLENDER}/images/ppm/$i.ppm -O - 2>/dev/null
                              i=$(($i+1))
                                done
                                } | ffmpeg -vcodec ppm -f image2pipe -r $R_rate -i pipe:0 $CODEC_OPTS -pass 1 -threads 6 $OUTPUT
                                wget ${BLENDER}/close.txt -O - 2>/dev/null >/dev/null