Basilica’s website – Paolo Redaelli https://monodes.com/predaelli A civil engineer with a longlife fondness for Software Libero Wed, 20 Nov 2024 22:59:30 +0000 en-US hourly 1 https://wordpress.org/?v=6.7.1 91795679 https://monodes.com/predaelli/2024/11/20/12055/ https://monodes.com/predaelli/2024/11/20/12055/#respond Wed, 20 Nov 2024 22:59:26 +0000 https://monodes.com/predaelli/?p=12055

and https://generatepress.com. I shall keep an eye on them

]]>
https://monodes.com/predaelli/2024/11/20/12055/feed/ 0 12055
Self-Hosted Streaming Server – NGINX + RTMP – YouTube + Facebook Live https://monodes.com/predaelli/2022/09/18/self-hosted-streaming-server-nginx-rtmp-youtube-facebook-live/ https://monodes.com/predaelli/2022/09/18/self-hosted-streaming-server-nginx-rtmp-youtube-facebook-live/#respond Sun, 18 Sep 2022 15:05:37 +0000 https://monodes.com/predaelli/?p=9614 Copying this here in case the original goes offline

Self-Hosted Streaming Server – NGINX + RTMP – YouTube + Facebook Live

Published by Anthony on 14th April 2020

I’m writing these notes up, mainly as a reference for me in the future – but they might just help others looking to do similar.

Issue:

During the Coronavirus season, our church, like many, ventured into the world of streaming services, primarily to YouTube but with an eye to multiplexing to both YouTube and Facebook at the same time.

Initially, the plan was to stream from OBS Studio to an intermediate platform, restream.io

We tested with OBS sending the stream to restream and for the first week, everything worked fine.
Then, the second week about 10 minutes before due to go live restream.io suffered an outage. Fortunately, we were quickly able to flip to sending our stream directly to YouTube and our broadcast worked successfully.
However, for me, an issue with a shared service leaves a sour taste and so began the journey to discover what would be involved in running our own RTMP server.

It turns out the solution has been relatively straightforward…

Our solution:

Firstly, we signed up for a new VPS with vultr.com
We opted for a 1 x vCPU, 2GB RAM, High-Frequency machine with 64GB SSD storage, and 2TB monthly bandwidth. Research suggested that RTMP streaming/multiplexing is not particularly CPU/RAM intensive and is more about bandwidth consumption.

Once the VPS was provisioned, we selected the Ubuntu 18.04 LTS install image. The machine was duly created and connected via SSH to its IP shown in the portal.

Basic Installation:

Update all packages:

root@hostname#    sudo apt-get update
root@hostname#   sudo apt-get upgrade

Then install NGINX:

sudo apt-get install nginx
sudo apt install libnginx-mod-rtmp

At this point you can test that NGINX has been installed correctly by testing with your browser:

http://<your-servers-IP-address>

If successful, you should see the NGINX default page:

Configuration for YouTube

Now, on to adding the RTMP config.

Edit the nginx.conf file as follows:

nano /etc/nginx/nginx.conf

Add a section at the bottom of the file as follows:

rtmp {
     server {
             listen 1935;
             chunk_size 4096;

             application live { 
                        live on; 
                        record off; 
                        # Edit and enable line below to push incoming stream to YouTube 
                        # push rtmp://x.rtmp.youtube.com/live2/<your-Stream-Key-Copied-From-YouTube>; 
             }
      }
}

If you aren’t familiar with YouTube Live stream settings the key can be obtained from the following screens:

Save the nginx.conf file (Ctrl +X ) and start the NGINX service

root@hostname# systemctl restart nginx

Best practice would suggest installing a firewall package on your VPS to minimise its exposure to the Internet.

For Ubuntu 18.04, UFW is perfectly acceptable and well documented. Vultr have a comprehensive document at https://www.vultr.com/docs/configure-ubuntu-firewall-ufw-on-ubuntu-18-04

For me, I created 4 simple rules permitting inbound SSH from my home ISP’s fixed IP, and a friend’s IP plus equivalent rules permitting inbound TCP1935 from each of our addresses.

