m13253 / BiliDan

Play videos on Bilibili.com with MPV and Danmaku2ASS
http://m13253.blogspot.com/2014/06/watch-bilibili-with-biligrab-danmaku2ass.html
Other
513 stars 69 forks source link

Is it possible to add a '--no-merge-files' option? #47

Closed guopm closed 8 years ago

guopm commented 8 years ago

Option --merge-files in mpv makes that all files in the playlist are concatenated into a single, big file. BiliDan enables it by default so that for users it looks like just a long video, with no split. And that's what I'm embarrassed. I'm a college student and get a limited network bandwidth. That's to say, I am able to watch videos in bilibili.com IMMEDIATELLY only when I spend all my bandwidth. However, with --merge-files, mpv player always tries fetching videos parallelly, which means I have to wait for a long long time before it's ready. Then I remove that option in the script, and it just works like I watch the viedo in web browser. So is it possible to add a '--no-merge-files' option? Although the strange duration would amaze users, I think time is more precious in a way. Thanks! A URL for test:http://www.bilibili.com/video/av431146/

m13253 commented 8 years ago

Then the danmaku will not synchronize with the video, unless you can manage to solve this problem.

I knew the parallel download problem, it is lucky that it only happens on old videos (pre 2014). But I am sorry that I could not figure out a way to bypass this technical restriction.

If you have any idea, and know the way to implement it, feel free to tell me. Anyway, you may try your plan in a separate fork, see if it works well, then merge back into the mainstream.

m13253 commented 8 years ago

I knew a solution, the M3U with HLS extension trick. But I could not get it working.

guopm commented 8 years ago

It will be the best if mpv provides sequential download natively... Let me raise an issue and pray.

cnbeining commented 8 years ago

How about we just play individual videos while doing time-shift on danmaku file each time?

m13253 commented 8 years ago

How about we just play individual videos while doing time-shift on danmaku file each time?

I have once seen such an implementation Bilibili-XBMC. When I used that project, I found the gap between segments is annoying as well. I definitely consider that not a graceful solution. (But it is a possible solution to have a try.)

I think we'd better wait for an answer from MPV's side (about whether to fix MPV or throw the issue at our side). After all, I can implement an extra layer of HTTP proxy to shape the extra download connections, possibly by force abort the first download attempt.

Goshin commented 8 years ago

I've met this problem few months ago, and I found controlling the buffer size would be helpful.

Just specify the --cache, --cache-backbuffer, --cache-secs options in the command line for Mpv. It will restrain the buffering of the not playing segments when limited buffer filled in. Refer to https://github.com/Goshin/Yatto/blob/master/src/yatto.py#L144,L145 Official manual: https://mpv.io/manual/stable/

Note that the Mpv needs to fetch the video header of every segment to tell or estimate the playback duration, so the short wait in the beginning is necessary.

m13253 commented 8 years ago

I've met this problem few months ago, and I found controlling the buffer size would be helpful.

Thanks for your solution!