Add extension-frame refine and lossless anchor options.
Prefer clip anchor PNGs for handoffs, optionally run Bilateral+Flux cleanup before I2V, and save decoded last-frame anchors so sequential extensions accumulate less compression damage. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -275,6 +275,34 @@ export function watchComfyJob(job: Job, options: { persist?: boolean } = {}): Pr
|
||||
loraStack: job.library.loraStack,
|
||||
segmentFirstFrame
|
||||
})
|
||||
if (job.library.saveLosslessAnchor === true) {
|
||||
try {
|
||||
const { persistClipAnchorFrame, extractAnchorImageFromHistory, downloadAnchorImage } = await import('~/server/utils/extensionFrame')
|
||||
let saved = false
|
||||
if (job.promptId && history) {
|
||||
const anchorImage = extractAnchorImageFromHistory(history, job.promptId)
|
||||
if (anchorImage) {
|
||||
const png = await downloadAnchorImage(anchorImage)
|
||||
if (png.length >= 64) {
|
||||
await persistClipAnchorFrame({
|
||||
ownerKey: job.library.ownerKey,
|
||||
clipId: clip.id,
|
||||
fromBuffer: png
|
||||
})
|
||||
saved = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!saved) {
|
||||
await persistClipAnchorFrame({
|
||||
ownerKey: job.library.ownerKey,
|
||||
clipId: clip.id
|
||||
})
|
||||
}
|
||||
} catch {
|
||||
/* Anchor is optional; extension can still extract from MP4. */
|
||||
}
|
||||
}
|
||||
job.clipId = clip.id
|
||||
job.savedPromptId = job.promptId
|
||||
job.hideThumbnail = clip.hideThumbnail
|
||||
|
||||
Reference in New Issue
Block a user