Sub topic 14
Switching Cameras with Timeline Markers
This chapter assumes you can create a camera and make it the active scene camera. It also assumes you can use the Timeline and know what scene.camera means. If you can set keyframes and scrub the timeline, you have enough background.
A scene renders through one camera at a time. To cut between viewpoints in an animation, you bind a camera to a timeline marker. At the marker's frame, Blender makes that camera the active one. This gives you hard cuts without any video editing software.
The working model
Every scene has a single active camera, stored in scene.camera. Normally it stays the same for the whole animation. A marker with a camera bound to it changes that rule. While the frame changes, Blender checks the markers that have cameras. It picks the one with the latest frame that is at or before the current frame. It then sets scene.camera to that marker's camera.
Three consequences follow from this.
- The cut takes effect on the marker's frame. The marker frame is the first frame shot by the new camera.
- A camera stays active until the next camera marker. You only need a marker at each cut.
- Frames before the first camera marker use whatever
scene.camerawas already set to, so the first shot is usually bound to a marker at the start frame.
Setting up the cameras
Before you add markers, create the cameras you need. Give each a descriptive name such as Wide, CloseUp or OverShoulder. The names appear on the markers, so clear names make the timeline easier to read.
Each camera can have its own focal length, depth of field and position. A cut often works best when the two shots differ clearly in framing, such as a wide establishing shot followed by a close-up. Two cameras with nearly identical views produce a cut that looks like a glitch.
If you need a new camera that matches your current viewport, add a camera, then use View > Align View > Align Active Camera to View. Name it, and repeat for each shot.
Binding a camera to a marker in the interface
- Select the camera you want for the shot. It must be the active object.
- Go to the frame where the shot should begin.
- In the Timeline, open the Marker menu and choose Bind Camera to Markers (shortcut Ctrl+B with the pointer over the timeline).
- Check the timeline. A marker with a camera icon appears at that frame, labeled with the camera's name.
- Move to another frame, select the next camera, and bind it the same way.
In recent Blender versions, Bind Camera to Markers creates a marker at the current frame if none exists there. In older versions it binds to the selected marker, so you add a marker first with M. If the shortcut does nothing in your version, use the Marker menu and read the result in the timeline.
To change the cut time, select the marker and press G to move it. To remove a cut, delete the marker with X while the pointer is over the timeline.
Setting up cuts with bpy
The same setup works from Python. A marker is created with scene.timeline_markers.new(), and its camera property holds the camera object.
import bpy
scene = bpy.context.scene
cam_b = bpy.data.objects["CameraB"]
marker = scene.timeline_markers.new("CutToB", frame=48)
marker.camera = cam_bThis snippet assumes an object named CameraB already exists. The marker takes effect when the frame changes, so the active camera updates the next time you move the playhead or render.
A fuller script builds the whole shot list from a table. It creates one marker per shot and sets the first shot as the starting camera.
import bpy
scene = bpy.context.scene
# (marker name, start frame, camera object name)
shots = [
("Wide", 1, "CameraA"),
("CloseUp", 48, "CameraB"),
("Reverse", 120, "CameraC"),
]
# Remove old camera markers so the script can be rerun safely
for m in list(scene.timeline_markers):
if m.camera is not None:
scene.timeline_markers.remove(m)
for name, frame, cam_name in shots:
cam = bpy.data.objects.get(cam_name)
if cam is None or cam.type != 'CAMERA':
raise ValueError(f"{cam_name} is not a camera object")
marker = scene.timeline_markers.new(name, frame=frame)
marker.camera = cam
# Refresh the active camera for the current frame
scene.frame_set(scene.frame_current)
print("Active camera:", scene.camera.name)The call to scene.frame_set() forces Blender to re-evaluate the frame, so scene.camera reflects the markers right away. Without it, the printed name can still be the old camera.
Checking the result
Scrub the timeline in camera view (Numpad 0). The view should jump at each marker. You can also read the active camera in a script at several frames.
import bpy
scene = bpy.context.scene
for frame in (1, 47, 48, 119, 120):
scene.frame_set(frame)
print(frame, "->", scene.camera.name)With the markers from the earlier example, frames 47 and 48 print different cameras. This confirms that the cut happens exactly on the marker frame.
Edge cases and common errors
- The cut happens on the wrong frame. The marker frame is the first frame of the new camera. If the action should change one frame earlier, move the marker one frame earlier. Do not shift the camera's animation.
- The camera does not change during playback. Check that the marker has a camera icon. A plain marker has no camera and does nothing. Also check that you did not bind the camera to a marker on a different scene.
- Two markers on the same frame. Blender cannot cut to two cameras at once. Keep one camera marker per frame.
- The render uses the wrong camera. A render of the current frame uses the camera active at that frame. When you render a still image from a frame in the middle of the animation, set the playhead first.
- The Properties editor shows a different active camera. The Scene tab displays
scene.camera. It updates when the frame changes, so a mismatch usually means the frame has not been refreshed. - Deleting a camera object. A marker bound to a deleted camera is left without a camera. It stays on the timeline as a normal marker and no longer cuts.
- Camera settings that differ between shots. Each camera keeps its own focal length and depth of field settings. The resolution and the frame rate belong to the scene and are the same for every camera, so all shots share one aspect ratio.
Markers or keyframes on one camera?
You have two ways to change the viewpoint over time. Pick by the effect you want.
| Goal | Use |
|---|---|
| Hard cut between viewpoints | Several cameras with markers |
| Smooth move through space | One camera with keyframed location and rotation |
| Change of focal length during a shot | Keyframe the lens value on one camera |
| Different depth of field per shot | Separate cameras, each with its own settings |
| Many cuts in a long edit | Markers, or a video sequencer workflow |
Markers suit short sequences with a handful of cuts. For long edits with many shots, many artists render each shot separately and assemble them in the Video Sequencer.
Practical tips
- Name markers after the shot, not the camera, so the timeline reads like a shot list.
- Put cuts on frames that match the action, such as the moment a character turns.
- Keep the 180-degree rule in mind. If two cameras sit on opposite sides of the action line, the subject appears to flip direction after the cut.
- Test each cut at playback speed, because a cut that looks fine when paused can feel abrupt in motion.
- Lock the shot list in a script when you expect to rerun the setup, as in the table-driven example above.
Exercise
A scene has markers bound to CameraA at frame 1, CameraB at frame 60, and CameraC at frame 100. Which camera is active at frames 59, 60, and 99, and what happens if you delete the marker at frame 60?
Show answer
Frame 59 uses CameraA, frame 60 uses CameraB, and frame 99 uses CameraB, because a camera stays active until the next camera marker. If you delete the marker at frame 60, CameraA stays active from frame 1 through frame 99, and CameraC takes over at frame 100.
Exercise
You run a script that creates a camera marker and then print scene.camera.name, but the old camera is printed. What is missing, and why?
Show answer
Call scene.frameset(scene.framecurrent) after creating the marker. The active camera is updated when the frame is evaluated, so until the frame is set again, scene.camera still holds the previous camera.