فهرست منبع

Add --hls-prefer-ffmpeg

Sergey M․ 9 سال پیش
والد
کامیت
bf09af3acb
3فایلهای تغییر یافته به همراه12 افزوده شده و 3 حذف شده
  1. 3 1
      youtube_dl/YoutubeDL.py
  2. 4 1
      youtube_dl/downloader/__init__.py
  3. 5 1
      youtube_dl/options.py

+ 3 - 1
youtube_dl/YoutubeDL.py

@@ -260,7 +260,9 @@ class YoutubeDL(object):
     The following options determine which downloader is picked:
     The following options determine which downloader is picked:
     external_downloader: Executable of the external downloader to call.
     external_downloader: Executable of the external downloader to call.
                        None or unset for standard (built-in) downloader.
                        None or unset for standard (built-in) downloader.
-    hls_prefer_native: Use the native HLS downloader instead of ffmpeg/avconv.
+    hls_prefer_native: Use the native HLS downloader instead of ffmpeg/avconv
+                       if True, otherwise use ffmpeg/avconv if False, otherwise
+                       use downloader suggested by extractor if None.
 
 
     The following parameters are not used by YoutubeDL itself, they are used by
     The following parameters are not used by YoutubeDL itself, they are used by
     the downloader (see youtube_dl/downloader/common.py):
     the downloader (see youtube_dl/downloader/common.py):

+ 4 - 1
youtube_dl/downloader/__init__.py

@@ -41,9 +41,12 @@ def get_suitable_downloader(info_dict, params={}):
         if ed.can_download(info_dict):
         if ed.can_download(info_dict):
             return ed
             return ed
 
 
-    if protocol == 'm3u8' and params.get('hls_prefer_native'):
+    if protocol == 'm3u8' and params.get('hls_prefer_native') is True:
         return HlsFD
         return HlsFD
 
 
+    if protocol == 'm3u8_native' and params.get('hls_prefer_native') is False:
+        return FFmpegFD
+
     return PROTOCOL_MAP.get(protocol, HttpFD)
     return PROTOCOL_MAP.get(protocol, HttpFD)
 
 
 
 

+ 5 - 1
youtube_dl/options.py

@@ -425,8 +425,12 @@ def parseOpts(overrideArguments=None):
         help='Set file xattribute ytdl.filesize with expected filesize (experimental)')
         help='Set file xattribute ytdl.filesize with expected filesize (experimental)')
     downloader.add_option(
     downloader.add_option(
         '--hls-prefer-native',
         '--hls-prefer-native',
-        dest='hls_prefer_native', action='store_true',
+        dest='hls_prefer_native', action='store_true', default=None,
         help='Use the native HLS downloader instead of ffmpeg')
         help='Use the native HLS downloader instead of ffmpeg')
+    downloader.add_option(
+        '--hls-prefer-ffmpeg',
+        dest='hls_prefer_native', action='store_false', default=None,
+        help='Use ffmpeg instead of the native HLS downloader')
     downloader.add_option(
     downloader.add_option(
         '--hls-use-mpegts',
         '--hls-use-mpegts',
         dest='hls_use_mpegts', action='store_true',
         dest='hls_use_mpegts', action='store_true',