Difference between revisions of "Nginx: Basic Live Video Streaming Server"

From OnnoWiki
Jump to navigation Jump to search
 
(3 intermediate revisions by the same user not shown)
Line 57: Line 57:
  
  
==Broadcasting with OBS==
+
==Studio Broadcast dengan OBS==
  
 
Kita bisa streaming menggunakan OBS, perlu di set
 
Kita bisa streaming menggunakan OBS, perlu di set
Line 73: Line 73:
 
Klik "Start Streaming" di OBS
 
Klik "Start Streaming" di OBS
  
 +
==Settingan di sisi Client / Penonton==
  
 +
Untuk bisa menonton, salah satu yang sederhana bisa menggunakan VLC
  
 +
sudo apt -y install vlc
  
==Viewing your stream==
+
Untuk akses, klik
  
A live video isn't much good if no one is watching it, so be your first viewer!
+
* Media > Open Network Stream
  
There are a multitude of open source media players that support RTMP, but the most well-known is probably VLC media player.
+
Alamat video streaming adalah
 
 
After you install and launch VLC, open your stream by clicking on Media > Open Network Stream. Enter the path to your stream, adding the Stream Key you set up in OBS, then click Play. For example,
 
  
 
  rtmp://IP-ADDRESS/live/SECRET-KEY.
 
  rtmp://IP-ADDRESS/live/SECRET-KEY.
  
You should now be viewing your very own live video stream!
+
==Selanjutnya?==
  
stream-server_livevideo.png
+
Yang bisa dikerjakan selanjutnya,
Live video in VLC
 
  
==Where to go next?==
+
* Limit access: bisa membatasi akses server kita, misalnya menggunakan firewall, .htaccess di web, atau access control di rtmp modul.
  
This is a very simple setup that will get you off the ground. Here are two other features you likely will want to use.
+
* Record streams: merekam video dengan cara mengubah sedikit konfigurasi,
 
 
    Limit access: The next step you might want to take is to limit access to your server, as the default setup allows anyone to stream to and from the server. There are a variety of ways to set this up, such as an operating system firewall, .htaccess file, or even using the built-in access controls in the RTMP module.
 
 
 
    Record streams: This simple Nginx configuration will only stream and won't save your videos, but this is easy to add. In the Nginx config, under the RTMP section, set up the recording options and the location where you want to save your videos. Make sure the path you set exists and Nginx is able to write to it.
 
  
 
  application live {
 
  application live {
Line 105: Line 101:
 
               record_unique on;
 
               record_unique on;
 
  }
 
  }
 
The world of live streaming is constantly evolving, and if you're interested in more advanced uses, there are lots of other great resources you can find floating around the internet. Good luck and happy streaming!
 
 
 
 
 
 
  
 
==Referensi==
 
==Referensi==

Latest revision as of 10:35, 11 May 2020

Sumber: https://opensource.com/article/19/1/basic-live-video-streaming-server

Yang perlu di pikirkan dalam instalasi live streaming video server

  • Stream quality: mau HD atau SD?
  • Viewership: jumlah pemirsa?
  • Storage: mau di rekam atau tidak?
  • Access: apakah private atau open?

Spec Minimal Server:

  • 4GB RAM
  • 20G harddisk
  • 1 core i7

Disini digunakan Real-Time Messaging Protocol (RTMP) untuk menangani audio + video streaming. Alternatif lain adalah WebRTC.

Setting Server

Instalasi nginx

sudo apt update
sudo apt upgrade (optional)
sudo apt -y install nginx

Instalasi RTMP agar nginx dapat menangani media stream:

sudo add-apt-repository universe
sudo apt install libnginx-mod-rtmp

Tambahkan konfigurasi di nginx untuk menangani RTMP,

sudo vi /etc/nginx/nginx.conf

Tambahkan di paling bawah,

rtmp {
        server {
                listen 1935;
                chunk_size 4096; 

                application live {
                        live on;
                        record off;
                }
        }
}

Di save konfigurasi-nya.

Restart nginx

sudo systemctl restart nginx
/etc/init.d/nginx restart



Studio Broadcast dengan OBS

Kita bisa streaming menggunakan OBS, perlu di set

  • Source > Media Sources > nama file.mp4
  • File > Settings > Stream > Custom > Server dengan format di bawah ini (cek dengan ifconfig di server)
rtmp://IP-ADDRESS/live.
  • Streaming Key, kita set sebagai password bagi user untuk akses, misalnya
x6kj-8psm-p2wy-38ks
onno-teknik-jaringan

Klik "Start Streaming" di OBS

Settingan di sisi Client / Penonton

Untuk bisa menonton, salah satu yang sederhana bisa menggunakan VLC

sudo apt -y install vlc

Untuk akses, klik

  • Media > Open Network Stream

Alamat video streaming adalah

rtmp://IP-ADDRESS/live/SECRET-KEY.

Selanjutnya?

Yang bisa dikerjakan selanjutnya,

  • Limit access: bisa membatasi akses server kita, misalnya menggunakan firewall, .htaccess di web, atau access control di rtmp modul.
  • Record streams: merekam video dengan cara mengubah sedikit konfigurasi,
application live {
             live on;
             record all;
             record_path /var/www/html/recordings;
             record_unique on;
}

Referensi

Pranala Menarik