MCPcopy
hub / github.com/diffgram/diffgram / add_frame_to_queue

Method add_frame_to_queue

walrus/methods/video/video.py:482–595  ·  view source on GitHub ↗

Where frame is: a HxWxN np.array, where N=1 for mask clips and N=3 for RGB clips. https://zulko.github.io/moviepy/ref/VideoClip/VideoClip.html Careful we don't have self. context here Cautions * We purposely do not not pass the job id,

(
        self,
        frame,
        index: int,
        original_filename: str,
        project: Project,
        directory_id,
        video,
        length,
        video_parent_file: File,
        global_frame_number = None,
        initial_global_frame = None)

Source from the content-addressed store, hash-verified

480 process_media_queue_manager.router(item)
481
482 def add_frame_to_queue(
483 self,
484 frame,
485 index: int,
486 original_filename: str,
487 project: Project,
488 directory_id,
489 video,
490 length,
491 video_parent_file: File,
492 global_frame_number = None,
493 initial_global_frame = None):
494 """
495 Where frame is:
496 a HxWxN np.array, where N=1 for mask clips and N=3 for RGB clips.
497 https://zulko.github.io/moviepy/ref/VideoClip/VideoClip.html
498
499
500 Careful we don't have self. context here
501
502 Cautions
503 * We purposely do not not pass the job id, since we only want to original
504 video to be added to the job
505
506 Question,
507 is it correct we create input class in part to maintain
508 same concepts / format even for video frames?
509 Answer: For example see frame_end_number is used to pass information
510 Makes more sense to have it all in there then the PrioritizedItem() thing
511 long term
512 Also thinking in terms of logging
513 And yes of course, then it's complete reuse of the component
514
515
516 Jan 20, 2020
517 Note we purposely do NOT commit this as it creates unneeded
518 db overhead, so instead we only use it as a local object
519 to maintain consistency of design
520
521 which means we do NOT want to add to add it a sesion
522 ie self.session.add(input)
523 """
524
525 input = Input()
526
527 # Use input for class attributes,
528 # but don't add it to the session for video?
529
530 # TODO use File.new() for consistency here (ie as we add new things)
531
532 # Single frame naming
533 input.original_filename = f"{original_filename}_{str(index)}"
534 input.extension = ".jpg"
535 input.media_type = "frame"
536
537 input.temp_dir = tempfile.mkdtemp()
538 input.project = project
539 input.directory_id = directory_id

Callers 1

loadMethod · 0.95

Calls 4

InputClass · 0.90
PrioritizedItemClass · 0.90
routerMethod · 0.80

Tested by

no test coverage detected