create output dir if not already there

This commit is contained in:
marko
2022-02-18 17:31:17 +01:00
parent c7ddd690d1
commit 3e632d49a6

View File

@@ -7,6 +7,8 @@ import subprocess
import glob
import sys
import argparse
import os
config = {
'vcodec': "vp9",
@@ -26,6 +28,13 @@ with open(jsonFileName) as jf:
ydl_opts = {"outtmpl": "%(id)s"}
for clip in clipDict:
# create the directories so ffmped doesn't complain
try:
outputDir = os.path.dirname(clip['target'])
os.makedirs(outputDir)
except:
print(f"Couldn't create {outputDir}")
infoDict = None
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
infoDict = ydl.extract_info(clip['source'], download=False)
@@ -70,7 +79,9 @@ for clip in clipDict:
# "an":None,
"y":None,
"pass":"1",
"b:v":"512k", "minrate":"375k", "maxrate":"1088k",
# "b:v":"276k", "minrate":"138k", "maxrate":"400k", # x360
"b:v":"512k", "minrate":"256k", "maxrate":"742k", # x480 LQ
# "b:v":"750k", "minrate":"375k", "maxrate":"1088k", # x480 MQ
"quality":"good",
}
)