We chose to use OBS to create the stream footage, therefore we had to fill in the stream details within OBS Stream settings:

If you then click on Start Streaming within OBS, your OBS content should start appearing within your YouTube Studio account (albeit with a 30second delay).

Facebook Live

Facebook made some changes a little while back to only accepts RTMPS streams which NGINX and the RTMP can’t natively support. So, another jigsaw piece needs to be added to the puzzle. Enter stunnel!

Edit your nginx.conf file to include a new push statement.

push rtmp://127.0.0.1:1936/rtmp/<Facebook-persistent-stream-key>

restart nginx

systemctl restart nginx

Install Stunnel

apt-get install stunnel4 -y

Edit the stunnel boot configuration as follows (change ENABLE from 0 to 1)

nano /etc/default/stunnel4
ENABLE=1

Edit the stunnel config as follows:

nano /etc/stunnel/stunnel.conf
pid = /var/run/stunnel4/stunnel.pid
output = /var/log/stunnel4/stunnel.log

setuid = stunnel4
setgid = stunnel4

# https://www.stunnel.org/faq.html
socket = r:TCP_NODELAY=1
socket = l:TCP_NODELAY=1

debug = 4

[fb-live]

client = yes accept = 1936 connect = live-api-s.facebook.com:443 verifyChain = no

Enable Stunnel and start it

systemctl enable stunnel4.service
systemctl restart stunnel4.service

]]>
https://monodes.com/predaelli/2022/09/18/self-hosted-streaming-server-nginx-rtmp-youtube-facebook-live/feed/ 0 9614
Imat Felco https://monodes.com/predaelli/2021/08/13/imat-felco/ https://monodes.com/predaelli/2021/08/13/imat-felco/#respond Fri, 13 Aug 2021 13:09:12 +0000 https://monodes.com/predaelli/2021/08/13/imat-felco/ https://imatfelco.it/

Mi son trovato bene. Credo che la prossima volta che avrò bisogno di telecamere le prenderò da loro

]]>
https://monodes.com/predaelli/2021/08/13/imat-felco/feed/ 0 8632
audio – how to transform live RTMP video to live mp3 Icecast stream – Stack Overflow https://monodes.com/predaelli/2021/01/03/audio-how-to-transform-live-rtmp-video-to-live-mp3-icecast-stream-stack-overflow/ https://monodes.com/predaelli/2021/01/03/audio-how-to-transform-live-rtmp-video-to-live-mp3-icecast-stream-stack-overflow/#respond Sun, 03 Jan 2021 14:38:41 +0000 https://monodes.com/predaelli/?p=7993 Source: audio – how to transform live RTMP video to live mp3 Icecast stream – Stack Overflow

I have RTMP live stream with video and audio. I can get ogg audio live stream from RTMP and translate it to Icecast2 and get it on my site using JPlayer. Now i use such command:

/usr/local/bin/ffmpeg -re -i rtmp://192.168.22.12/live/live1 \
-vn -acodec libvorbis -b:a 48k -f ogg - | oggfwd -p -d "" \
-g "" -u "" localhost 8000 somepass live2

Then I stream my live audio using Icecast2, but it is in OGG format, so mobile devices don’t play it (Android device has a time lagging near 30 sec before they start playing, iOS devices don’t want to play it).

How can I transcode it to mp3 before sending to Icecast2?

If you are using a (very) recent version you just could use ffmpeg for this. To test if your ffmpeg is capable to stream to Icecast, do the following:

ffmpeg -protocols -v 0 | grep icecast

If this returns “icecast”, hooray, you can just do the following:

ffmpeg -re -i rtmp://192.168.22.12/live/live1 -vn \
       -codec:a libmp3lame -b:a 64k -f mp3 \
       -content_type audio/mpeg \
       icecast://source:pass@example.com:8000/mountpoint.mp3

