Browse Source

[ffmpeg] convert format ext to ffmpeg output formats codes

master
remitamine 8 years ago
parent
commit
a755f82549
2 changed files with 15 additions and 2 deletions
  1. 4
      youtube_dl/downloader/external.py
  2. 13
      youtube_dl/postprocessor/ffmpeg.py

4
youtube_dl/downloader/external.py

@ -6,7 +6,7 @@ import sys
import re import re
from .common import FileDownloader from .common import FileDownloader
from ..postprocessor.ffmpeg import FFmpegPostProcessor
from ..postprocessor.ffmpeg import FFmpegPostProcessor, EXT_TO_OUT_FORMATS
from ..compat import compat_str from ..compat import compat_str
from ..utils import ( from ..utils import (
cli_option, cli_option,
@ -197,7 +197,7 @@ class FFmpegFD(ExternalFD):
else: else:
args += ['-f', 'mp4', '-bsf:a', 'aac_adtstoasc'] args += ['-f', 'mp4', '-bsf:a', 'aac_adtstoasc']
else: 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 = [encodeArgument(opt) for opt in args]
args.append(encodeFilename(ffpp._ffmpeg_filename_argument(tmpfilename), True)) args.append(encodeFilename(ffpp._ffmpeg_filename_argument(tmpfilename), True))

13
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): class FFmpegPostProcessorError(PostProcessingError):
pass pass

Loading…
Cancel
Save