MCPcopy
hub / github.com/CiaraStrawberry/TemporalKit / process_video_batch

Function process_video_batch

scripts/Berry_Method.py:293–320  ·  view source on GitHub ↗
(video_path_old, fps, per_side, batch_size, fillindenoise, edgedenoise, _smol_resolution,square_textures,max_frames,output_folder,border)

Source from the content-addressed store, hash-verified

291 return merged_batches
292
293def process_video_batch (video_path_old, fps, per_side, batch_size, fillindenoise, edgedenoise, _smol_resolution,square_textures,max_frames,output_folder,border):
294 video_path = os.path.join (output_folder, "input_video.mp4")
295 per_batch_limmit = (((per_side * per_side) * batch_size)) + border
296 video_data = convert_video_to_bytes(video_path)
297 frames = utilityb.extract_frames_movpie(video_data, fps, max_frames)
298 print(f"splitting into batches with per_batch_limmit = {per_batch_limmit} and border {border}" )
299 bigbatches = split_frames_into_big_batches(frames, per_batch_limmit,border,ebsynth=False)
300 bigprocessedbatches = []
301 for i , batch in enumerate(bigbatches):
302 if i < len(square_textures):
303 new_batch = process_video(batch, per_side, batch_size, fillindenoise, edgedenoise, _smol_resolution,square_textures[i])
304 bigprocessedbatches.append(new_batch)
305 for a, image in enumerate(new_batch):
306 Image.fromarray(image).save(os.path.join(output_folder, f"result/output{a + (len(new_batch) * i)}.png"))
307
308 just_frame_groups = []
309 print (f"bigprocessedbatches len = {len(bigprocessedbatches)}")
310 for i in range(len(bigprocessedbatches)):
311 newgroup = []
312 for b in range(len(bigprocessedbatches[i])):
313 newgroup.append(bigprocessedbatches[i][b])
314 just_frame_groups.append(newgroup)
315
316 combined = merge_image_batches(just_frame_groups, border)
317
318 save_loc = os.path.join(output_folder, "blended.mp4")
319 generated_vid = utilityb.pil_images_to_video(combined,save_loc, fps)
320 return generated_vid
321
322
323def process_video_single(video_path, fps, per_side, batch_size, fillindenoise, edgedenoise, _smol_resolution,square_texture):

Callers

nothing calls this directly

Calls 4

process_videoFunction · 0.85
merge_image_batchesFunction · 0.85
convert_video_to_bytesFunction · 0.70

Tested by

no test coverage detected