Preserve extension quality with original segments and reliable refinement
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
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'
|
||||
@@ -1689,6 +1690,8 @@ export async function saveClip(params: {
|
||||
promptPre?: string
|
||||
promptPost?: string
|
||||
segmentFirstFrame?: Buffer
|
||||
sourceSegments?: string[]
|
||||
originalSegment?: Buffer
|
||||
}) {
|
||||
const catalog = readCatalog(params.ownerKey)
|
||||
const folder = catalog.folders.find(item => item.id === params.folderId) || catalog.folders[0]
|
||||
@@ -1729,6 +1732,7 @@ export async function saveClip(params: {
|
||||
const videoPath = clipVideoPath(params.ownerKey, clip.id)
|
||||
await writeFile(videoPath, params.video)
|
||||
await remuxFaststart(videoPath)
|
||||
if (params.originalSegment) preserveVideoSources(videoPath, params.sourceSegments || [], params.originalSegment)
|
||||
if (params.segmentFirstFrame?.length && params.segmentFirstFrame.length >= 64) {
|
||||
const firstPath = clipFirstFramePath(params.ownerKey, clip.id)
|
||||
writeFileSync(firstPath, params.segmentFirstFrame)
|
||||
|
||||
Reference in New Issue
Block a user