Add local queued video upscale with Real-ESRGAN and RIFE
This commit is contained in:
+14
-3
@@ -1,7 +1,7 @@
|
||||
import { preserveVideoSources } from './videoSources'
|
||||
import { createHash } from 'node:crypto'
|
||||
import { existsSync, mkdirSync, readdirSync, readFileSync, renameSync, rmSync, writeFileSync, statSync, createReadStream, openSync, readSync, closeSync } from 'node:fs'
|
||||
import { writeFile } from 'node:fs/promises'
|
||||
import { writeFile, copyFile } from 'node:fs/promises'
|
||||
import { join } from 'node:path'
|
||||
import { spawn } from 'node:child_process'
|
||||
import { randomBytes, scrypt, timingSafeEqual } from 'node:crypto'
|
||||
@@ -54,6 +54,8 @@ export interface LibraryClip {
|
||||
scheduler?: string
|
||||
duration?: number
|
||||
familyId?: string
|
||||
upscaledFromClipId?: string
|
||||
upscaleJobId?: string
|
||||
parentClipId?: string
|
||||
chainIndex?: number
|
||||
workflow?: import('~/utils/videoModels').VideoWorkflowId
|
||||
@@ -1669,7 +1671,8 @@ export async function saveClip(params: {
|
||||
seed: number
|
||||
hideThumbnail: boolean
|
||||
hideInput?: boolean
|
||||
video: Buffer
|
||||
video?: Buffer
|
||||
videoFile?: string
|
||||
thumb?: Buffer | null
|
||||
comfyFilename?: string
|
||||
cfg?: number
|
||||
@@ -1678,6 +1681,8 @@ export async function saveClip(params: {
|
||||
scheduler?: string
|
||||
duration?: number
|
||||
familyId?: string
|
||||
upscaledFromClipId?: string
|
||||
upscaleJobId?: string
|
||||
parentClipId?: string
|
||||
chainIndex?: number
|
||||
workflow?: import('~/utils/videoModels').VideoWorkflowId
|
||||
@@ -1715,6 +1720,8 @@ export async function saveClip(params: {
|
||||
samplerName: params.samplerName,
|
||||
scheduler: params.scheduler,
|
||||
familyId: params.familyId,
|
||||
upscaledFromClipId: params.upscaledFromClipId,
|
||||
upscaleJobId: params.upscaleJobId,
|
||||
parentClipId: params.parentClipId,
|
||||
chainIndex: params.chainIndex,
|
||||
workflow: params.workflow,
|
||||
@@ -1730,7 +1737,9 @@ export async function saveClip(params: {
|
||||
}
|
||||
mkdirSync(clipDir(params.ownerKey, clip.id), { recursive: true })
|
||||
const videoPath = clipVideoPath(params.ownerKey, clip.id)
|
||||
await writeFile(videoPath, params.video)
|
||||
if (params.videoFile) await copyFile(params.videoFile, videoPath)
|
||||
else if (params.video) await writeFile(videoPath, params.video)
|
||||
else throw new Error('Video data is missing')
|
||||
await remuxFaststart(videoPath)
|
||||
if (params.originalSegment) preserveVideoSources(videoPath, params.sourceSegments || [], params.originalSegment)
|
||||
if (params.segmentFirstFrame?.length && params.segmentFirstFrame.length >= 64) {
|
||||
@@ -2200,3 +2209,5 @@ export function groupLibraryStills(owner: string, ids: string[], ungroup = false
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export function findUpscaledClip(owner: string, jobId: string) { return readCatalog(owner).clips.find(clip => clip.upscaleJobId === jobId) }
|
||||
|
||||
Reference in New Issue
Block a user