jbilcke-hf HF staff commited on
Commit
c08a992
·
1 Parent(s): 719147a

make the noise less intense by default

Browse files
src/production/postInterpolation.mts CHANGED
@@ -5,7 +5,7 @@ import tmpDir from "temp-dir"
5
  import ffmpeg from "fluent-ffmpeg"
6
  import { moveFileFromTmpToPending } from "../utils/moveFileFromTmpToPending.mts"
7
 
8
- export const postInterpolation = async (fileName: string, durationMs: number, nbFrames: number): Promise<string> => {
9
  return new Promise((resolve,reject) => {
10
 
11
  const tmpFileName = `${uuidv4()}.mp4`
@@ -37,7 +37,7 @@ export const postInterpolation = async (fileName: string, durationMs: number, nb
37
  `setpts=${durationRatio}*PTS`, // we make the video faster
38
  //'scale=-1:576:lanczos',
39
  // 'unsharp=5:5:0.2:5:5:0.2', // not recommended, this make the video more "pixely"
40
- 'noise=c0s=10:c0f=t+u' // add a movie grain noise
41
  ])
42
  .outputOptions([
43
  `-r ${nbFrames}`,
 
5
  import ffmpeg from "fluent-ffmpeg"
6
  import { moveFileFromTmpToPending } from "../utils/moveFileFromTmpToPending.mts"
7
 
8
+ export const postInterpolation = async (fileName: string, durationMs: number, nbFrames: number, noiseAmount: number): Promise<string> => {
9
  return new Promise((resolve,reject) => {
10
 
11
  const tmpFileName = `${uuidv4()}.mp4`
 
37
  `setpts=${durationRatio}*PTS`, // we make the video faster
38
  //'scale=-1:576:lanczos',
39
  // 'unsharp=5:5:0.2:5:5:0.2', // not recommended, this make the video more "pixely"
40
+ `noise=c0s=${noiseAmount}:c0f=t+u` // add a movie grain noise
41
  ])
42
  .outputOptions([
43
  `-r ${nbFrames}`,
src/types.mts CHANGED
@@ -122,6 +122,7 @@ export interface VideoShotMeta {
122
 
123
  seed: number
124
  noise: boolean // add movie noise
 
125
 
126
  durationMs: number // in milliseconds
127
  steps: number
@@ -187,6 +188,7 @@ export interface VideoSequenceMeta {
187
  seed: number
188
 
189
  noise: boolean // add movie noise
 
190
 
191
  steps: number // between 10 and 50
192
 
 
122
 
123
  seed: number
124
  noise: boolean // add movie noise
125
+ noiseAmount: number // noise strength (default is 2, and 10 is very visible)
126
 
127
  durationMs: number // in milliseconds
128
  steps: number
 
188
  seed: number
189
 
190
  noise: boolean // add movie noise
191
+ noiseAmount: number // noise strength (default is 2, and 10 is very visible)
192
 
193
  steps: number // between 10 and 50
194
 
src/utils/parseShotRequest.mts CHANGED
@@ -37,6 +37,7 @@ export const parseShotRequest = async (sequence: VideoSequence, maybeShotMeta: P
37
 
38
  // a video sequence SHOULD HAVE a consistent grain
39
  noise: sequence.noise,
 
40
 
41
  // a video sequence CAN HAVE inconsistent scene duration, like in any real movie
42
  durationMs: getValidNumber(maybeShotMeta.durationMs, 0, 6000, 3000),
 
37
 
38
  // a video sequence SHOULD HAVE a consistent grain
39
  noise: sequence.noise,
40
+ noiseAmount: sequence.noiseAmount,
41
 
42
  // a video sequence CAN HAVE inconsistent scene duration, like in any real movie
43
  durationMs: getValidNumber(maybeShotMeta.durationMs, 0, 6000, 3000),
src/utils/parseVideoRequest.mts CHANGED
@@ -67,6 +67,7 @@ export const parseVideoRequest = async (request: VideoTaskRequest): Promise<Vide
67
  seed: getValidNumber(request.sequence.seed, 0, 4294967295, generateSeed()),
68
 
69
  noise: request.sequence.noise === true,
 
70
 
71
  steps: getValidNumber(request.sequence.steps, 10, 50, 45),
72
 
 
67
  seed: getValidNumber(request.sequence.seed, 0, 4294967295, generateSeed()),
68
 
69
  noise: request.sequence.noise === true,
70
+ noiseAmount: request.sequence.noise === true ? 2 : 0,
71
 
72
  steps: getValidNumber(request.sequence.steps, 10, 50, 45),
73