ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
132.22k stars 10.03k forks source link

Only --hls-prefer-ffmpeg works on twitch? #13833

Closed weedy closed 7 years ago

weedy commented 7 years ago

Is this just a funny video or has twitch changed things? I'm trying to download https://www.twitch.tv/moonmoon_ow/videos/past-broadcasts

[twitch:videos:past-broadcasts] moonmoon_ow: Downloading channel info JSON
[twitch:videos:past-broadcasts] moonmoon_ow: Downloading past broadcasts JSON page 1
[download] Downloading playlist: MOONMOON_OW
[twitch:videos:past-broadcasts] playlist MOONMOON_OW: Collected 80 video ids (downloading 80 of them)
[download] Downloading video 1 of 80
[twitch:vod] 84118476: Downloading vod info JSON
[twitch:vod] 84118476: Downloading vod access token
[twitch:vod] 84118476: Downloading m3u8 information
WARNING: en subtitles not available for v84118476
[debug] Default format spec: bestvideo+bestaudio/best
[download] Sponsored by: Chat has already been recorded in archive
[download] Downloading video 2 of 80
[twitch:vod] 150068702: Downloading vod info JSON
[twitch:vod] 150068702: Downloading vod access token
[twitch:vod] 150068702: Downloading m3u8 information
WARNING: en subtitles not available for v150068702
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on u'https://vod033-ttvnw.akamaized.net/aa1d8ccb3edf031e78db_moonmoon_ow_25452536400_659454017/chunked/index-muted-YPTY2OV1XM.m3u8'
[download] Sleeping 3 seconds...
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 1927
[download] Destination: 20170607-v150068702-TUNESDAY_BABY_mediashare_howdoesmediasharework_Darkest_Dungeon_at_1_AM~_EST.mp4
Traceback (most recent call last):
  File "/usr/lib/python-exec/python2.7/youtube-dl", line 11, in <module>
    load_entry_point('youtube-dl==2017.7.23', 'console_scripts', 'youtube-dl')()
  File "/usr/lib/python2.7/site-packages/youtube_dl/__init__.py", line 465, in main
    _real_main(argv)
  File "/usr/lib/python2.7/site-packages/youtube_dl/__init__.py", line 455, in _real_main
    retcode = ydl.download(all_urls)
  File "/usr/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 1956, in download
    url, force_generic_extractor=self.params.get('force_generic_extractor', False))
  File "/usr/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 787, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 978, in process_ie_result
    extra_info=extra)
  File "/usr/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 848, in process_ie_result
    extra_info=extra_info)
  File "/usr/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 787, in extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/usr/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 841, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/usr/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 1599, in process_video_result
    self.process_info(new_info)
  File "/usr/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 1863, in process_info
    success = dl(filename, info_dict)
  File "/usr/lib/python2.7/site-packages/youtube_dl/YoutubeDL.py", line 1805, in dl
    return fd.download(name, info)
  File "/usr/lib/python2.7/site-packages/youtube_dl/downloader/common.py", line 361, in download
    return self.real_download(filename, info_dict)
  File "/usr/lib/python2.7/site-packages/youtube_dl/downloader/hls.py", line 89, in real_download
    self._prepare_and_start_frag_download(ctx)
  File "/usr/lib/python2.7/site-packages/youtube_dl/downloader/fragment.py", line 69, in _prepare_and_start_frag_download
    self._prepare_frag_download(ctx)
  File "/usr/lib/python2.7/site-packages/youtube_dl/downloader/fragment.py", line 153, in _prepare_frag_download
    self._read_ytdl_file(ctx)
  File "/usr/lib/python2.7/site-packages/youtube_dl/downloader/fragment.py", line 78, in _read_ytdl_file
    ctx['fragment_index'] = json.loads(stream.read())['downloader']['current_fragment']['index']
  File "/usr/lib/python2.7/json/__init__.py", line 339, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 364, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 382, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

vs. --hls-prefer-ffmpeg

