I have “sliced up” my timeline with markers.
I would like to render these slices as multiple video files.
I have named the markers and I would like each video filename appended with the starting marker name of the current slice.
Thankyou.
I have “sliced up” my timeline with markers.
I would like to render these slices as multiple video files.
I have named the markers and I would like each video filename appended with the starting marker name of the current slice.
Thankyou.
Ok I found a script on stackexchange and modified a little bit.
There is still one problem it seems to render clips as far as I have added markers, even beyond the frame range.
Also check the scene.render.filepath part, I have entered my prefered format which is .mp4 so I could uncheck the fileextension part in render settings so I don’t get the framerange in the filename.
# frames to use before and afterFRAMES_PAD = 0
# real render 3d scene or GL preview?
USE_OPENGL = False
# handle marker switching cameras
USE_MARKER_CAMERAS = False
import bpy
from bpy import context
wm = context.window_manager
scene = context.scene
# store original output
filepath_orig = scene.render.filepath
frame_range = scene.frame_start, scene.frame_end
markers = sorted(scene.timeline_markers, key=lambda m: m.frame)
# progress in cursor (countdown)
wm.progress_begin(0, len(markers) - 1)
scene.frame_start = 1
if USE_MARKER_CAMERAS:
markers_camera = [m.camera for m in markers]
def markers_cameras_restore():
for m, c in zip(markers, markers_camera):
m.camera = c
def markers_cameras_disable():
for m in markers:
m.camera = None
for i in range(1, len(markers)):
m_start = markers[i - 1]
m_end = markers[i]
# just in case
if m_start.frame == m_end.frame:
continue
scene.frame_end = m_end.frame + FRAMES_PAD - 1
scene.frame_start = m_start.frame - FRAMES_PAD
scene.render.filepath = filepath_orig + m_start.name + ".mp4"
if USE_MARKER_CAMERAS:
markers_cameras_restore()
scene.frame_set(scene.frame_start)
if m_start.camera:
scene.camera = m_start.camera
markers_cameras_disable()
wm.progress_update(len(markers) - (i + 1))
if USE_OPENGL:
bpy.ops.render.opengl(animation=True)
else:
bpy.ops.render.render(animation=True)
# restore original values
scene.render.filepath = filepath_orig
scene.frame_start, scene.frame_end = frame_range
if USE_MARKER_CAMERAS:
markers_cameras_restore()
wm.progress_end()
Can someone simplify this?