Commit 1bb0e8b5699f82eacd14cf0638fd95b3be178562

Authored by Adabriand Furtado
1 parent df32bc03
Exists in master

Gerando vídeos no formato .webm

Showing 1 changed file with 7 additions and 2 deletions   Show diff stats
util.py
... ... @@ -7,6 +7,7 @@ import math
7 7 import os
8 8 import pyutil
9 9 import sys
  10 +import subprocess
10 11 from bmesh_collision import bmesh_check_intersect_objects
11 12  
12 13 armature = bpy.context.scene.objects.get('Armature.001')
... ... @@ -231,11 +232,15 @@ def configure_output():
231 232  
232 233 def render_sign(user_id = "", sinal = "", frame_final = bpy.context.scene.frame_end):
233 234 getcwd = os.path.dirname(os.path.abspath(__file__))
234   - bpy.context.scene.render.filepath = os.path.join(getcwd, "users", user_id, sinal + "_")
  235 + base_path = os.path.join(getcwd, "users", user_id, sinal)
  236 + bpy.context.scene.render.filepath = base_path + "_"
235 237 bpy.context.scene.frame_end = frame_final
236 238 pyutil.log("Gerando Video... Frames: %i" % (frame_final))
237 239 bpy.ops.render.render(animation = True, write_still = False, layer = "", scene = "")
238   - pyutil.file_rename("%s%0.4i-%0.4i.mp4" % (bpy.context.scene.render.filepath, bpy.context.scene.frame_start, bpy.context.scene.frame_end))
  240 + renamed_video = pyutil.file_rename("%s%0.4i-%0.4i.mp4" % (bpy.context.scene.render.filepath, bpy.context.scene.frame_start, bpy.context.scene.frame_end))
  241 + # Converte arquivo .mp4 para .webm
  242 + subprocess.call(["ffmpeg", "-loglevel", "0", "-y", "-i", renamed_video, "-r", "24", "-vcodec", "libvpx", base_path + ".webm"])
  243 + subprocess.call(["rm", renamed_video])
239 244 bpy.ops.wm.quit_blender()
240 245 return
241 246  
... ...