def test_break_scene_superbowl_2(self):
     frames = video_summarization.read_frames_from_folder(
         "input/frames/superbowl_2")
     audio_file = AudioSegment.from_file("input/audio/superbowl_2.wav")
     cuts = video_summarization.compute_scene_cuts(frames)
     video_summarization.create_scene_video_from_breaks(
         frames, audio_file, cuts, "test/superbowl_2")
 def test_movement_score(self):
     frames = video_summarization.read_frames_from_folder(
         "input/frames/soccer", start=0, end=3000)
     breaks = video_summarization.compute_scene_cuts(frames)
     score = video_summarization.compute_movement_score(
         frames, breaks[0][0], breaks[0][1])
     print(score)
Ejemplo n.º 3
0
def main(frames_dir, audio_dir, output_dir):
    print("Processing frames folder '{}', audio folder '{}' save to '{}' ...".
          format(frames_dir, audio_dir, output_dir))
    frames = video_summarization.read_frames_from_folder(frames_dir)
    video_file = video_summarization.create_video_from_frames(
        frames, output_dir)
    video_summarization.combine_frames_and_audio(video_file, audio_dir,
                                                 output_dir)
 def test_SAD(self):
     start = 0
     end = -1
     frames = video_summarization.read_frames_from_folder(
         "input/frames/soccer", start=start, end=end)
     diffs = video_summarization.compute_difference_SAD(frames)
     video_summarization.plot_difference_scores(
         diffs, plot_filename="test/diff_SAD_soccer.png", start=start)
 def test_compute_distance_between_frames(self):
     frames = video_summarization.read_frames_from_folder(
         "input/frames/soccer", start=0, end=3000)
     breaks = video_summarization.compute_scene_cuts(frames)
     scenes = video_summarization.create_scene_frames_from_breaks(
         frames, breaks)
     h = video_summarization.compute_homographies_from_frames(scenes[0])
     video_summarization.plot_homographies(h,
                                           "test/",
                                           prefix="soccer_scene1")
Ejemplo n.º 6
0
    def video_combination(self):

        video_name = self.frames_folder_dir.split("\\")[-1]
        self.output_dir = os.path.join('output/', video_name)
        print(video_name, self.frames_folder_dir, self.audio_file_dir,
              self.output_dir)
        try:
            os.makedirs(self.output_dir)
        except OSError as exception:
            if exception.errno != errno.EEXIST:
                raise
        self.frames = video_summarization.read_frames_from_folder(
            self.frames_folder_dir)
        video_summarization.create_combined_video(self.frames,
                                                  self.audio_file_dir,
                                                  self.output_dir)
        path = os.path.abspath(self.output_dir)
        play_path = os.path.join(path, 'combined.mp4')
        self.video_path = play_path
        self.generated = True
Ejemplo n.º 7
0
    def video_summarization(self):

        if self.generated:
            video_summarization.create_summarized_video_from_combined_video(
                self.frames, self.video_path, self.audio_file_dir,
                self.output_dir)
            path = os.path.abspath(self.output_dir)
            play_path = os.path.join(path, 'final.mp4')
            self.summarized_video_path = play_path
        else:
            video_name = self.frames_folder_dir.split("\\")[-1]
            self.output_dir = os.path.join('output/', video_name)
            self.frames = video_summarization.read_frames_from_folder(
                self.frames_folder_dir)
            video_summarization.create_summarized_video(
                self.frames, self.audio_file_dir, self.output_dir)
            path = os.path.abspath(self.output_dir)
            play_path = os.path.join(path, 'combined.mp4')
            self.video_path = play_path
            play_path = os.path.join(path, 'final.mp4')
            self.summarized_video_path = play_path
 def test_compute_cut(self):
     frames = video_summarization.read_frames_from_folder(
         "input/frames/soccer")
     cuts = video_summarization.compute_scene_cuts(frames)
     print(cuts)
 def test_compute_distance_between_frames1(self):
     frames = video_summarization.read_frames_from_folder(
         "input/frames/soccer")
     h = video_summarization.compute_homographies_from_frames(frames)
     video_summarization.plot_homographies(h, "test/", prefix="soccer")