[downloader] Add --hls-prefer-native to use the native HLS downloader (#4966)
authorPhilipp Hagemeister <phihag@phihag.de>
Tue, 17 Feb 2015 11:09:12 +0000 (12:09 +0100)
committerPhilipp Hagemeister <phihag@phihag.de>
Tue, 17 Feb 2015 11:09:12 +0000 (12:09 +0100)
youtube_dl/YoutubeDL.py
youtube_dl/__init__.py
youtube_dl/downloader/__init__.py
youtube_dl/options.py

index dbb26272dc48e5b192ac4ad135ae97c4821cc0b7..ea2435e0a2ab250460b12a27f91519b3272a59f0 100755 (executable)
@@ -225,7 +225,6 @@ class YoutubeDL(object):
     call_home:         Boolean, true iff we are allowed to contact the
                        youtube-dl servers for debugging.
     sleep_interval:    Number of seconds to sleep before each download.
-    external_downloader:  Executable of the external downloader to call.
     listformats:       Print an overview of available video formats and exit.
     list_thumbnails:   Print a table of all thumbnails and exit.
     match_filter:      A function that gets called with the info_dict of
@@ -235,6 +234,10 @@ class YoutubeDL(object):
                        match_filter_func in utils.py is one example for this.
     no_color:          Do not emit color codes in output.
 
+    The following options determine which downloader is picked:
+    external_downloader: Executable of the external downloader to call.
+                       None or unset for standard (built-in) downloader.
+    hls_prefer_native: Use the native HLS downloader instead of ffmpeg/avconv.
 
     The following parameters are not used by YoutubeDL itself, they are used by
     the FileDownloader:
index 108fb3c7a21b9d92b88e19aeef3d712b5835e90c..eac2a26ec838873e7fe3e99483945a3115e83c33 100644 (file)
@@ -351,6 +351,7 @@ def _real_main(argv=None):
         'match_filter': match_filter,
         'no_color': opts.no_color,
         'ffmpeg_location': opts.ffmpeg_location,
+        'hls_prefer_native': opts.hls_prefer_native,
     }
 
     with YoutubeDL(ydl_opts) as ydl:
index eff1122c5c09eff494ad34af835b06e33c9e4751..9fb66e2f7f680a71c05fdd866c72b0db2dd91a77 100644 (file)
@@ -34,6 +34,9 @@ def get_suitable_downloader(info_dict, params={}):
         if ed.supports(info_dict):
             return ed
 
+    if protocol == 'm3u8' and params.get('hls_prefer_native'):
+        return NativeHlsFD
+
     return PROTOCOL_MAP.get(protocol, HttpFD)
 
 
index ba35399cff8528bd7ef8747f1b4f21394a168f95..5f678f76b9561bf374693d29aa6e4c92406e08a2 100644 (file)
@@ -424,6 +424,10 @@ def parseOpts(overrideArguments=None):
         '--xattr-set-filesize',
         dest='xattr_set_filesize', action='store_true',
         help='(experimental) set file xattribute ytdl.filesize with expected filesize')
+    downloader.add_option(
+        '--hls-prefer-native',
+        dest='hls_prefer_native', action='store_true',
+        help='(experimental) Use the native HLS downloader instead of ffmpeg.')
     downloader.add_option(
         '--external-downloader',
         dest='external_downloader', metavar='COMMAND',