Merge pull request #8354 from remitamine/m3u8_metadata
authorremitamine <remitamine@gmail.com>
Tue, 2 Feb 2016 18:13:58 +0000 (19:13 +0100)
committerremitamine <remitamine@gmail.com>
Tue, 2 Feb 2016 18:13:58 +0000 (19:13 +0100)
[ffmpeg] fix adding metadata when using m3u8_native(fixes #8350)

1  2 
youtube_dl/postprocessor/ffmpeg.py

index 16a64802a5b4208f4407b58d146e77cf5073378f,48f86e21c6fbb46eb202f6fff8192607f306ec03..d3d9d4f1da13be926b05714f04f801ce0f664613
@@@ -391,6 -391,10 +391,10 @@@ 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['protocol'] == 'm3u8_native':
+             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))
@@@ -479,7 -483,6 +483,7 @@@ class FFmpegSubtitlesConvertorPP(FFmpeg
              self._downloader.to_screen('[ffmpeg] There aren\'t any subtitles to convert')
              return [], info
          self._downloader.to_screen('[ffmpeg] Converting subtitles')
 +        sub_filenames = []
          for lang, sub in subs.items():
              ext = sub['ext']
              if ext == new_ext:
                      '[ffmpeg] Subtitle file for %s is already in the requested'
                      'format' % new_ext)
                  continue
 +            old_file = subtitles_filename(filename, lang, ext)
 +            sub_filenames.append(old_file)
              new_file = subtitles_filename(filename, lang, new_ext)
  
              if ext == 'dfxp' or ext == 'ttml':
                      'You have requested to convert dfxp (TTML) subtitles into another format, '
                      'which results in style information loss')
  
 -                dfxp_file = subtitles_filename(filename, lang, ext)
 +                dfxp_file = old_file
                  srt_file = subtitles_filename(filename, lang, 'srt')
  
                  with io.open(dfxp_file, 'rt', encoding='utf-8') as f:
                  if new_ext == 'srt':
                      continue
  
 -            self.run_ffmpeg(
 -                subtitles_filename(filename, lang, ext),
 -                new_file, ['-f', new_format])
 +            self.run_ffmpeg(old_file, new_file, ['-f', new_format])
  
              with io.open(new_file, 'rt', encoding='utf-8') as f:
                  subs[lang] = {
                      'data': f.read(),
                  }
  
 -        return [], info
 +        return sub_filenames, info