[twitch:videos:past-broadcasts] moonmoon_ow: Downloading channel info JSON
[twitch:videos:past-broadcasts] moonmoon_ow: Downloading past broadcasts JSON page 1
[download] Downloading playlist: MOONMOON_OW
[twitch:videos:past-broadcasts] playlist MOONMOON_OW: Collected 80 video ids (downloading 80 of them)
[download] Downloading video 1 of 80
[twitch:vod] 84118476: Downloading vod info JSON
[twitch:vod] 84118476: Downloading vod access token
[twitch:vod] 84118476: Downloading m3u8 information
WARNING: en subtitles not available for v84118476
[debug] Default format spec: bestvideo+bestaudio/best
[download] Sponsored by: Chat has already been recorded in archive
[download] Downloading video 2 of 80
[twitch:vod] 150068702: Downloading vod info JSON
[twitch:vod] 150068702: Downloading vod access token
[twitch:vod] 150068702: Downloading m3u8 information
WARNING: en subtitles not available for v150068702
[debug] Default format spec: bestvideo+bestaudio/best
[debug] Invoking downloader on u'https://vod033-ttvnw.akamaized.net/aa1d8ccb3edf031e78db_moonmoon_ow_25452536400_659454017/chunked/index-muted-YPTY2OV1XM.m3u8'
[download] Sleeping 3 seconds...
[download] Destination: 20170607-v150068702-TUNESDAY_BABY_mediashare_howdoesmediasharework_Darkest_Dungeon_at_1_AM~_EST.mp4
[debug] ffmpeg command line: ffmpeg -y -loglevel verbose -headers 'Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/47.0 (Chrome)
' -i 'https://vod033-ttvnw.akamaized.net/aa1d8ccb3edf031e78db_moonmoon_ow_25452536400_659454017/chunked/index-muted-YPTY2OV1XM.m3u8' -c copy -f mp4 'file:20170607-v150068702-TUNESDAY_BABY_mediashare_howdoesmediasharework_Darkest_Dungeon_at_1_AM~_EST.mp4.part'
ffmpeg version 3.3.3 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 4.6.4 (Gentoo 4.6.4 p1.0, pie-0.5.2)
  configuration: --prefix=/usr --libdir=/usr/lib --shlibdir=/usr/lib --docdir=/usr/share/doc/ffmpeg-3.3.3/html --mandir=/usr/share/man --enable-shared --cc=i686-pc-linux-gnu-gcc --cxx=i686-pc-linux-gnu-g++ --ar=i686-pc-linux-gnu-ar --optflags='-O2 -march=native -pipe -fomit-frame-pointer -fgcse-after-reload -fgcse-lm -fgcse-sm -fvect-cost-model -ftree-vectorize -ftracer -fivopts -fmodulo-sched -fpredictive-commoning' --disable-static --enable-avfilter --enable-avresample --disable-stripping --disable-indev=v4l2 --disable-outdev=v4l2 --disable-indev=alsa --disable-indev=oss --disable-indev=jack --disable-outdev=alsa --disable-outdev=oss --disable-outdev=sdl --enable-version3 --enable-bzlib --disable-runtime-cpudetect --disable-debug --disable-gcrypt --enable-gnutls --enable-gmp --enable-gpl --enable-hardcoded-tables --enable-iconv --disable-lzma --enable-network --disable-openssl --enable-postproc --disable-libsmbclient --disable-ffplay --disable-sdl2 --disable-vaapi --disable-vdpau --disable-xlib --disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --enable-zlib --disable-libcdio --disable-libiec61883 --disable-libdc1394 --disable-libcaca --disable-openal --disable-opengl --disable-libv4l2 --disable-libpulse --disable-libopencore-amrwb --disable-libopencore-amrnb --disable-libfdk-aac --enable-libopenjpeg --disable-libbluray --disable-libcelt --disable-libgme --disable-libgsm --disable-mmal --disable-libmodplug --disable-libopus --disable-libilbc --disable-librtmp --disable-libssh --disable-libschroedinger --disable-libspeex --enable-libvorbis --disable-libvpx --disable-libzvbi --disable-libbs2b --disable-chromaprint --disable-libflite --disable-frei0r --disable-libfribidi --disable-fontconfig --disable-ladspa --disable-libass --enable-libfreetype --disable-librubberband --disable-netcdf --disable-libzmq --disable-libzimg --disable-libsoxr --enable-pthreads --disable-libvo-amrwbenc --disable-libmp3lame --disable-libkvazaar --disable-nvenc --disable-libopenh264 --disable-libsnappy --disable-libtheora --disable-libtwolame --disable-libwavpack --disable-libwebp --disable-libx264 --disable-libx265 --disable-libxvid --disable-amd3dnow --disable-amd3dnowext --disable-aesni --disable-avx --disable-avx2 --disable-fma3 --disable-fma4 --disable-ssse3 --disable-sse4 --disable-sse42 --disable-xop --cpu=host --disable-doc --disable-htmlpages --enable-manpages
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libavresample   3.  5.  0 /  3.  5.  0
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
[hls,applehttp @ 0x8cb6690] HLS request for url 'https://vod033-ttvnw.akamaized.net/aa1d8ccb3edf031e78db_moonmoon_ow_25452536400_659454017/chunked/0.ts', offset 0, playlist 0
[hls,applehttp @ 0x8cb6690] Opening 'https://vod033-ttvnw.akamaized.net/aa1d8ccb3edf031e78db_moonmoon_ow_25452536400_659454017/chunked/0.ts' for reading
[mpegts @ 0x908fbc0] parser not found for codec timed_id3, packets or times may be invalid.
[h264 @ 0x9095990] Reinit context to 1600x912, pix_fmt: yuvj420p
Input #0, hls,applehttp, from 'https://vod033-ttvnw.akamaized.net/aa1d8ccb3edf031e78db_moonmoon_ow_25452536400_659454017/chunked/index-muted-YPTY2OV1XM.m3u8':
  Duration: 05:23:26.62, start: 68.335011, bitrate: 0 kb/s
  Program 0 
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 44100 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
    Stream #0:1: Video: h264 (High), 1 reference frame ([27][0][0][0] / 0x001B), yuvj420p(pc, left), 1600x900 (1600x912), 60 tbr, 90k tbn, 120 tbc
    Metadata:
      variant_bitrate : 0
    Stream #0:2: Data: timed_id3 (ID3  / 0x20334449)
    Metadata:
      variant_bitrate : 0
