[downloader/external:ffmpeg] minimize the use of aac_adtstoasc filter
authorRemita Amine <remitamine@gmail.com>
Thu, 2 Feb 2017 07:05:16 +0000 (08:05 +0100)
committerRemita Amine <remitamine@gmail.com>
Thu, 2 Feb 2017 07:07:28 +0000 (08:07 +0100)
youtube_dl/downloader/external.py

index 5d3e5d8d3d748d98ea187e8eca4444c5504e07fb..138f353efcde9481ac2b04d01973522cbaedf756 100644 (file)
@@ -17,6 +17,7 @@ from ..utils import (
     encodeArgument,
     handle_youtubedl_headers,
     check_executable,
+    is_outdated_version,
 )
 
 
@@ -264,7 +265,9 @@ class FFmpegFD(ExternalFD):
             if self.params.get('hls_use_mpegts', False) or tmpfilename == '-':
                 args += ['-f', 'mpegts']
             else:
-                args += ['-f', 'mp4', '-bsf:a', 'aac_adtstoasc']
+                args += ['-f', 'mp4']
+                if (ffpp.basename == 'ffmpeg' and is_outdated_version(ffpp._versions['ffmpeg'], '3.2')) and (not info_dict.get('acodec') or info_dict['acodec'].split('.')[0] in ('aac', 'mp4a')):
+                    args += ['-bsf:a', 'aac_adtstoasc']
         elif protocol == 'rtmp':
             args += ['-f', 'flv']
         else: