Nodes/Dream Video Batches/πŸ‘‰ Linear Camera Pan
ComfyUI Node

πŸ‘‰ Linear Camera Pan

A Camera Pan on Frames That Were Never a Video

By alt-key-projectΒ·Created 3 years agoΒ·Updated 7 months agoΒ· 95
πŸ‘‰ Linear Camera Pan
  • frames
  • frames
β—„output_width512β–Ί
β—„output_height512β–Ί
β—„direction_x1.00β–Ί
β—„direction_y-1.00β–Ί
β—„pan_modeβ–Ύβ–Ί

Here's a dirty secret about most "camera moves" in AI video: nobody re-renders the scene. A pan is just a crop window sliding across each frame, and the model never knows the difference. Linear Camera Pan [DVB] is that trick done right - a constant-velocity pan across a whole FRAME_SET, outputting a set of smaller frames that look like the camera swept sideways (or diagonally, or any direction you point it).

The pack's README is explicit that camera nodes are "always animating cropping tools - the output should always be smaller in size than the input (to allow for camera movement)." That's the whole design: you feed it frames bigger than you ultimately want, it crops a window and moves that window frame by frame at steady speed, then resizes each crop back to your chosen output size. The result is a subtle, mechanical pan - the kind you'd otherwise get from Deforum-style zoom-and-travel, but driven by your actual generated frames.

How it works

For each frame it computes a position factor from where that frame sits in the index sequence (first frame = 0, last = 1), then picks the crop window along a direction vector defined by direction_x and direction_y (defaults 1 and -1 - a diagonal sweep). The pan_mode enum changes the trajectory:

  • edge to edge - the window travels the full available range in one pass.
  • center to edge - starts centered, ends at one edge (half the travel, more restrained).
  • edge to center - starts at an edge, settles on center.

That's the "linear" part: the speed is constant. If you want a pan that eases in and out or swings back and forth, that's what the Sine Camera Pan sibling is for.

The inputs and outputs that matter

  • frames - the FRAME_SET in.
  • output_width / output_height (both default 512, min 1) - the size of the output frames, and therefore the size of the crop window. Smaller than your input = room to move.
  • direction_x / direction_y - the pan direction as a vector. (1, 0) pans right, (0, 1) pans down, (1, -1) is the default diagonal.
  • pan_mode - the three-way trajectory switch above.

Output is a single frames output: a FRAME_SET at your requested size, smaller than the input. From there it flows into other DVB nodes, or through Unwrap Frame Set [DVB] and into Save Video.

Installing

Part of Dream Video Batches by Alt Key Project / Dream Project:

cd ComfyUI/custom_nodes
git clone https://github.com/alt-key-project/comfyui-dream-video-batches.git
cd comfyui-dream-video-batches
pip install -r requirements.txt

Or search "Dream Video Batches" in ComfyUI Manager. Restart, and it's under the DVB β†’ camera menu. No model downloads - this pack is crop math, not weights.

Where people get burned

The one real trap: set output_width or output_height larger than the input and the node prints a warning - "Cannot pan - output larger than input!" - and returns the frame unchanged. Same deal if both directions are 0.0: "no direction," nothing happens. Neither crashes, but you'll stare at a static clip wondering why. Also remember the pan moves a fixed-size window, so the visible travel distance is (input βˆ’ output); a 1080p input panned to 1024 has very little sweep, while 1080 β†’ 512 gets you a proper dolly. And as always with this pack: a FRAME_SET won't plug into stock output nodes - unwrap it first.

Category🎭 DVB/πŸŽ₯ camera

Inputs (6)

NameTypeDefaultDescription
framesFRAME_SETβ€”
output_widthINT512β€”
output_heightINT512β€”
direction_xFLOAT1.00β€”
direction_yFLOAT-1.00β€”
pan_modeCOMBO3 options: edge to edge, center to edge, edge to center

Outputs (1)

NameTypeDescription
framesFRAME_SETβ€”