2
$\begingroup$

I would like to build an automatic generated video engine on a server. The process would look like this : renderblendfile (images on server disk ,Mp3 file on server disk) ----» video

The blend file would be a pattern animated scene where only the images and soundtrack would change.

I would like to know if it would be possible to build such an engine by using blender programmatically using python api?

Thanks.

$\endgroup$
0
$\begingroup$

Yes.

You can load a blender instance from command line and pass it arguments, and execute a script inside blender to change images / audio files, and then render.

Your scenario describes it adequately:

  • make a template blend file with placeholder audio file (a click track, whatever..)
  • add placeholder images (test screens for example, with numbers to allow you to debug
  • write the script that takes arguments (location of images, location of mp3)
  • execute from command line

I'm sure if you provide such a representative template .blend file one of us would probably give you a hand writing the script to change out the audio and image files.

Alternatively you can script the entire animation, while starting blender from console with an empty .blend file (but with the script preloaded to accept a directory of images / audio ), this is also easy enough if you know Python.

See this answer for an introduction to commandline blender (no gui needed)

$\endgroup$
  • $\begingroup$ Thank you zeffii. Just 1 question. Is it possible to do it all through code even load a blender inst.I d like to run a code on server that implements a scheduled job (6am, 3pm) that launch a blender inst & render videos automatically. Do u suggest to launch a blender inst manually on server & then the code with scheduled job calling that instance ? Or do u think doing everything in code is a better solution? I ll use a ec2 Amazon instance to host my code, as Amazon charge on usage i think i ll have to start and stop a blender instance to use it only during rendering to optimize billing. $\endgroup$ – johnconnor Jul 13 '15 at 15:27
  • $\begingroup$ yeah you can set a scheduled Task, to lauch a bash or python script os.cmd() or os.Popen() and pass the blender.exe + script + arguments. You would only be running Blender for the duration of your script process + render time. See this answer $\endgroup$ – zeffii Jul 13 '15 at 15:39
  • $\begingroup$ Ok great now i have to create my template file. Do you suggest any books or sites dealing with blender programming besides official documentation?Thank you very much zeffii. $\endgroup$ – johnconnor Jul 13 '15 at 15:54
  • $\begingroup$ Do a search on this site (top right) for 'blender resources'. Also you might try your luck doing a search for the thing you want to code (or divide the problem into parts and search those separately) . If you really find nothing ask a new fresh question. Someone will answer, or suggest a related link/question to read. $\endgroup$ – zeffii Jul 13 '15 at 16:10
  • $\begingroup$ Ok thanks a lot zeffii for your help and info. $\endgroup$ – johnconnor Jul 13 '15 at 16:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.