Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upWebtorrent scaling, streaming #145
Comments
This comment has been minimized.
This comment has been minimized.
|
Thanks for opening this issue and asking such excellent questions.
|
This comment has been minimized.
This comment has been minimized.
|
@feross |
This comment has been minimized.
This comment has been minimized.
|
The webtorrent tracker is basically a webrtc signaling server. You can read about webrtc signaling here: http://www.html5rocks.com/en/tutorials/webrtc/basics/#toc-signaling or you can watch me talk about it here at LXJS: https://www.youtube.com/watch?v=QpQhR9fBNnk#t=18m45s Writing up a spec is on my todo list. |
This comment has been minimized.
This comment has been minimized.
|
can video sources using the mkv container playback on video tag because many of the higher quality torrents use this container they seem to be the preferred choice for the major uploaders |
This comment has been minimized.
This comment has been minimized.
|
As I understand it browsers do support webm and this seems to be a "sibling" of mkv. I have read something about it but I am not sure what the exact deal here. Is it the same with a different header or does it just only support VP8 as codec? http://www.matroska.org/news/webm-matroska.html http://www.webmproject.org/code/specs/container/ https://bugzilla.mozilla.org/show_bug.cgi?id=476727 Most mkv videos on bittorrent use h264. h264 support on firefox desktop is "platfom dependant". For Ubuntu for example it is not supported by default but you can enable it http://askubuntu.com/a/389439/195243 There is also the fact that firefox 33 supports a OpenH264-Videocodec plugin for webRTC videochat now but not normal embeded files. http://yro.slashdot.org/story/14/07/23/1312227/firefox-33-integrates-ciscos-openh264 So exited about this, sorry if this went a bit offtopic here. |
This comment has been minimized.
This comment has been minimized.
|
I see. I supose It needs introduction mostly because of safety measures, as doing it other way would be unsafe like allowing browser to open and listen on sockets. Design of introduction is very similar to FXP in FTP protocol. Currently video tag doesn't support mkv containers. It's not about codecs, it's about structure of file formats. Current design will not parse mkv containers properly. mkv allows multiple video and audio streams while mp4 doesn't allow that. |
This comment has been minimized.
This comment has been minimized.
|
@klonodo vlc summer projects mentions about a rewrite for the vlc media plugin to ppapi but i dnt think there is any progress also i realize this does not concern webtorrent so much but since one of the goals for this project is to facilitate streaming this should be of some importance but like klonodo said only way to parse mkv will be through third party extension because browser won't really feel the need to do so support mkv parsing |
This comment has been minimized.
This comment has been minimized.
|
Okay, a basic version of streaming into a video tag is implemented now. Here's how to do it: var WebTorrent = require('webtorrent')
var client = new WebTorrent()
client.download(magnet_uri, function (torrent) {
// Got torrent metadata!
console.log('Torrent info hash:', torrent.infoHash)
// Let's say the first file is a webm (vp8) or mp4 (h264) video...
var file = torrent.files[0]
// Create a video element
var video = document.createElement('video')
video.controls = true
document.body.appendChild(video)
// Stream the video into the video tag
file.createReadStream().pipe(video)
}) |
This comment has been minimized.
This comment has been minimized.
|
Currently, this is making very specific assumptions about the codecs. If the extension is Obviously, this might not be correct for many files. We need a good way to discover what the type is on-the-fly. If you're looking for some files which have said codecs, test with these: I figured out what values to use with MP4Box, but we need something written in JS that can figure out the type using just the first bit of the video file, so that streaming will continue to work. |
This comment has been minimized.
This comment has been minimized.
|
To test this out, make sure you're using webtorrent 0.10.0. |
This comment has been minimized.
This comment has been minimized.
|
Support added in a0d3ba2 |
This comment has been minimized.
This comment has been minimized.
|
here are test files of most containers and format from the yify team |
This comment has been minimized.
This comment has been minimized.
|
and it appears there is a modified webkit used by popcorn time that can parse the mkv container |
This comment has been minimized.
This comment has been minimized.
|
I've heard mkv and webm are very close in structure. Have you tried to play a mkv forcing a webm content-type ? (with the right audio and video codecs inside of course) |
This comment has been minimized.
This comment has been minimized.
|
Video streaming arbitrary MP4s into the videostream isn't built into WebTorrent directly yet, so you can't just use the @klonodo's original issue is now resolved, so I'm closing this. |
You wrote that " * This is necessary to facilitate the WebRTC signaling (peer introduction) process."
Can we offload peer introduction to clients making ajax calls instead of using websockets?