[ffmpeg] convert format ext to ffmpeg output formats codes
authorremitamine <remitamine@gmail.com>
Sun, 13 Mar 2016 11:15:29 +0000 (12:15 +0100)
committerremitamine <remitamine@gmail.com>
Sun, 13 Mar 2016 11:15:29 +0000 (12:15 +0100)
youtube_dl/downloader/external.py
youtube_dl/postprocessor/ffmpeg.py

index a4fdf1af8053a2d3215cdbcc2f2333ba61d7807c..fcb956e6caed93058ab7bc005abc8ef02c883dbd 100644 (file)
@@ -6,7 +6,7 @@ import sys
 import re
 
 from .common import FileDownloader
-from ..postprocessor.ffmpeg import FFmpegPostProcessor
+from ..postprocessor.ffmpeg import FFmpegPostProcessor, EXT_TO_OUT_FORMATS
 from ..compat import compat_str
 from ..utils import (
     cli_option,
@@ -197,7 +197,7 @@ class FFmpegFD(ExternalFD):
             else:
                 args += ['-f', 'mp4', '-bsf:a', 'aac_adtstoasc']
         else:
-            args += ['-f', info_dict['ext']]
+            args += ['-f', EXT_TO_OUT_FORMATS.get(info_dict['ext'], info_dict['ext'])]
 
         args = [encodeArgument(opt) for opt in args]
         args.append(encodeFilename(ffpp._ffmpeg_filename_argument(tmpfilename), True))
index 380bc6f292f2390fdf5dabd131a20184ba8334df..cc7aaeda397ba8b5dd368c770e39a7a4c34f4719 100644 (file)
@@ -25,6 +25,19 @@ from ..utils import (
 )
 
 
+EXT_TO_OUT_FORMATS = {
+    "aac": "adts",
+    "m4a": "ipod",
+    "mka": "matroska",
+    "mkv": "matroska",
+    "mpg": "mpeg",
+    "ogv": "ogg",
+    "ts": "mpegts",
+    "wma": "asf",
+    "wmv": "asf",
+}
+
+
 class FFmpegPostProcessorError(PostProcessingError):
     pass