diff --git a/dataset_dataloading/video2dataset/video2dataset/data_reader.py b/dataset_dataloading/video2dataset/video2dataset/data_reader.py index ec6a47f..cb3c601 100755 --- a/dataset_dataloading/video2dataset/video2dataset/data_reader.py +++ b/dataset_dataloading/video2dataset/video2dataset/data_reader.py @@ -160,11 +160,13 @@ class YtDlpDownloader: download_size: preferred height of video to download. Will try to download smallest video >=download_size download_audio_rate: same as size but with audio yt_metadata_args: see get_yt_metadata function docstring + ydl_args: see YoutubeDL docstring """ # TODO: maybe we just include height and width in the metadata_args def __init__(self, yt_args, tmp_dir, encode_formats): self.metadata_args = yt_args.get("yt_metadata_args", {}) + self.ydl_args = yt_args.get("ydl_args", {}) self.video_size = yt_args.get("download_size", 360) self.audio_rate = yt_args.get("download_audio_rate", 44100) self.download_audio = yt_args.get("download_audio", False) @@ -191,6 +193,7 @@ def __call__(self, url): if self.encode_formats.get("audio", None): audio_path_m4a = f"{self.tmp_dir}/{str(uuid.uuid4())}.m4a" ydl_opts = { + **self.ydl_args, "outtmpl": audio_path_m4a, "format": audio_fmt_string, "quiet": True, @@ -214,6 +217,7 @@ def __call__(self, url): if self.encode_formats.get("video", None): video_path = f"{self.tmp_dir}/{str(uuid.uuid4())}.mp4" ydl_opts = { + **self.ydl_args, "outtmpl": video_path, "format": video_format_string, "quiet": True,