Output #0, mp4, to 'file:20170607-v150068702-TUNESDAY_BABY_mediashare_howdoesmediasharework_Darkest_Dungeon_at_1_AM~_EST.mp4.part':
  Metadata:
    encoder         : Lavf57.71.100
    Stream #0:0: Video: h264 (High), 1 reference frame ([33][0][0][0] / 0x0021), yuvj420p(pc, left), 1600x900 (0x0), q=2-31, 60 tbr, 90k tbn, 90k tbc
    Metadata:
      variant_bitrate : 0
    Stream #0:1: Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, stereo, fltp
    Metadata:
      variant_bitrate : 0
Stream mapping:
  Stream #0:1 -> #0:0 (copy)
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
Automatically inserted bitstream filter 'aac_adtstoasc'; args=''
[hls,applehttp @ 0x8cb6690] HLS request for url 'https://vod033-ttvnw.akamaized.net/aa1d8ccb3edf031e78db_moonmoon_ow_25452536400_659454017/chunked/1.ts', offset 0, playlist 0
[hls,applehttp @ 0x8cb6690] Opening 'https://vod033-ttvnw.akamaized.net/aa1d8ccb3edf031e78db_moonmoon_ow_25452536400_659454017/chunked/1.ts' for reading

ffmpeg can't resume right? I hope it's just this specific video...

dstftw commented 7 years ago
  1. Do not touch *.ytdl file for hlsnative to work.
  2. ffmpeg can't resume.
weedy commented 7 years ago

I've never touched .ytdl. My script calls youtube-dl in a while loop looking for a 0 exit code. Could one invocation have crashed out due to something and left .ytdl in a broken state?

dstftw commented 7 years ago

Unlikely.