def test_webm_with_lower_frame_rate(self): video_path = os.path.join(os.path.dirname(__file__), 'test.webm') with temp_dir_for_bursting() as temp_burst_dir: imgs = burst_video_into_frames(video_path, temp_burst_dir, frame_rate=8) self.assertEqual(39, len(imgs))
def iter_data(self, slice_element=None): slice_element = slice_element or slice(0, len(self)) for meta in self.all_meta[slice_element]: video_path = os.path.join(self.videos_dir, str(meta['id'] + '.gif')) with temp_dir_for_bursting(self.shm_dir_path) as temp_burst_dir: frame_paths = burst_video_into_frames( video_path, temp_burst_dir, frame_rate=self.frame_rate) frames = list(resize_images(frame_paths, self.frame_size)) result = {'meta': meta, 'frames': frames, 'id': meta['id']} yield result
def test_webm(self): video_path = os.path.join(os.path.dirname(__file__), 'test.webm') with temp_dir_for_bursting() as temp_burst_dir: imgs = burst_video_into_frames(video_path, temp_burst_dir) # different ffmpeg versions, yield slightly different numbers self.assertIn(len(imgs), [140, 141])