mirror of
https://github.com/master-of-zen/Av1an.git
synced 2024-11-24 18:18:06 +00:00
Update main.py
This commit is contained in:
parent
030138f273
commit
4ba518e622
1 changed files with 9 additions and 4 deletions
13
main.py
13
main.py
|
@ -48,6 +48,11 @@ def get_video_queue(source_path):
|
||||||
|
|
||||||
|
|
||||||
def encode(commands):
|
def encode(commands):
|
||||||
|
"""
|
||||||
|
Passing encoding params to ffmpeg for encoding
|
||||||
|
TODO:
|
||||||
|
Replace ffmpeg with aomenc because ffmpeg libaom doen't work with parameters properly
|
||||||
|
"""
|
||||||
cmd = f'ffmpeg {commands}'
|
cmd = f'ffmpeg {commands}'
|
||||||
subprocess.Popen(cmd, shell=True).wait()
|
subprocess.Popen(cmd, shell=True).wait()
|
||||||
|
|
||||||
|
@ -73,10 +78,6 @@ def main(input_video, encoding_params, num_worker):
|
||||||
os.makedirs(f'{os.getcwd()}/temp/split', exist_ok=True)
|
os.makedirs(f'{os.getcwd()}/temp/split', exist_ok=True)
|
||||||
os.makedirs(f'{os.getcwd()}/temp/encode', exist_ok=True)
|
os.makedirs(f'{os.getcwd()}/temp/encode', exist_ok=True)
|
||||||
|
|
||||||
# Passing encoding parameters
|
|
||||||
# no audio av1 codec adding tiles speed quality
|
|
||||||
#encoding_params = ' -an -c:v libaom-av1 -strict -2 -row-mt 1 -tiles 2x2 -cpu-used 8 -crf 60 '
|
|
||||||
|
|
||||||
# Spliting video and sorting big-first
|
# Spliting video and sorting big-first
|
||||||
split_video(input_video)
|
split_video(input_video)
|
||||||
vid_queue = get_video_queue('temp')
|
vid_queue = get_video_queue('temp')
|
||||||
|
@ -94,9 +95,13 @@ def main(input_video, encoding_params, num_worker):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
# Command line parser
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--encoding_params', type=str, default=' -an -c:v libaom-av1 -strict -2 -row-mt 1 -tiles 2x2 -cpu-used 8 -crf 60 ', help='FFmpeg settings')
|
parser.add_argument('--encoding_params', type=str, default=' -an -c:v libaom-av1 -strict -2 -row-mt 1 -tiles 2x2 -cpu-used 8 -crf 60 ', help='FFmpeg settings')
|
||||||
parser.add_argument('--input_file', '-i', type=str, default='bruh.mp4', help='input video file')
|
parser.add_argument('--input_file', '-i', type=str, default='bruh.mp4', help='input video file')
|
||||||
parser.add_argument('--num_worker', '-t', type=int, default=8, help='number of encode running at a time')
|
parser.add_argument('--num_worker', '-t', type=int, default=8, help='number of encode running at a time')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# Main thread
|
||||||
main(args.input_file, args.encoding_params, args.num_worker)
|
main(args.input_file, args.encoding_params, args.num_worker)
|
Loading…
Reference in a new issue