(self, p:StableDiffusionProcessingImg2Img, file_path, fps, file_obj, sfactor, sexp, freeze_input_fps, keep_fps, *args)
| 140 | return self.img2img_component |
| 141 | |
| 142 | def run(self, p:StableDiffusionProcessingImg2Img, file_path, fps, file_obj, sfactor, sexp, freeze_input_fps, keep_fps, *args): |
| 143 | save_dir = "outputs/img2img-video/" |
| 144 | os.makedirs(save_dir, exist_ok=True) |
| 145 | path = modules.paths.script_path |
| 146 | if platform.system() == 'Windows': |
| 147 | ffmpeg.install(path) |
| 148 | import skvideo |
| 149 | skvideo.setFFmpegPath(os.path.join(path, "ffmpeg")) |
| 150 | import skvideo.io |
| 151 | |
| 152 | self.latentmem = LatentMemory(interp_factor=sfactor,scale_factor=sexp) |
| 153 | if not self.is_have_callback: |
| 154 | def callback(params):#CFGDenoiserParams |
| 155 | self.latentmem.put(params.x) |
| 156 | if self.latentmem.flushed: |
| 157 | latent = self.latentmem.get() |
| 158 | params.x = self.latentmem.interpolate(params.x, latent) |
| 159 | |
| 160 | if params.sampling_step == params.total_sampling_steps-2: |
| 161 | self.latentmem.flush() |
| 162 | |
| 163 | on_cfg_denoiser(callback) |
| 164 | self.is_have_callback = True |
| 165 | |
| 166 | if not os.path.isfile(file_path): |
| 167 | file_path = file_obj.name |
| 168 | |
| 169 | initial_seed = p.seed |
| 170 | if initial_seed == -1: |
| 171 | initial_seed = randint(100000000,999999999) |
| 172 | p.seed = initial_seed |
| 173 | processing.fix_seed(p) |
| 174 | |
| 175 | p.do_not_save_grid = True |
| 176 | p.do_not_save_samples = True |
| 177 | p.batch_count = 1 |
| 178 | |
| 179 | start_time = "00:00:00" |
| 180 | end_time = "00:00:00" |
| 181 | start_time = start_time.strip() |
| 182 | end_time = end_time.strip() |
| 183 | |
| 184 | if start_time == "" or start_time == "hh:mm:ss": |
| 185 | start_time = "00:00:00" |
| 186 | if end_time == "00:00:00" or end_time == "hh:mm:ss": |
| 187 | end_time = "" |
| 188 | |
| 189 | time_interval = ( |
| 190 | f"-ss {start_time}" + f" -to {end_time}" if len(end_time) else "" |
| 191 | ) |
| 192 | |
| 193 | input_file = os.path.normpath(file_path.strip()) |
| 194 | |
| 195 | if freeze_input_fps: |
| 196 | decoder = skvideo.io.FFmpegReader(input_file) |
| 197 | else: |
| 198 | decoder = skvideo.io.FFmpegReader(input_file,outputdict={ |
| 199 | '-r':str(fps) |
nothing calls this directly
no test coverage detected