mazi-project / portal

This is the portal of the MAZI toolkit
http://www.mazizone.eu/toolkit/
MIT License
18 stars 6 forks source link

MAZI as video streaming server #103

Open acorbi opened 6 years ago

acorbi commented 6 years ago

Dear MAZI devs and contributors,

In the context of a grass-roots initiative based in Berlin (more details at the proper moment and within the proper context), I am currently researching/experimenting with the idea of using the MAZI as a streaming server/relay for live audio-visual contents.

A brief technical description of the application we are seeking to achieve would be:

In a public event, moderator(s) and speaker(s) are recorded live with a computer (RECORDER) equipped with broadcasting software such as https://obsproject.com/. RECORDER then sends the video/audio signal to the MAZI. Other members of the audience , not present on the event's room but within the MAZI's wifi signal, will then be able to connect to the MAZI with their computers/phones (CLIENTS) and be able to access the video/audio stream which will be embedded into a wordpress site (served by MAZI as well)

Some more detailed requirements would be:

Some notes describing the current status of my research:

Proposed implementation:

Apache does not seem to have an RTMP module such as NGINX does so a possible solution I am considering would be to run NGINX alongside, making sure it does not conflict with any of the ports APACHE uses.

Alternatives / questions

Vision

Ideally, this would be integrated into the MAZI project as an additional application which admins would be able to switch on/off ( starting/stopping the nginx instance in case to go down that road or disabling the apache module in the other pictured scenario). The application could have a minimal UI similar as what is described in https://github.com/mazi-project/portal/issues/102

Here my thoughts, I will be continuing the research and testing with this and update you guys over here. In the meanwhile, I would be very grateful if anyone can share his/her thoughts and experiences.

lucabaldesi commented 6 years ago

Hi, I am the main developer of PeerStreamer-ng a live P2P streaming platform and I am working in the netCommons project fostering community networks and their services.

PeerStreamer-ng is a open source platform with minimum footprint (I usually ran it on raspberry pies) and a WebRTC interface. It uses the Janus gateway to convert from WebRTC flow to RTP and back. PeerStreamer-ng bundles RTP packages in data chunks and exchange them with a P2P approach. While the more instances are running the better (for the P2P sakes,) it in principle can be used as a federated server. Users have not to install anything (but they would gain if they had a close instance of PeerStreamer-ng running).

I have worked on Cloudy, which is a somewhat similar to MAZI, and I bundled PeerStreamer-ng in a docker container to be readily installable on the Cloudy platform.

I think it should not take much time to port PeerStreamer-ng to MAZI as well but, at the moment, I have no time to do that. However, If someone decided to spend effort in this, I can provide support and online help.

Best, Luca

panosnethood commented 6 years ago

Thanks @lucabaldesi !

The MAZI toolkit is just a web service on top of the main Raspberry Pi OS, so I guess if you have already installed it on a Raspberry Pi it should work.

Could you send us the installation instructions for the Raspberry Pi (and also usage instructions) to try it out?

The MAZI toolkit is currently working on the "jessie" version of raspbian, but given that the new Raspberry Pi 3 B+ includes a 2nd 5GHz radio, which will make "meshing" very easy out of the box, eventually we will need to install the peerstreamer in the "stretch" version --- just in case this makes a difference for you.

lucabaldesi commented 6 years ago

Hi! You can find building instruction at this link. However, to ease the installation I suggest to use the docker container. Note that by now PeerStreamer-ng relies on serf to advertise available channels so, be sure to install and run serf on your machine if you want to install it in more than one node.

Once you set it up, just point your browser to http://:3000

panosnethood commented 6 years ago

I had the impression that docker does not work with the Raspberry Pi and building instructions are for ubuntu. Are they available also for one of the two raspbian images (jessie or stretch)?

lucabaldesi commented 6 years ago

Hi! I have been working with those Docker images on Debian (stretch) systems and Raspberry pies 3 B+. Docker has been working flawlessly for me on the pies. Instructions can be used interchangeably with debian as well, as I tested. I had minor issues making it work with Raspberry pie 2 but nothing really hard. I updated the installation instructions with more details and the full set of commands to be run on a Rapsberry pie 3B+ to set it working.

acorbi commented 6 years ago

Dear everyone, here is a small update on my progress towards developing a solution for adding Video Streaming capabilities within the MAZI toolkit.

After doing some initial research about webserver-based solutions, specially targeting apache, the most streamlined solution I could come up with was to Install a version of nginx which already includes the RTMP module aside from apache and expose a HLS stream via a m3u8 file

For that I followed this step-by-step tutorial obtaining good results: https://docs.peer5.com/guides/setting-up-hls-live-streaming-server-using-nginx/

In a nutshell, this gives you an nginx instance running on port 8080 (so it does not conflict with apache serving the MAZI's dashboard and webapps) which you can turn on/off to enable/disable the video streaming capabilities. Here a sketch of the setup:

screenshot from 2018-06-16 13-31-50

I tested it with the setup described on my original message (using OBS streaming software) and, although the video is coming with a considerable delay to the consuming clients using VLC so access the m3u8 file) the quality is good and the setup resembles reliable.

Now, the next steps would be:

haniavis commented 6 years ago

Hi, It is great that you are progressing. Looking forward to integrate this into the toolkit. Whenever you have the installation script ready, just inform us to start the testing and integration.

acorbi commented 6 years ago

Hi @haniavis , will do!