aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/dl_formats.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/app/dl_formats.py b/app/dl_formats.py
index 5936b35..e2f6591 100644
--- a/app/dl_formats.py
+++ b/app/dl_formats.py
@@ -23,14 +23,13 @@ def get_format(format: str, quality: str) -> str:
# Quality is irrelevant in this case since we skip the download
return "bestaudio/best"
- if format == "mp3":
+ if format in ("m4a", "mp3"):
# Audio quality needs to be set post-download, set in opts
return "bestaudio/best"
if format in ("mp4", "any"):
if quality == "audio":
return "bestaudio/best"
-
# video {res} {vfmt} + audio {afmt} {res} {vfmt}
vfmt, afmt = ("[ext=mp4]", "[ext=m4a]") if format == "mp4" else ("", "")
vres = f"[height<={quality}]" if quality != "best" else ""
@@ -60,12 +59,13 @@ def get_opts(format: str, quality: str, ytdl_opts: dict) -> dict:
if "postprocessors" not in opts:
opts["postprocessors"] = []
- if format == "mp3":
+ if format in ("m4a", "mp3"):
opts["postprocessors"].append({
"key": "FFmpegExtractAudio",
- "preferredcodec": "mp3",
+ "preferredcodec": format,
"preferredquality": 0 if quality == "best" else quality,
})
+
opts["writethumbnail"] = True
opts["postprocessors"].append({"key": "FFmpegThumbnailsConvertor", "format": "jpg", "when": "before_dl"})
opts["postprocessors"].append({"key": "FFmpegMetadata"})
bgstack15