Replace source with a specific username, if you have configured any, else leave it as source. The other things should be obvious.

 

 

]]>
https://monodes.com/predaelli/2021/01/03/audio-how-to-transform-live-rtmp-video-to-live-mp3-icecast-stream-stack-overflow/feed/ 0 7993
Broadcast Live Video – Live Streaming : HTML5, WebRTC, HLS, RTSP, RTMP – WordPress plugin | WordPress.org https://monodes.com/predaelli/2021/01/03/broadcast-live-video-live-streaming-html5-webrtc-hls-rtsp-rtmp-wordpress-plugin-wordpress-org/ https://monodes.com/predaelli/2021/01/03/broadcast-live-video-live-streaming-html5-webrtc-hls-rtsp-rtmp-wordpress-plugin-wordpress-org/#respond Sun, 03 Jan 2021 14:24:56 +0000 https://monodes.com/predaelli/?p=7987

Live video streaming, webcam broadcasting app and player with chat, external apps support, 24/7 IP cameras, video playlists, video archiving & vod …

I shall someday add this Broadcast Live Video – Live Streaming : HTML5, WebRTC, HLS, RTSP, RTMP – WordPress plugin to www.pastoraledesio.it.

Or maybe I’ll just use the new peertube 3 live capabilities.

But first I shall put a decent theme

]]>
https://monodes.com/predaelli/2021/01/03/broadcast-live-video-live-streaming-html5-webrtc-hls-rtsp-rtmp-wordpress-plugin-wordpress-org/feed/ 0 7987
Foto https://monodes.com/predaelli/2020/04/18/foto/ https://monodes.com/predaelli/2020/04/18/foto/#respond Sat, 18 Apr 2020 20:42:05 +0000 https://monodes.com/predaelli/?p=7109 ]]> https://monodes.com/predaelli/2020/04/18/foto/feed/ 0 7109 How to Import / Export WordPress Theme Customizer Settings https://monodes.com/predaelli/2020/03/27/how-to-import-export-wordpress-theme-customizer-settings/ https://monodes.com/predaelli/2020/03/27/how-to-import-export-wordpress-theme-customizer-settings/#respond Fri, 27 Mar 2020 04:55:40 +0000 https://monodes.com/predaelli/?p=6956

How to Import / Export WordPress Theme Customizer Settings

Want to export / import WordPress theme customizer settings? Here’s a step by step guide on how to import / export theme customizer settings in WordPress.

Basically, use Customize Export/Import plugin on both instances of WordPress!

]]>
https://monodes.com/predaelli/2020/03/27/how-to-import-export-wordpress-theme-customizer-settings/feed/ 0 6956
Registrazione aggiornamenti https://monodes.com/predaelli/2020/03/26/registrazione-aggiornamenti/ https://monodes.com/predaelli/2020/03/26/registrazione-aggiornamenti/#comments Thu, 26 Mar 2020 07:31:06 +0000 https://monodes.com/predaelli/?p=6951 Nei commenti i passi che ho fatto per aggiornare il sito della pastorale.

Converrà seguire scrupolosamente «Upgrading WordPress – Extended Instructions» piuttosto che la versione “semplificata”.

]]>
https://monodes.com/predaelli/2020/03/26/registrazione-aggiornamenti/feed/ 14 6951
Protected: Appunti per com com https://monodes.com/predaelli/2020/03/10/appunti-per-com-com/ https://monodes.com/predaelli/2020/03/10/appunti-per-com-com/#comments Tue, 10 Mar 2020 14:09:22 +0000 https://monodes.com/predaelli/?p=6862

This content is password protected. To view it please enter your password below:

]]>
https://monodes.com/predaelli/2020/03/10/appunti-per-com-com/feed/ 3 6862
Youtube audio-only live streaming https://monodes.com/predaelli/2020/03/04/youtube-audio-only-live-streaming/ https://monodes.com/predaelli/2020/03/04/youtube-audio-only-live-streaming/#respond Wed, 04 Mar 2020 18:04:00 +0000 https://monodes.com/predaelli/?p=6829

Ask Quora: How do I stream live audio to YouTube with a background image replacing the video feed?

Eyal Menin
Eyal Menin, Sr. Media Consultant at Verizon Communications (2001-present)
]]>
https://monodes.com/predaelli/2020/03/04/youtube-audio-only-live-streaming/feed/ 0 6829