livepeer / go-livepeer

Official Go implementation of the Livepeer protocol
http://livepeer.org
MIT License
541 stars 169 forks source link

Integrate Livepeer into OBS as a "Streaming Service" #444

Closed chrishobcroft closed 2 years ago

chrishobcroft commented 6 years ago

Currently, a user of OBS (Open Broadcast Software) must configure a "Custom Streaming Server" in order to stream to Livepeer.

This issue proposes a change, so that it automatically appears as a "Streaming Service".

Technical details of how this works will obviously need to be worked out, but needs to consider how to integrate with Ethereum.

Perhaps a user can be prompted to configure a UTC file, and be prompted for a password every time they stream (in order to maintain security).

ericxtang commented 6 years ago

This would be a great bounty, especially for someone who has built a OBS plugin before.

j0sh commented 6 years ago

To start out simply, the OBS plugin could pre-configure the expected settings (eg, x264, 4sec GOP length, etc) and only configure the broadcast address. Otherwise it becomes more involved with the keys as you mentioned, checking and making deposits, and soon creating a job, etc.

gitcoinbot commented 6 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


This issue now has a funding of 200.0 LPT attached to it.

chrishobcroft commented 5 years ago

I have a few things to share re: the scope of this:

@angyangie @ericxtang @f1l1b0x @j0sh @spiegeleixxl keen to hear your thoughts on this.

kuhnchris commented 5 years ago

Ah OK, i was about to get myself some ETH to try this out. It makes sense to have a "default" configuration (rtmp://localhost:) and a alternative as text box. Regarding the "connection", we can either provide a shell script and .bat file (for *NIX(mac/linux) and windows) that calls livepeer with certain parameters and start obs, OR, as already mentioned above, write a plugin that basically checks if a LivePeer process is running, and if not, starts a process configured inside the plugin (path to execute, etc.).

To test we should try running LivePeer (either directly or via Docker) and use a fixed port, and create a 2nd repo incase we want to "extend" OBS with the batch script / .BAT script and a auto-start plugin.

But I leave that decision up to you guys, I'll try to get the infrastructure running in the meantime.

gitcoinbot commented 5 years ago

@spiegeleixxl Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

kuhnchris commented 5 years ago

Hi there everyone,

I got the testnet setup here (I guess, hard to try in docker), did you guys decide on which route to take with the plugin? @chrishobcroft

Thanks, Chris

chrishobcroft commented 5 years ago

In my mind, the most elegant solution here, is to bake OBS and livepeer together. So, an OBS that is only able to broadcast using livepeer. Or perhaps better put: a version of livepeer which embed OBS as a Broadcasting user-interface.

When it runs first time, it first launches a livepeer Broadcasting node, and prompts a user to create an Ethereum private key (in ~/.lpData/keystore) with a password to encrypt it. When it runs subsequent times it runs, it asks for the password to decrypt the private key, in order to operate / sign transactions. n.b. this is as per the current command line interface flow in livepeer on MacOS and Linux.

Once the livepeer node is running in Broadcaster mode, it launches OBS, as the interface for configuring what the Broadcast on livepeer's open-source video infrastructure. When the user clicks "Start Streaming", then they're streaming using livepeer - as easy as that. When the user looks at the "Stream" tab under "Settings", it only gives option of livepeer or custom streaming server. Also, it could display the livepeer node's broadcaster information, as per the livepeer_cli.

And from the user's perspective, it can be as easy as that to start livestreaming on a secure, open-source, peer-to-peer network.

Below is some kind of mockup of how a rough UX could look. It's very ugly, and could definitely be easily improved with some clearer wording - so let me know if you'd like me to work on that.

Step 1: OBS is in the background, but before we can access it, first we must create an Ethereum account for livepeer. Here, the user inputs a password to encrypt that new account. screenshot from 2018-10-23 00-21-12

Step 2: The user enters the password again, to make sure it was right first time: screenshot from 2018-10-23 00-21-19

Step 3: which represents the unlocking of the key. So, yes, the first time it runs, the user enters the password 3 times. screenshot from 2018-10-23 00-21-34

Step 4: the Broadcast node is running, and OBS is ready to "Start Streaming". screenshot from 2018-10-23 00-21-43

Step 5: Settings > Stream shows you the default option as being livepeer, and displays some useful information about the node. Perhaps in future it could handle some of the configuration of livepeer, but let's not get ahead of ourselves. screenshot from 2018-10-22 23-40-55

And this is definitely not a requirement, but more a "nice to have", would be the ability to also configure a custom streaming server, in case I need to switch to another provider for any reason.

So in many ways, it feels like embedding OBS into livepeer's Broadcaster node, and presenting it in a way which is easy and secure for the user.

I'm really interested to know what you think to this. It might not be as elegant as an OBS plug-in, but instead I think it can act as a way to empower a world of artists, journalists, creators, humans, to be able to broadcast to the world on an open-source censor-resistant video platform.

kuhnchris commented 5 years ago

Well, it would work as a "one-off" solution. Like a patch against master/trunk, as long as nothing major changes we should be able to get through with this. Integrating this is not the hard part, the harder part will be the integration across platforms (especially Windows v.s. Mac). I can even imagine before launching the OBS interface we could actually prompt the user the information required by the livepeer daemon (password prompt, mini-shell-esque output).

Removing the other providers isn't a problem, it's a simple list that we can clean up, displaying information of livepeer on the other hand depends on what API the livepeer-cli provides so we can actually call against that API and get the data to display the data you showed in your mock-up above. (Step 5)

I'll look into this and try to give you a rough first draft as soon as I get around. (hopefully tomorrow or the day after)

Thanks for your input!

gitcoinbot commented 5 years ago

@spiegeleixxl Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

kuhnchris commented 5 years ago

Hi there, got some progress for you guys:

When you start the modified OBS: image

Wrong passphrase closes OBS: image

If working: image

Now i'm working on the "streaming settings", then you could try it.

:-)

