Mpv: Twitch issue

Created on 3 Dec 2017  路  13Comments  路  Source: mpv-player/mpv

mpv version and platform

mpv 0.27.0-407-gcd6f964b56-dirty (shinchiro)
built on Sun Nov 19 10:44:29 UTC 2017
ffmpeg library versions:
libavutil 56.0.100
libavcodec 58.4.103
libavformat 58.2.100
libswscale 5.0.101
libavfilter 7.1.100
libswresample 3.0.101
ffmpeg version: git-2017-11-18-936a4c04b
Windows 7 SP1 x64

Reproduction steps

mpv https://www.twitch.tv/videos/205742060

Sometimes stream is played, sometimes does not

Playing: https://www.twitch.tv/videos/205742060
[cplayer] Running hook: ytdl_hook/on_load
[global] config path: 'youtube-dl' -/-> 'C:\Users\denis\AppData\Roaming/mpv/youtube-dl'
[global] config path: 'youtube-dl' -/-> 'D:/Program Files/MPV/youtube-dl'
[global] config path: 'youtube-dl' -/-> 'D:/Program Files/MPV/mpv/youtube-dl'
[ytdl_hook] youtube-dl succeeded!
[cplayer] Set property: file-local-options/user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/47.0 (Chrome)" -
> 1
[cplayer] Set property: stream-open-filename="https://fastly.vod.hls.ttvnw.net/50ddcfa4de8ea19c929c_quakechampions_26865506048_74776429
9/chunked/index-dvr.m3u8" -> 1
[cplayer] Set property: file-local-options/force-media-title="Day 1 - Quake Champions Invitational at DreamHack Winter 2017" -> 1
[ytdl_hook] adding subtitle [rechat]
[cplayer] Run command: sub-add, flags=0, args=[https://rechat.twitch.tv/rechat-messages?video_id=v205742060&start=1512116308, auto, jso
n, rechat]
[ffmpeg] Opening https://rechat.twitch.tv/rechat-messages?video_id=v205742060&start=1512116308
[ffmpeg] tcp: Failed to resolve hostname rechat.twitch.tv: No address associated with hostname
Failed to open https://rechat.twitch.tv/rechat-messages?video_id=v205742060&start=1512116308.
Can not open external file https://rechat.twitch.tv/rechat-messages?video_id=v205742060&start=1512116308.
[cplayer] Run command: hook-ack, flags=0, args=[on_load]
[ffmpeg] Opening https://fastly.vod.hls.ttvnw.net/50ddcfa4de8ea19c929c_quakechampions_26865506048_747764299/chunked/index-dvr.m3u8
[ffmpeg] tls: Creating security context failed (0x80090302)
Failed to open https://fastly.vod.hls.ttvnw.net/50ddcfa4de8ea19c929c_quakechampions_26865506048_747764299/chunked/index-dvr.m3u8.
[cplayer] Opening failed or was aborted: https://fastly.vod.hls.ttvnw.net/50ddcfa4de8ea19c929c_quakechampions_26865506048_747764299/chu
nked/index-dvr.m3u8
[cplayer] finished playback, loading failed (reason 4)

But mostly hanging after this step:

