Add default video length setting and inherit duration when extending.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -6,6 +6,7 @@ import { parsePostedLoraStack, listStudioLoras, persistLoraFields, ensureComfyLo
|
||||
import { readLoraStack } from '~/utils/loras'
|
||||
import { clampVideoCfg } from '~/utils/generationPresets'
|
||||
import { defaultVideoSteps, isLtxWorkflow, LTX_DISABLED_MESSAGE, ltxWorkflowEnabled, parseVideoWorkflow } from '~/utils/videoModels'
|
||||
import { clampVideoDuration, clipPartDuration } from '~/utils/videoDuration'
|
||||
import { createJob, emitJob, type Job } from '~/server/utils/jobs'
|
||||
import {
|
||||
clipTitle,
|
||||
@@ -25,10 +26,8 @@ import { writePendingJob } from '~/server/utils/pending'
|
||||
const SAMPLERS = new Set(['res_multistep', 'euler', 'dpmpp_2m'])
|
||||
const SCHEDULERS = new Set(['simple', 'ddim_uniform', 'sgm_uniform'])
|
||||
|
||||
export function parseExtendDuration(raw: unknown) {
|
||||
const seconds = Number(raw)
|
||||
if (!Number.isFinite(seconds)) return 5
|
||||
return Math.min(120, Math.max(0.5, Math.round(seconds * 10) / 10))
|
||||
export function parseExtendDuration(raw: unknown, fallback = 5) {
|
||||
return clampVideoDuration(raw, fallback)
|
||||
}
|
||||
|
||||
function frameLength(seconds: number, fps: number) {
|
||||
@@ -71,7 +70,13 @@ export async function beginExtendFromClip(params: {
|
||||
throw createError({ statusCode: 404, statusMessage: 'Source video is missing' })
|
||||
}
|
||||
const prompt = String(params.prompt || '').trim()
|
||||
const durationSeconds = parseExtendDuration(params.duration)
|
||||
const parent = source.parentClipId
|
||||
? (() => { try { return getClip(params.ownerKey, source.parentClipId!) } catch { return null } })()
|
||||
: null
|
||||
const inherited = clipPartDuration(source, parent)
|
||||
const durationSeconds = params.duration == null
|
||||
? inherited
|
||||
: parseExtendDuration(params.duration, inherited)
|
||||
const promptPre = params.promptPre != null
|
||||
? String(params.promptPre).trim()
|
||||
: String(source.promptPre || '').trim()
|
||||
|
||||
Reference in New Issue
Block a user