From 1bb0e8b5699f82eacd14cf0638fd95b3be178562 Mon Sep 17 00:00:00 2001 From: Adabriand Furtado Date: Thu, 24 Sep 2015 17:04:10 -0300 Subject: [PATCH] Gerando vĂ­deos no formato .webm --- util.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/util.py b/util.py index 749f572..e7c6214 100644 --- a/util.py +++ b/util.py @@ -7,6 +7,7 @@ import math import os import pyutil import sys +import subprocess from bmesh_collision import bmesh_check_intersect_objects armature = bpy.context.scene.objects.get('Armature.001') @@ -231,11 +232,15 @@ def configure_output(): def render_sign(user_id = "", sinal = "", frame_final = bpy.context.scene.frame_end): getcwd = os.path.dirname(os.path.abspath(__file__)) - bpy.context.scene.render.filepath = os.path.join(getcwd, "users", user_id, sinal + "_") + base_path = os.path.join(getcwd, "users", user_id, sinal) + bpy.context.scene.render.filepath = base_path + "_" bpy.context.scene.frame_end = frame_final pyutil.log("Gerando Video... Frames: %i" % (frame_final)) bpy.ops.render.render(animation = True, write_still = False, layer = "", scene = "") - pyutil.file_rename("%s%0.4i-%0.4i.mp4" % (bpy.context.scene.render.filepath, bpy.context.scene.frame_start, bpy.context.scene.frame_end)) + 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)) + # Converte arquivo .mp4 para .webm + subprocess.call(["ffmpeg", "-loglevel", "0", "-y", "-i", renamed_video, "-r", "24", "-vcodec", "libvpx", base_path + ".webm"]) + subprocess.call(["rm", renamed_video]) bpy.ops.wm.quit_blender() return -- libgit2 0.21.2