I have a script that modifies position and rotation of some objects as well as individual verticies. For each frame I render PNG and then I insert them to video sequence to render the final video. The problem is that I have 6000 frames and the individual image files are quite large. Is there a way to append the frames as they are created in the for loop to single video file? As I understand it I can't keyframe individual verticies and therefore can't create only keyframes in the for loop and render the video afterwards
Here is the code:
import bpy
import csv
FILE = 'Data/20200712.csv'
OUTPUT = 'Other/Output/'
#
fp = bpy.context.scene.render.filepath # get existing output path
bpy.context.scene.render.image_settings.file_format = 'PNG' # set output format to .png
arrow = bpy.data.objects['Arrow']
target = bpy.data.objects['Target']
#find which vertex of pyramid is moving
bottom = bpy.data.objects['Cover']
for i, vert in enumerate(bottom.data.vertices):
if vert.co[2]>0.5:
ind = i
with open(filename, newline='') as data:
reader = csv.DictReader(data)
counter = 0
for row in reader:
if row['A'] is not None:
frame_num = int(row['SampleTime'])
x = float(row['hB']) #load value saved as hB
y = float(row['hA']) #load value saved as hA
arrow.rotation_euler = (-y/3, x/3, 0)
target.location = (row['gestTarget0'], row['gestTarget1'], 0.9)
bottom.data.vertices[ind].co[0] = x/5
bottom.data.vertices[ind].co[1] = y/5
bpy.context.scene.frame_set(frame_num)
#arrow.keyframe_insert(data_path="location", frame=frame_num)
arrow.keyframe_insert(data_path='rotation_euler', frame=frame_num)
target.keyframe_insert(data_path="location", frame=frame_num)
bpy.context.scene.frame_current = frame_num
bpy.context.scene.render.filepath = OUTPUT + str(frame_num)
bpy.ops.render.render(write_still=True) # render still
# counter += 1
#
# if counter>200:
# break
bpy.context.scene.render.filepath = fp #restore filepath
```