]> jfr.im git - yt-dlp.git/commitdiff
[ExtractAudio] Handle outtmpl without ext (#6005)
authorChris Caruso <redacted>
Fri, 17 Feb 2023 08:06:15 +0000 (00:06 -0800)
committerGitHub <redacted>
Fri, 17 Feb 2023 08:06:15 +0000 (13:36 +0530)
Authored by: carusocr
Closes #5968

yt_dlp/__init__.py
yt_dlp/postprocessor/ffmpeg.py

index 255b31735181b7c91909428b1855b707055caed6..fb44303a26fd0276cd78626e2689d1bfccaed647 100644 (file)
@@ -318,10 +318,6 @@ def validate_outtmpl(tmpl, msg):
     if outtmpl_default == '':
         opts.skip_download = None
         del opts.outtmpl['default']
-    if outtmpl_default and not os.path.splitext(outtmpl_default)[1] and opts.extractaudio:
-        raise ValueError(
-            'Cannot download a video and extract audio into the same file! '
-            f'Use "{outtmpl_default}.%(ext)s" instead of "{outtmpl_default}" as the output template')
 
     def parse_chapters(name, value):
         chapters, ranges = [], []
index 5acd75376275e970d0b931ca9bf076dae0278c8d..123a95a3a9e2d0b88df21ff12fd2337c4c61c10a 100644 (file)
@@ -508,8 +508,7 @@ def run(self, information):
         if acodec != 'copy':
             more_opts = self._quality_args(acodec)
 
-        # not os.path.splitext, since the latter does not work on unicode in all setups
-        temp_path = new_path = f'{path.rpartition(".")[0]}.{extension}'
+        temp_path = new_path = replace_extension(path, extension, information['ext'])
 
         if new_path == path:
             if acodec == 'copy':