Merge pull request #9195 from remitamine/ffmpeg-pipe
authorremitamine <remitamine@gmail.com>
Sat, 16 Apr 2016 21:00:49 +0000 (22:00 +0100)
committerremitamine <remitamine@gmail.com>
Sat, 16 Apr 2016 21:00:49 +0000 (22:00 +0100)
[downloader/external] enable piping for FFmpegFD(closes #2124)

youtube_dl/downloader/external.py
youtube_dl/postprocessor/ffmpeg.py

index 30277dc205787d226360cfc950e5c08796a5fc03..8d642fc3e60594f10a057847cf5702f715941326 100644 (file)
@@ -225,7 +225,7 @@ class FFmpegFD(ExternalFD):
 
         args += ['-i', url, '-c', 'copy']
         if protocol == 'm3u8':
-            if self.params.get('hls_use_mpegts', False):
+            if self.params.get('hls_use_mpegts', False) or tmpfilename == '-':
                 args += ['-f', 'mpegts']
             else:
                 args += ['-f', 'mp4', '-bsf:a', 'aac_adtstoasc']
index b64cd396bca6f2ec4457e64a294ec7bc9208bbf1..1793a878cb57b60ab7e59cb55f17eb4127c32f92 100644 (file)
@@ -175,7 +175,8 @@ class FFmpegPostProcessor(PostProcessor):
         # Always use 'file:' because the filename may contain ':' (ffmpeg
         # interprets that as a protocol) or can start with '-' (-- is broken in
         # ffmpeg, see https://ffmpeg.org/trac/ffmpeg/ticket/2127 for details)
-        return 'file:' + fn
+        # Also leave '-' intact in order not to break streaming to stdout.
+        return 'file:' + fn if fn != '-' else fn
 
 
 class FFmpegExtractAudioPP(FFmpegPostProcessor):