All the best Chris

chrishobcroft commented 5 years ago

Very nice.

For copy, I would suggest:

Please enter your passphrase to decrypt your private key.

Re: the streaming, it ought to be equivalent to setting a custom streaming server to stream to rtmp://localhost:1935

Did you look at the livepeer_cli and the functions available, such as "deposit"? It would be really great to be able to configure these settings through OBS.

screenshot from 2018-10-22 23-40-55

kuhnchris commented 5 years ago

Hmm, I can add the display, but for Deposit and other functions I would suggest that you have a separate client for that. I can add a couple of functions (via Qt), but only rudimentary for now.

-Chris

j0sh commented 5 years ago

Note that not all nodes will be on localhost, the user should be able to broadcast to a node that's already running somewhere else.

On Sun, Oct 28, 2018, 09:51 Chris Hobcroft notifications@github.com wrote:

Very nice.

For copy, I would suggest:

Please enter your passphrase to decrypt your private key.

Re: the streaming, it ought to be equivalent to setting a custom streaming server to stream to rtmp://localhost:1935

Did you look at the livepeer_cli and the functions available, such as "deposit"? It would be really great to be able to configure these settings through OBS.

[image: screenshot from 2018-10-22 23-40-55] https://user-images.githubusercontent.com/2212651/47322530-94665280-d658-11e8-93d5-3fc6ca4d9ac5.png

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/livepeer/go-livepeer/issues/444#issuecomment-433721985, or mute the thread https://github.com/notifications/unsubscribe-auth/AAR2nnQv1AqbBDXHCAD6TxYFGNtJhQRsks5upeCigaJpZM4ULJIP .

kuhnchris commented 5 years ago

Would that be a "custom" broadcasting server, or would you like to configure that via the LivePeer tab itself, just pre-set with the localhost?

chrishobcroft commented 5 years ago

@j0sh yes, and you can use the vanilla release of OBS to stream to other nodes assuming you can reach them.

This issue / bounty is all about prototyping a more accessible user experience for OBS to easily broadcast using Livepeer. If it can install and run Livepeer out of the box, it can help creators to connect with Livepeer much more easily.

chrishobcroft commented 5 years ago

As for deposit() and other functions, these can be managed via:

https://explorer.livepeer.org/accounts/0x70564145fa8e8a15348ef0190e6b7c07a2120462/broadcasting

Where 0x70564145fa8e8a15348ef0190e6b7c07a2120462 is the address of the node.

kuhnchris commented 5 years ago

Hello everyone,

I copied the rtmp-settings module and created an entirely new rtmp-livepeer module. image Sadly there are some restrictions which causes some bugs with the display, so I am thinking about extending the OBS-GUI library so we can actually "refresh" the display, currently we have the problem that I cannot directly show the new values, but have to reopen the window. A small fix and/or pass-through of the Qt elements should make little work of that.

The only thing I did not get yet is the "registered IP" - do you want to have the broadcast IP there (as in the transcoder) or your "own" public IP? (e.a. calling some remote API like https://api.ipify.org/ )

I could also implement button(s) which open a browser to the defined URLs for deposit and other functions, as a intermediate solution

chrishobcroft commented 5 years ago

Very nice! Well done! And yes, buttons which open browser URLs would be great.

Also, assuming the config is still being stored in ~/.lpData then you can point people to this post about connecting Livepeer with MetaMask.

Re: the public IP, I would say that the focus here ought to be about helping a user to understand how someone else could access their streaming content, so your idea is nice. Perhaps it can link to some guide to opening up a port on the user's router?

kuhnchris commented 5 years ago

You want to provide me some URLs I can include? I can also build URLs with data I can get from the CLI, i just need to know which one are "important" to the users. ;-) The Metamask<->Livepeer post definitly makes sense.

For a "next steps" I would also suggest to integrate a micro-webserver providing a web3.js instance to add a new account to MetaMask locally so users do not need to find that hidden directory: https://github.com/MetaMask/faq/blob/master/DEVELOPERS.md https://web3js.readthedocs.io/en/1.0/web3-eth-accounts.html

Re: Public IP - I can provide the IP via that webservice, and, say for example this URL: https://www.wikihow.com/Open-Ports

All the best, Chris

