Merge pull request #8611 from remitamine/ffmpegfd
authorremitamine <remitamine@gmail.com>
Sun, 13 Mar 2016 20:30:27 +0000 (21:30 +0100)
committerremitamine <remitamine@gmail.com>
Sun, 13 Mar 2016 20:30:27 +0000 (21:30 +0100)
[downloader/external] Add FFmpegFD

1  2 
youtube_dl/postprocessor/ffmpeg.py

index 81102f9bba83cbfb299222a5aa5c06fdd579d7e6,cc7aaeda397ba8b5dd368c770e39a7a4c34f4719..a8819f258013de5a1cbbf1a5b42ca87b2b4ef14e
@@@ -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)