Playing: https://www.twitch.tv/videos/205742060
[cplayer] Running hook: ytdl_hook/on_load
[global] config path: 'youtube-dl' -/-> 'C:\Users\denis\AppData\Roaming/mpv/youtube-dl'
[global] config path: 'youtube-dl' -/-> 'D:/Program Files/MPV/youtube-dl'
[global] config path: 'youtube-dl' -/-> 'D:/Program Files/MPV/mpv/youtube-dl'
[ytdl_hook] youtube-dl succeeded!
[cplayer] Set property: file-local-options/user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/47.0 (Chrome)" -
> 1
[cplayer] Set property: stream-open-filename="https://vod034-ttvnw.akamaized.net/50ddcfa4de8ea19c929c_quakechampions_26865506048_747764
299/chunked/index-dvr.m3u8" -> 1
[cplayer] Set property: file-local-options/force-media-title="Day 1 - Quake Champions Invitational at DreamHack Winter 2017" -> 1
[ytdl_hook] adding subtitle [rechat]
[cplayer] Run command: sub-add, flags=0, args=[https://rechat.twitch.tv/rechat-messages?start=1512116308&video_id=v205742060, auto, jso
n, rechat]
[ffmpeg] Opening https://rechat.twitch.tv/rechat-messages?start=1512116308&video_id=v205742060
[ffmpeg] tcp: Failed to resolve hostname rechat.twitch.tv: No address associated with hostname
Failed to open https://rechat.twitch.tv/rechat-messages?start=1512116308&video_id=v205742060.
Can not open external file https://rechat.twitch.tv/rechat-messages?start=1512116308&video_id=v205742060.
[cplayer] Run command: hook-ack, flags=0, args=[on_load]
[ffmpeg] Opening https://vod034-ttvnw.akamaized.net/50ddcfa4de8ea19c929c_quakechampions_26865506048_747764299/chunked/index-dvr.m3u8
[ffmpeg] Mime-type: 'application/x-mpegURL'
[ffmpeg] Stream opened successfully.
[cache] Cache size set to 150000 KiB (75000 KiB backbuffer)
[demux] Trying demuxers for level=normal.
[lavf] Found 'hls,applehttp' at score=100 size=2048.

mpv.log

mpv.conf, input.conf

mpv.conf.log
input.conf.log

ytdl-hook

Most helpful comment

Because of library's size. Gnutls depends on libgcrypt+gcrypt-error. Openssl is a big fatty. Compared to these two, libressl is a bit smaller than Openssl and doesn't depend on another libs

All 13 comments

Sounds like something is wrong with TLS.
Which TLS library do shinchiro's builds use?

It's using schannel. Found out the hang happened because of schannel as it works fine with libressl. Weird enough as it always works fine with schannel before.

@rend3r You can download my latest today's build, built with libressl, which fixed this issue

Noob question: Why not use GnuTLS or OpenSSL like in the build script for Linux?

Because of library's size. Gnutls depends on libgcrypt+gcrypt-error. Openssl is a big fatty. Compared to these two, libressl is a bit smaller than Openssl and doesn't depend on another libs

@shinchiro Ok, the issue is eliminated.

Another rare issue happens to me - twitch play is suddenly stopping after while. The only sign is empty cache.

(Paused) AV: 05:25:50 / 10:18:47 (52%) A-V: 0.000 Cache: 120s+101KB

And then cache goes to 0 sec and does not filling anymore until stream restart. I will provide more information with
--msg-level=all=error,ffmpeg=trace,demux=trace,cache=trace,lavf=trace,vd=trace,ad=trace,ytdl_hook=trace

Is the TCP socket still in a ESTABLISHED state when that happens?

@garoto I'm not sure and now after your post I start thinking that socket is closed due PPPoE session reconnection. I will check with currports if I could reproduce the hang.

This log is not for the issue I've already mensioned but related (or not) to it.
twitch.zip
Before this line
[ 91.951][v][ffmpeg/demuxer] hls,applehttp: HLS request for url 'https://fastly.vod.hls.ttvnw.net/50ddcfa4de8ea19c929c_quakechampions_26865506048_747764299/chunked/3031.ts', offset 0, playlist 0
I've just opened the stream, seeked over and paused it until cache filled to 120sec. After that, I've disconnected PPPoE connection and mpv tries got the chuncks until
[ 105.920][e][ffmpeg] tcp: Failed to resolve hostname fastly.vod.hls.ttvnw.net: No address associated with hostname
and gave up. At this moment cache filled for ~100 secs. I wait for 20 sec cache and bring PPPoE connection on. mpv spent this last 20 secs and closed the video window. The previous described issue does not lead to window closing - mpv hangs with last video frame until ctrl+C.

Ok, I reproduce https://github.com/mpv-player/mpv/issues/5172#issuecomment-349759337
Cutted log twitch2_trim.zip
symptoms:

  • empty cache
  • Video window is not closing. Playback is stoped.
  • Several (3 in my case) socket with CLOSE WAIT status.

Here I paused the video

