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

mp4 Restreaming Via HTTP #354

Closed
Zensin opened this issue Jun 12, 2015 · 4 comments
Closed

mp4 Restreaming Via HTTP #354

Zensin opened this issue Jun 12, 2015 · 4 comments

Comments

@Zensin
Copy link

@Zensin Zensin commented Jun 12, 2015

Is it possible to serve the incoming video torrent stream as mp4 over HTTP by serving up a an mp4 URL over the local network? This is for a special player that can only handle HTTP mp4 streams. Does webtorrent make sure it downloads the meta first? Also, does it do any transcoding to mp4 from other formats? Here is what my playback device setup looks like and what I'm trying to do:

     (torrent)
         |
       (NAT)
         |
   (Client Machine)
         |
    (webtorrent)
         |
 (Node HTTP Server MP4) --------> (MP4 HTTP Streaming/Playback Device on LAN)

webtorrent and HTTP server both running on client machine. MP4 stream playback on other LAN device.

@rom1504

This comment has been minimized.

Copy link
Member

@rom1504 rom1504 commented Jun 12, 2015

Well if you start webtorrent in the CLI it does exactly that, try it ;-)

Le ven. 12 juin 2015 10:06, Synthetisoft notifications@github.com a
écrit :

Is it possible to serve the incoming video torrent stream as mp4 over HTTP
by serving up a an mp4 URL over the local network? This is for a special
player that can only handle HTTP mp4 streams. Does webtorrent make sure it
downloads the meta first? Also, does it do any transcoding to mp4 from
other formats? Here is what my playback device setup looks like and what
I'm trying to do:

 (torrent)
     |
   (NAT)
     |

(Client Machine)
|
(webtorrent)
|
(Node HTTP Server MP4) --------> (MP4 HTTP Streaming/Playback Device on LAN)


Reply to this email directly or view it on GitHub
#354.

@Zensin

This comment has been minimized.

Copy link
Author

@Zensin Zensin commented Jun 12, 2015

What about transcoding? Does it always output mp4? And is the meta data downloaded first and placed at the beginning of the mp4?

@ericwooley

This comment has been minimized.

Copy link
Contributor

@ericwooley ericwooley commented Jun 12, 2015

You can play it in the browser as it starts downloading, so I would think you could find a way to do it with a http server in between. I would say try it! See if it works, and let us know. I have found https://github.com/gpac/mp4box.js to be pretty useful in getting the metada for an mp4 out of the files downloaded with webtorrent, in the browser. You could use the mp4box.onReady method server side to notify you when the metadata is ready, then start serving it.

Alternatively, as a quick test, why not setup plex, and set the download directory to a folder plex is watching, and see if you can watch before it's all the way downloaded. It might not work, but it might and if it does, you know for sure that it's possible

@feross

This comment has been minimized.

Copy link
Member

@feross feross commented Jun 24, 2015

@Synthetisoft This is a cool idea, but I'm not interested in adding a transcoder into WebTorrent, unless there's a module that already does this and it works perfectly. It sounds like a ton of work, dealing with the flakiness of ffmpeg, and a ton of additional code we'd have to maintain.

There's nothing stopping you from implementing this yourself, without any modifications to WebTorrent. Just feed the video stream data from file.createReadStream() into ffmpeg (or whatever transcoder you want) and then expose an http server for your video player. You can see how the webtorrent command line http server works here. It's not too much code.

Does webtorrent make sure it downloads the meta first?

If you use the built-in server, which is what the webtorrent command line uses, then whatever pieces the video player requests will be fetched first from the torrent network. If you're transcoding the video on the fly, I think you'll probably have to sequentially process the video -- but maybe you can hack it somehow.

Btw, over on https://instant.io we do MP4 repackaging, which is different from transcoding. We take arbitrary MP4s and make them work with the MediaSource API, so they can be streamed into the <video> tag. That uses the videostream module. This is similar, but different than what you're trying to do. Just wanted to clarify for posterity, in case others find this issue.

@feross feross closed this Jun 24, 2015
@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.