kuhnchris commented 5 years ago

I made a quick mock-up and implemented most of the data for now: image

Anything else we'd need for a quick start?

chrishobcroft commented 5 years ago

Some feedback:

  1. The amounts you are showing are actually in "Wei" which are a fraction of Ether. 1 Ether = 10^18 Wei.

  2. It's spelled "Ethereum", not "Ethereum" :)

Does the "Start Streaming" work? Are you able to ffplay it?

ffplay http://localhost:8935/stream/[manifestID].m3u8

And what OS platform are you testing this on?

Great job, excited to see it working.

kuhnchris commented 5 years ago

Want me to recalc to Eth (e.a. div by 10e18) or want me to display in WEI? The Etherium/Ethereum will be translateable anyways, but I'll fix it in the default version. ;-)

I haven't tried streaming yet, but I can test it, if I set up everything properly on testnet... Will reply to you ASAP.

Testing and compiling Platform right now is Mac OS X, I have access to a windows machine and a linux build machine incase we want to provide binaries/installers.

i'll upload the branch soon, but it will be a separate repository, as I did have to modify obs' UI to start the QThread, it's possible that i'd make another plugin, or integrate it in our plugin, but for the first try we can do it with the own repository, I guess.

Let me know if you need anything specific!

-Chris

kuhnchris commented 5 years ago

"Start Streaming" (without any special settings, but bound before via cli) results in the following, but I think that the transcoder simply does not exist on the rinkeby net: image

chrishobcroft commented 5 years ago

The acid test is the ffplay command as defined above.

kuhnchris commented 5 years ago

kuhnchriss-MacBook-Pro:livepeer_darwin kuhnchris$ curl http://localhost:8935/stream/0ec418f7883c757e6eca3014621d032d6ddee6df43ca661b5ded0c838ccc401b.m3u8
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=1200000,RESOLUTION=640x360
0ec418f7883c757e6eca3014621d032d6ddee6df43ca661b5ded0c838ccc401bP360p30fps16x9.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=600000,RESOLUTION=426x240
0ec418f7883c757e6eca3014621d032d6ddee6df43ca661b5ded0c838ccc401bP240p30fps16x9.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=0,BANDWIDTH=4000000,RESOLUTION=1280x720
0ec418f7883c757e6eca3014621d032d6ddee6df43ca661b5ded0c838ccc401bP720p30fps16x9.m3u8
kuhnchriss-MacBook-Pro:livepeer_darwin kuhnchris$ curl http://localhost:8935/stream/0ec418f7883c757e6eca3014621d032d6ddee6df43ca661b5ded0c838ccc401bP360p30fps16x9.m3u8
ErrNotFound
kuhnchriss-MacBook-Pro:livepeer_darwin kuhnchris$ curl http://localhost:8935/stream/0ec418f7883c757e6eca3014621d032d6ddee6df43ca661b5ded0c838ccc401bP360p30fps16x9.m3u8
ErrNotFound
kuhnchris commented 5 years ago

FYI: I added my branch to https://github.com/kuhnchris/obs-studio . You can follow the default build instructions, after you finished building with cmake you should add the livepeer directory and livepeer/livepeer binary into the same folder as the obs binary. After that you should be able to run/connect as usual.

-Chris

gitcoinbot commented 5 years ago

@kuhnchris Hello from Gitcoin Core - are you still working on this issue? Please submit a WIP PR or comment back within the next 3 days or you will be removed from this ticket and it will be returned to an ‘Open’ status. Please let us know if you have questions!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Started 3. Submitted 4. Done


@kuhnchris due to inactivity, we have escalated this issue to Gitcoin's moderation team. Let us know if you believe this has been done in error!

Funders only: Snooze warnings for 1 day | 3 days | 5 days | 10 days | 100 days

rmshea commented 5 years ago

Hey @chrishobcroft, Ryan from Gitcoin checking in here. Have you had a chance to look at @kuhnchris' work? Let me know if you have any questions on the Gitcoin end of things 😄

chrishobcroft commented 5 years ago

Hi @kuhnchris can you give some more information about how I can try this out? I'm running on Ubuntu, and usually would usually follow these instructions for installing: https://github.com/obsproject/obs-studio/wiki/Install-Instructions#linux

kuhnchris commented 5 years ago

Hi there @chrishobcroft , sorry for the long delay, currently a really stressful time of year. The default install instructions should work as is, just make sure to copy a binary of livepeer to the execution directory so it can be started.

chrishobcroft commented 5 years ago

Hey Chris, I'm trying to work out how to build this on Ubuntu, but I'm not a developer.

I don't really know how to follow the default install instructions - any advice?

kuhnchris commented 5 years ago

Hey there. Would it help if I prepare a Docker Image you can execute? Because else i'd have to throw a ubuntu vm up for myself to check it, I'm usually working on debian-esque systems and currently on Alpine.

gitcoinbot commented 5 years ago

Issue Status: 1. Open 2. Cancelled


The funding of 200.0 LPT (446.0 USD @ $2.23/LPT) attached to this issue has been cancelled by the bounty submitter