[3166.934][v][cplayer] Run command: cycle, flags=9, args=[pause, (NULL)]
[3166.935][v][cplayer] Set property: pause -> 1

and then unpaused (after ~4 hour) but pausing for so long does not matter - sometimes stream is freazing after 5-7 min playback.

[12737.227][v][cplayer] Run command: cycle, flags=9, args=[pause, (NULL)]
[12737.227][v][cplayer] Set property: pause -> 1

Is this still an issue in mpv 0.28.0?

Is this still an issue in mpv 0.28.0?

Yes. With this build. Windows 7 x64.

[   2.249][i][cplayer] Playing: https://alarmwillsound.bandcamp.com/track/electric-counterpoint-i-fast
[   2.249][v][cplayer] Running hook: ytdl_hook/on_load
[   2.249][d][ytdl_hook] Running: youtube-dl --no-warnings -J --flat-playlist --sub-format ass/srt/best --no-playlist --format bestvideo+bestaudio/best --all-subs -- https://alarmwillsound.bandcamp.com/track/electric-counterpoint-i-fast
[   3.923][v][ytdl_hook] youtube-dl succeeded!
[   3.923][d][ytdl_hook] ytdl parsing took 1.674 seconds
[   3.923][d][ytdl_hook] No fragments to join into EDL
[   3.923][v][cplayer] Set property: file-local-options/user-agent="Mozilla/5.0 (X11; Linux x86_64; rv:10.0) Gecko/20150101 Firefox/47.0 (Chrome)" -> 1
[   3.923][d][ytdl_hook] streamurl: https://t4.bcbits.com/stream/31a9a1f4e3c504fe1953f0bd97599d5b/mp3-128/3635846294?p=0&ts=1516671634&t=e435d4bfcc831ed4ecf541966d1c0659c2bd1300&token=1516671634_d97073a7c06247e69d8543f4655c276ce0673b98
[   3.923][v][cplayer] Set property: stream-open-filename="https://t4.bcbits.com/stream/31a9a1f4e3c504fe1953f0bd97599d5b/mp3-128/3635846294?p=0&ts=1516671634&t=e435d4bfcc831ed4ecf541966d1c0659c2bd1300&token=1516671634_d97073a7c06247e69d8543f4655c276ce0673b$
[   3.924][v][cplayer] Set property: file-local-options/force-media-title="Jonny Greenwood - Electric Counterpoint: I. Fast" -> 1
[   3.924][d][ytdl_hook] script running time: 1.674 seconds
[   3.924][d][cplayer] Run command: hook-ack, flags=0, args=[on_load]
[   3.924][v][ffmpeg] Opening https://t4.bcbits.com/stream/31a9a1f4e3c504fe1953f0bd97599d5b/mp3-128/3635846294?p=0&ts=1516671634&t=e435d4bfcc831ed4ecf541966d1c0659c2bd1300&token=1516671634_d97073a7c06247e69d8543f4655c276ce0673b98
[   4.031][e][ffmpeg] tls: Creating security context failed (0x80090302)
[   4.033][e][stream] Failed to open https://t4.bcbits.com/stream/31a9a1f4e3c504fe1953f0bd97599d5b/mp3-128/3635846294?p=0&ts=1516671634&t=e435d4bfcc831ed4ecf541966d1c0659c2bd1300&token=1516671634_d97073a7c06247e69d8543f4655c276ce0673b98.
[   4.033][v][cplayer] Opening failed or was aborted: https://t4.bcbits.com/stream/31a9a1f4e3c504fe1953f0bd97599d5b/mp3-128/3635846294?p=0&ts=1516671634&t=e435d4bfcc831ed4ecf541966d1c0659c2bd1300&token=1516671634_d97073a7c06247e69d8543f4655c276ce0673b98
[   4.033][v][cplayer] finished playback, loading failed (reason 4)

full log

Note the above is with --no-tls-verify. It works with and with out --tls-verify on the 2017-12-29 shinchiro build from around the same time. Maybe @lachs0r should just ditch schannel.

I think we had this discussion before, and I believe his response was something along the lines of "rather fix any issues with SChannel first"..

Was this page helpful?
0 / 5 - 0 ratings