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

Non-torrent method? #5

Open
sonnyp opened this issue Sep 7, 2023 · 4 comments
Open

Non-torrent method? #5

sonnyp opened this issue Sep 7, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@sonnyp
Copy link

sonnyp commented Sep 7, 2023

This is seriously a cool app thanks!

I don't know if it's in scope for this project but a while ago I prototyped a similar app that

  1. lets the user pick any video file (see also Support steaming local files  #3)
  2. tries to open a port on the router using uPnP (and the other one which I forgot the name of)
  3. generate a http link to share via chat
  4. streams the video file over http

There are 2 major advantages

  • The receiver doesn't need to install an app, it can work from the browser
  • The ip address and content being watched isn't shared publicly

The main disadvantage is that not all routers support the protocols necessary. So perhaps it could be used as the primary method and the app would fallback to torrent?

@pojntfx
Copy link
Owner

pojntfx commented Sep 7, 2023

Def. a possibility. A few things that I'd note:

  1. Browser support for most video formats is lacking. No support for MKV etc., and for MP4 we'd require streaming-capable files (with the MOV atoms at different points of the file) unless we want to fully transfer them first. That would require us to do transcoding for most files - I tried this a while back (https://gist.github.com/pojntfx/e44dd6faac063444108420fa24912442), but its ... complicated, and very fragile.
  2. We might not have to go the UPnP route at all. We can just use WebRTC/STUN to do the P2P hole punching for us, and then stream the video over a DataChannel in the browser directly :) That's basically what https://github.com/pojntfx/weron does - I even have a demo in there where I run a L2 and L3 VPN over it, and its super easy to write your own protocol on it for streaming video, too. Or to just run one of the existing ones!

@pojntfx pojntfx self-assigned this Sep 7, 2023
@pojntfx pojntfx added the enhancement New feature or request label Sep 7, 2023
@pojntfx
Copy link
Owner

pojntfx commented Sep 7, 2023

So what I'm saying is - the "local file" method via WebRTC would not depend on Torrent in any way, would work in the browser (through the wasm/js Go target - see https://github.com/pojntfx/keygaen for an example of how we can use Go there), and would do the hole punching automatically for us without having to worry about security issues or browser/router compatibility ^^

@gedw99
Copy link

gedw99 commented Sep 8, 2023

Would ffmpeg transcoding be a good thing to add? So then non stream able videos can be converted.

it could be setup to run async so it’s likely to be ahead of the people watching.

https://github.com/AlexxIT/go2rtc Looks like a good framework to encapsulate the transcoding.

https://github.com/AlexxIT/go2rtc#source-webtorrent Plus other sources and sinks

@pojntfx
Copy link
Owner

pojntfx commented Sep 8, 2023

This could be interesting, but it leads to a few other issues (like for example having to vendor ffmpeg, its HA acceleration libraries since CPU-bound won't be fast enough etc.). See #5 (comment) for a few approaches I already tried for this with GStreamer instead of ffmpeg - even with VA-API its finicky at best, and just straight up too slow to stream at worst even with HA. Personally - if the goal is to make this independent of the native app/work right in the browser, and work w/o MPV doing that heavy lifting - i think it might be best to do this in a separate project. You can compile https://github.com/pojntfx/weron to the GOOS=js GOARCH=wasm target, so for the P2P sync you could even make the two compatible, but I feel like developing a web-based version of this is best done in a separate project so that we can make different architectural decisions. There are also some problems with this approach around who does the transcoding, the legality of processing a stream with content that we know nothing about on a server instead of the clients (think: somebody trying to stream CSAM or copyrighted material) etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants