From b781f41fb404850c1bbc04807946329fdb8c0532 Mon Sep 17 00:00:00 2001 From: Joanna Bitton Date: Thu, 26 Oct 2023 13:34:46 -0700 Subject: [PATCH] Fix Video Unit Tests (#248) Summary: A reason our OSS repo tests are failing is because on OSS our vidgear dependency was on v0.3.2 and we were on v0.2.4 They changed the `output_filename` parameter to be `output` between these versions, so updating our code Reviewed By: mayaliliya Differential Revision: D50663349 --- augly/audio/requirements.txt | 2 +- augly/video/augmenters/ffmpeg/base_augmenter.py | 2 +- augly/video/helpers/ffmpeg.py | 2 +- augly/video/helpers/utils.py | 8 +++----- requirements.txt | 1 + 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/augly/audio/requirements.txt b/augly/audio/requirements.txt index b5ea9ba3..55ef7e20 100644 --- a/augly/audio/requirements.txt +++ b/augly/audio/requirements.txt @@ -3,4 +3,4 @@ librosa>=0.8.1 numpy>=1.19.5 SoundFile>=0.10.3.post1 torch>=1.9.0 -torchaudio>=0.9.0 +torchaudio==2.0.2 diff --git a/augly/video/augmenters/ffmpeg/base_augmenter.py b/augly/video/augmenters/ffmpeg/base_augmenter.py index 90893c9e..ba48d7bf 100644 --- a/augly/video/augmenters/ffmpeg/base_augmenter.py +++ b/augly/video/augmenters/ffmpeg/base_augmenter.py @@ -46,7 +46,7 @@ def add_augmenter( if video_path == output_path: shutil.copyfile(video_path, tmpfile.name) video_path = tmpfile.name - writer = WriteGear(output_filename=output_path, logging=True) + writer = WriteGear(output=output_path, logging=True) writer.execute_ffmpeg_cmd(self.get_command(video_path, output_path)) writer.close() diff --git a/augly/video/helpers/ffmpeg.py b/augly/video/helpers/ffmpeg.py index b67537fc..bf7e5f34 100644 --- a/augly/video/helpers/ffmpeg.py +++ b/augly/video/helpers/ffmpeg.py @@ -69,7 +69,7 @@ def combine_frames_and_audio_to_file( def execute_vidgear_command(output_path: str, ffmpeg_command: List[str]) -> None: - writer = WriteGear(output_filename=output_path, logging=True) + writer = WriteGear(output=output_path, logging=True) writer.execute_ffmpeg_cmd(ffmpeg_command) writer.close() diff --git a/augly/video/helpers/utils.py b/augly/video/helpers/utils.py index db63fc2d..2106030a 100644 --- a/augly/video/helpers/utils.py +++ b/augly/video/helpers/utils.py @@ -68,11 +68,9 @@ def create_video_from_image(output_path: str, image_path: str, duration: float) utils.validate_image_path(image_path) assert duration > 0, "Duration of the video must be a positive value" - im_stream = ffmpeg.input(image_path) - video = ( - im_stream.filter("loop", 1) - .filter("framerate", utils.DEFAULT_FRAME_RATE) - .filter("pad", **{"width": "ceil(iw/2)*2", "height": "ceil(ih/2)*2"}) + im_stream = ffmpeg.input(image_path, stream_loop=-1) + video = im_stream.filter("framerate", utils.DEFAULT_FRAME_RATE).filter( + "pad", **{"width": "ceil(iw/2)*2", "height": "ceil(ih/2)*2"} ) silent_audio_path = utils.pathmgr.get_local_path(utils.SILENT_AUDIO_PATH) diff --git a/requirements.txt b/requirements.txt index 6acb2ff1..ac17fcb2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ dataclasses-json>=0.5.2 iopath>=0.1.8 python-magic>=0.4.22 regex>=2021.4.4 +setuptools>=65.5.1