diff options
author | georgekav2 <> | 2022-06-13 02:07:48 +0200 |
---|---|---|
committer | georgekav <> | 2023-02-20 12:13:01 +0100 |
commit | 821451b301e9e64678e03022cd4c53fc744c948f (patch) | |
tree | e2267e399d75a901720711c4f07f22aa769b55fa /app | |
parent | Add M4A GUI support (diff) | |
download | metube-821451b301e9e64678e03022cd4c53fc744c948f.tar.gz metube-821451b301e9e64678e03022cd4c53fc744c948f.tar.bz2 metube-821451b301e9e64678e03022cd4c53fc744c948f.zip |
Add M4A backend support.
Diffstat (limited to 'app')
-rw-r--r-- | app/dl_formats.py | 8 |
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"}) |