From: remitamine Date: Sun, 13 Mar 2016 20:30:27 +0000 (+0100) Subject: Merge pull request #8611 from remitamine/ffmpegfd X-Git-Url: http://git.bitcoin.ninja/index.cgi?p=youtube-dl;a=commitdiff_plain;h=2e7e561c1d9dedf1a8e5a206e1ef86cfa4599956;hp=-c Merge pull request #8611 from remitamine/ffmpegfd [downloader/external] Add FFmpegFD --- 2e7e561c1d9dedf1a8e5a206e1ef86cfa4599956 diff --combined youtube_dl/postprocessor/ffmpeg.py index 81102f9bb,cc7aaeda3..a8819f258 --- a/youtube_dl/postprocessor/ffmpeg.py +++ b/youtube_dl/postprocessor/ffmpeg.py @@@ -25,6 -25,19 +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 @@@ -391,6 -404,10 +404,6 @@@ class FFmpegMetadataPP(FFmpegPostProces for (name, value) in metadata.items(): options.extend(['-metadata', '%s=%s' % (name, value)]) - # https://github.com/rg3/youtube-dl/issues/8350 - if info.get('protocol') == 'm3u8_native' or info.get('protocol') == 'm3u8' and self._downloader.params.get('hls_prefer_native', False): - options.extend(['-bsf:a', 'aac_adtstoasc']) - self._downloader.to_screen('[ffmpeg] Adding metadata to \'%s\'' % filename) self.run_ffmpeg(filename, temp_filename, options) os.remove(encodeFilename(filename)) @@@ -463,21 -480,6 +476,21 @@@ class FFmpegFixupM4aPP(FFmpegPostProces return [], info +class FFmpegFixupM3u8PP(FFmpegPostProcessor): + def run(self, info): + filename = info['filepath'] + temp_filename = prepend_extension(filename, 'temp') + + options = ['-c', 'copy', '-f', 'mp4', '-bsf:a', 'aac_adtstoasc'] + self._downloader.to_screen('[ffmpeg] Fixing malformated aac bitstream in "%s"' % filename) + self.run_ffmpeg(filename, temp_filename, options) + + os.remove(encodeFilename(filename)) + os.rename(encodeFilename(temp_filename), encodeFilename(filename)) + + return [], info + + class FFmpegSubtitlesConvertorPP(FFmpegPostProcessor): def __init__(self, downloader=None, format=None): super(FFmpegSubtitlesConvertorPP, self).__init__(downloader)