Revert "[ffmpeg] Fix embedding subtitles (#9063)"
authorYen Chi Hsuan <yan12125@gmail.com>
Fri, 15 Jul 2016 11:53:10 +0000 (19:53 +0800)
committerYen Chi Hsuan <yan12125@gmail.com>
Fri, 15 Jul 2016 12:02:36 +0000 (20:02 +0800)
This reverts commit ccff2c404d7ea9f5b21ede8ae57bb79feec7eb94.

Fixes #10081.

The new approach breaks embedding subtitles into video-only or
audio-only files. FFMpeg provides a trick: add '?' after the argument of
'-map' so that a missing stream is ignored. For example:

opts = [
    '-map', '0:v?',
    '-c:v', 'copy',
    '-map', '0:a?',
    '-c:a', 'copy',
    # other options...
]

Unfortunately, such a format is not implemented in avconv, either.
I guess adding '-ignore_unknown' if self.basename == 'ffmpeg' is the
best solution. However, the example mentioned in #9063 no longer serves
problematic files, so I can't test it. I'll reopen #9063 and wait for
another example so that I can test '-ignore_unknown'.

youtube_dl/postprocessor/ffmpeg.py

index c1e9eb159ed9c2f969ad2ae3b9f90847b83cd98d..fa99b0c2a6aa4d39fbffdcbafd4926431794c55b 100644 (file)
@@ -363,10 +363,8 @@ class FFmpegEmbedSubtitlePP(FFmpegPostProcessor):
         input_files = [filename] + sub_filenames
 
         opts = [
-            '-map', '0:v',
-            '-c:v', 'copy',
-            '-map', '0:a',
-            '-c:a', 'copy',
+            '-map', '0',
+            '-c', 'copy',
             # Don't copy the existing subtitles, we may be running the
             # postprocessor a second time
             '-map', '-0:s',