Streaming stops
The issue I'm having shows up if I pause the stream for awhile and then come back to it later. It also only seems to occur with really long streams. The first 150MiB of the stream will be cached and then it'll stop. After reaching and passing 150Mib, nothing else gets cached. The cache doesn't start to refill. It just gets stuck at that point. I can go backwards or forwards, but nothing will play.
- Pass url to mpv
- allow stream to load and reach limit
- pause and wait awhile
- resume stream later and (maybe?) skip far ahead enough to almost get to the end of what's been cached of the stream.
Result : → cache stops refilling and the stream stops.
Really long streams : https://www.youtube.com/watch?v=87SfA1sw7vY https://youtu.be/7V-fIGMDsmE
mpv version :
Name : mpv-git
Version : 0.41378.c4757ad-1
Build Date : Thu 28 May 2015 11:58:46 PM EDT
Install Date : Thu 28 May 2015 11:58:55 PM EDT
youtube-dl version :
Name : youtube-dl
Version : 2015.05.20-1
Build Date : Wed 27 May 2015 11:36:30 PM EDT
Install Date : Thu 28 May 2015 03:29:05 PM EDT
mpv.conf :
screenshot-template="~/Pictures/%F_%wh:%wM:%wS:%wT"
#input-file=~/links
vo=vdpau
geometry=50%:50%
no-window-dragging
hwdec=auto
script-opts=osc-layout=bottombar
mpv -v :
[cplayer] Command line options: '-v'
[cplayer] mpv git-c4757ad (C) 2000-2015 mpv/MPlayer/mplayer2 projects
[cplayer] built on 2015-05-29T03:58:00
[cplayer] ffmpeg library versions:
[cplayer] libavutil 54.20.100
[cplayer] libavcodec 56.26.100
[cplayer] libavformat 56.25.101
[cplayer] libswscale 3.1.101
[cplayer] libavfilter 5.11.102
[cplayer] libswresample 1.1.100
[cplayer]
[cplayer] Configuration: ./waf configure --prefix=/usr --confdir=/etc/mpv --enable-zsh-comp
[cplayer] List of enabled features: alsa asm atomics audio-input avcodec-chroma-pos-api avframe-metadata avframe-skip-samples build-date caca cdda cplayer debug-build dlopen drm dvbin dvdnav dvdread enca encoding fchmod gl gl-wayland gl-x11 glibc-thread-name glob iconv jack jpeg ladspa lcms2 libass libass-osd libav libavdevice libavfilter libbluray libdl libguess libm librt libsmbclient libswresample libv4l2 linux-fstatfs lua nanosleep optimize oss-audio oss-audio-native posix posix-or-mingw posix-spawn pthreads pulse pvr resampler shm stdatomic subprocess termios tv tv-v4l2 vaapi vaapi-glx vaapi-hwaccel vaapi-vpp vdpau vdpau-gl-x11 vdpau-hwaccel videodev vt.h wayland x11 xext xinerama xrandr xss xv zlib zsh-comp
[global] config path: '' -> '/home/yomi/.config/mpv'
[global] config path: 'mpv.conf' -> '/home/yomi/.config/mpv/mpv.conf'
[global] config path: 'config' -/-> '/home/yomi/.config/mpv/config'
[global] config path: 'mpv.conf' -/-> '/home/yomi/.mpv/mpv.conf'
[global] config path: 'config' -/-> '/home/yomi/.mpv/config'
[global] config path: 'mpv.conf' -/-> '/etc/mpv/mpv.conf'
[global] config path: 'config' -/-> '/etc/mpv/config'
[cplayer] Reading config file /home/yomi/.config/mpv/mpv.conf
[cplayer] Setting option 'screenshot-template' = '~/Pictures/%F_%wh:%wM:%wS:%wT' (flags = 4)
[cplayer] Setting option 'vo' = 'vdpau' (flags = 4)
[cplayer] Setting option 'geometry' = '50%:50%' (flags = 4)
[cplayer] Setting option 'no-window-dragging' = '' (flags = 4)
[cplayer] Setting option 'hwdec' = 'auto' (flags = 4)
[cplayer] Setting option 'script-opts' = 'osc-layout=bottombar' (flags = 4)
[cplayer] Setting option 'v' = '' (flags = 8)
I believe you'll find this happens with pretty much any youtube video, and is far more evident if you reduce your cache size. Based on my observations, I think the problem is due to youtube closing the connection and expiring the token used to connect to it in the first place if the connection is idle for too long. In the console, I'd expect to see several messages about the cache not responding and failure to reconnect to the stream.
Assuming this is the behavior you're seeing, I think the cause of the problem is that once ffmpeg is disconnected from the stream, it tries to handle the reconnection, and all it knows is the (now expired) stream token. In order for mpv to recover from this, it would need to renegotiate for a new stream with the original url and youtube-dl.
How long does it take between cache being full, and cache shrinking below 50%?
I suspect this happens because the player will play 75MB of data until it starts reading from the network again (because half of the cache is reserved for seeking back, and at the start of the screen you obviously can't seek back, so the full cache is used).
One lame solution: always restrict the cache to 50% readahead, even if more could be used.
Implemented the lame solution. I hope this solves it.
Implemented the lame solution. I hope this solves it.
Yes, it does. Thanks. The only thing I have to do to remember not to leave it paused for too long.