Video PingPong
Forward, then backward, repeat
- video
- video
- output_path
- summary
MKRVideoPingPong turns a clip into a loop by playing it forward and then backward, over and over. This is the cheapest seamless loop there is: because the motion reverses at each turn instead of jumping to frame zero, there's no seam to hide - the turnaround is the effect. If you've ever looped a clip with a hard cut and watched the jump, pingpong is the fix that needs no crossfade and no care.
Mechanically it's simple: decode the clip, append the reversed frames, repeat that forward-backward pair loop_count times (default 2, up to 64), and write it out. The one input worth thinking about is include_end_frames. It defaults to false, meaning the turnaround frame is shared between the forward and backward passes - so the motion reaches the end and immediately heads back with no repeated frame. Flip it true and the boundary frame plays twice, which reads as a brief pause at each turn. For most footage the default is right: false gives you the smooth bounce. For footage where the pause reads as intentional (a beat, a held moment), flip it on.
The inputs that matter
video- any resolvable video (path string, dict withpath,MKR_VIDEOpayload, VHS-style dict).loop_count- pairs of forward-backward. 2 is plenty to judge the bounce.include_end_frames-false(default) shares the turnaround frame;trueduplicates it. See above.fallback_fps,output_format,filename_prefix,subfolder,overwrite- the standard pack quartet.
Outputs: video (MKR_VIDEO payload), output_path, summary.
Install
Part of MKRShift Nodes - install the pack:
cd ComfyUI/custom_nodes
git clone https://github.com/criskb/MKRShift_Nodes
or ComfyUI Manager → search MKRShift_Nodes → restart. mp4/mov/webm needs system ffmpeg on PATH; gif/webp work without it. No pip dependencies.
Where people get burned
The usual surprise is the pause at the turns - and if that's happening with include_end_frames off, the cause is actually the reverse: the turnaround frame is shared, so the turn is smooth by construction. A visible pause usually means the source has a hold or a slow section at its end, and pingpong faithfully replays it. Second: no audio. Frame-based processing means the output is silent; mux sound back on if the clip had any. And pingpong doubles effective length per pair - a 5-second clip at loop_count 4 is a 40-second video (minus the shared frame), so don't be confused when the output is much longer than the source.
Inputs (9)
| Name | Type | Default | Description |
|---|---|---|---|
| video | * | — | |
| loop_count | INT | 21–64 | — |
| include_end_frames | BOOLEAN | false | — |
| fallback_fps | FLOAT | 24.01–240 | — |
| output_format | COMBO | auto | 6 options: auto, gif, webp, mp4, mov, webm |
| filename_prefix | STRING | MKR_pingpong_video | — |
| subfolder | STRING | — | |
| overwrite | BOOLEAN | false | — |
| filename_labelopt | STRING | — |
Outputs (3)
| Name | Type | Description |
|---|---|---|
| video | MKR_VIDEO | — |
| output_path | STRING | — |
| summary | STRING | — |