From a755f82549cb6bffd8ff9545e0b0a4883b7422d2 Mon Sep 17 00:00:00 2001 From: remitamine Date: Sun, 13 Mar 2016 12:15:29 +0100 Subject: [PATCH] [ffmpeg] convert format ext to ffmpeg output formats codes --- youtube_dl/downloader/external.py | 4 ++-- youtube_dl/postprocessor/ffmpeg.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/youtube_dl/downloader/external.py b/youtube_dl/downloader/external.py index a4fdf1af8..fcb956e6c 100644 --- a/youtube_dl/downloader/external.py +++ b/youtube_dl/downloader/external.py @@ -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)) diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py index 380bc6f29..cc7aaeda3 100644 --- a/youtube_dl/postprocessor/ffmpeg.py +++ b/youtube_dl/postprocessor/ffmpeg.py @@ -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 -- 2.22.2