Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video starts playing late #1097

Closed
davidupx opened this issue Apr 9, 2017 · 13 comments
Closed

Video starts playing late #1097

davidupx opened this issue Apr 9, 2017 · 13 comments
Labels

Comments

@davidupx
Copy link

davidupx commented Apr 9, 2017

What version of WebTorrent?
v0.98.16
What operating system and Node.js version?
CentOS 6.8 - node 6.10
What browser and version? (if using WebTorrent in the browser)
Chrome 57 - Firefox 52
What did you expect to happen?
Video starts playing as soon as first frame is downloaded
What actually happened?
The video size is 500MB, 2 webseeds are being used and are fetched from torrent file (urlList parameter), the chunk size is 512KB.
The video starts playing after downloading about 15MB which is kind of late compared to classic streaming.
Where should I be looking in order to make the video start playing sooner?

@DiegoRBaquero
Copy link
Member

Which file format is the video?

@davidupx
Copy link
Author

MP4 for sure

@DiegoRBaquero
Copy link
Member

MP4 videos are handled by this library: https://github.com/jhiesey/videostream

@jhiesey has 100x my experience in the subject, he might be able to help with this issue.

@yciabaud
Copy link
Contributor

Mp4 is good but you need to encode the video with some flags at the begining in order to be able to stream it.

Try a basic player with a webseed to see if it is webtorrent related.

The flags are called moov if you need reference.

@davidupx
Copy link
Author

@yciabaud We tried the -movflags faststart ffmpeg option but no luck, their is still the same delay before the player starts the video.
Any more idea about it?
Thanks

@yciabaud
Copy link
Contributor

Can you provide the torrent with the webseeds in order to have a look?

@davidupx
Copy link
Author

http://179.43.145.194/sintel.html
As you can see, the video starts playing only after downloading about >10MB,
knowing that for users who have a medium-speed connection, 10MB means a few minutes of patience to see the first frame...

@DiegoRBaquero
Copy link
Member

DiegoRBaquero commented Apr 13, 2017 via email

@feross
Copy link
Member

feross commented Apr 13, 2017

Loads for me at 7MB.

Multiple pieces are being downloaded concurrently but a piece can't be used until it's completely downloaded, so some of those extra MBs are probably devoted to future pieces that aren't needed to play the first frame. But if there are enough peers available in the network, we'll try to connect and get data from them anyway. Maybe this can be improved but then we'd need to have an idea of how much bandwidth is available to the client... This all sounds really hard and I haven't taken a close look at the download strategy code in a long time.

I'm -1 on changing anything to address this.

@feross feross closed this as completed Apr 13, 2017
@jhiesey
Copy link
Contributor

jhiesey commented Apr 14, 2017

I'm a bit late to this issue, but I'll take a look this weekend to see if there's anything that can be improved on the videostream side.

@yciabaud @davidupx I'm not surprised the faststart option doesn't make much difference. In either case videostream will request the beginning of the file first and then almost immediately seek to the correct moov offset (either still near the beginning with the option passed or near the end without it). Webtorrent needs to download different torrent pieces but not much else changes.

In contrast, with http the GET request would have to be cancelled if there's a need to seek to the end, which would usually require killing the connection. In other words, webtorrent doesn't have nearly as much overhead when seeking as http does.

@davidupx
Copy link
Author

@jhiesey Thanks for your reply, I hope you can improve the situation.
I look forward to hearing from you, if there is a solution or suggestions.

@jhiesey
Copy link
Contributor

jhiesey commented Apr 17, 2017

Alright, didn't get to it this weekend. Hopefully early this week.

@lock
Copy link

lock bot commented May 3, 2018

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators May 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants