Compare commits
No commits in common. "67524256825b74ae711c62553ea95a5a8aa0cdbd" and "5a9f765281ac3961a03280128094f0d61f812ded" have entirely different histories.
6752425682
...
5a9f765281
@ -4,51 +4,15 @@ import encode_single_video
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import argparse
|
# tuple of video file extensions
|
||||||
|
videofileextensions = (".webm", ".mp4")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
videofiles: list[str] = []
|
||||||
parser = argparse.ArgumentParser(description="")
|
for root, dirs, files in os.walk("source"):
|
||||||
|
|
||||||
parser.add_argument(
|
|
||||||
"-o",
|
|
||||||
"--output-dir",
|
|
||||||
required=False,
|
|
||||||
type=str,
|
|
||||||
help='Output directory for encodes. Default is "encodes" in current working directory',
|
|
||||||
default="encodes",
|
|
||||||
)
|
|
||||||
|
|
||||||
parser.add_argument(
|
|
||||||
"-k",
|
|
||||||
"--keep-encodes",
|
|
||||||
action="store_true",
|
|
||||||
required=False,
|
|
||||||
help="Don't delete encodes after getting their scores. Default is False (delete)",
|
|
||||||
)
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
# REVIEW expose this as variable/argument?
|
|
||||||
outputpath: str = args.output_dir
|
|
||||||
|
|
||||||
keepencodes: bool = args.keep_encodes
|
|
||||||
|
|
||||||
# tuple of video file extensions
|
|
||||||
videofileextensions = (".webm", ".mp4")
|
|
||||||
|
|
||||||
# search all video files in "source"
|
|
||||||
videofiles: list[str] = []
|
|
||||||
for root, dirs, files in os.walk("source"):
|
|
||||||
for file in files:
|
for file in files:
|
||||||
if file.endswith(videofileextensions):
|
if file.endswith(videofileextensions):
|
||||||
filepath = os.path.join(root, file)
|
filepath = os.path.join(root, file)
|
||||||
videofiles.append(filepath)
|
videofiles.append(filepath)
|
||||||
|
|
||||||
try:
|
for video in videofiles:
|
||||||
# encode all video files
|
encode_single_video.main(inputfile=video)
|
||||||
for video in videofiles:
|
|
||||||
encode_single_video.main(
|
|
||||||
inputfile=video, outputpath=outputpath, keepencodes=keepencodes
|
|
||||||
)
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
encode_single_video.cleanup(keepencodes=keepencodes)
|
|
||||||
|
@ -417,12 +417,21 @@ if __name__ == "__main__":
|
|||||||
help="Input file to encode",
|
help="Input file to encode",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# in case you wanted to rerun the conversion for everything
|
||||||
|
parser.add_argument(
|
||||||
|
"-r",
|
||||||
|
"--reset",
|
||||||
|
required=False,
|
||||||
|
action="store_true",
|
||||||
|
help="Rerun conversion for all files",
|
||||||
|
)
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-k",
|
"-k",
|
||||||
"--keep-encodes",
|
"--keep-encodes",
|
||||||
action="store_true",
|
action="store_true",
|
||||||
required=False,
|
required=False,
|
||||||
help="Don't delete encodes after getting their scores. Default is False (delete)",
|
help="Don't delete encodes after getting their scores. Default is delete (False)",
|
||||||
)
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
Loading…
Reference in New Issue
Block a user