First of all, we need to do all the things indicated here: https://gist.github.com/DevStefIt/23b8971db7e3fe084d29f2c915fb7773 We need to modify the Nginx configuration file:
sudo vim /etc/nginx/nginx.conf
Then, have to add the following lines in the existing RTMP configuration (or create a new one if you do not have it)
. . .
rtmp {
server {
...
application live {
live on;
record off;
hls on;
hls_path /var/www/html/stream/hls;
hls_fragment 3;
hls_playlist_length 60;
hls_cleanup off;
dash on;
dash_path /var/www/html/stream/dash;
dash_cleanup off;
}
}
}
...
We need to configure a block in the sites-available
folder.
sudo vim /etc/nginx/sites-available/rtmp
And insert the following lines:
...
server {
listen 8088;
location / {
add_header Access-Control-Allow-Origin *;
root /var/www/html/stream;
}
}
types {
application/dash+xml mpd;
}
Port 8088
is chosen because it is different than the other chose ports.
We enable port 8088 in TCP mode on the firewall
sudo ufw allow 8088/tcp
We create the folders of interest
sudo mkdir -p /var/www/html/stream/hls
sudo mkdir -p /var/www/html/stream/dash
We also grant a reasonable access for the current user
sudo chown -R $USER:$USER /var/www/html/stream
sudo chmod -R 775 /var/www/html/stream
We reload Nginx
sudo systemctl reload nginx
Hi I have a question, not sure if you or anyone else encountered a similar issue.
I'm working on a RaspberryPi 4b trying to stream HLS currently of just the video of "Big Buck Bunny.mp4". I followed the tutorial, the files created in the respective locations, and got of the tests to work, all except the last part where I try to view the stream using a variation of "http://server_ip:8088/hls/ARBITRARY_NAME.m3u8". Every time I try to access "http://(my raspberry pi's address):8088/hls/BBB.m3u8" to view it throws this error:
[tcp @ 0x7f70003f20] Connection to tcp://(my raspberry pi's address):8088 failed: Connection refused
http://(my raspberry pi's address):8088/hls/BBB.m3u8: Connection refused
I also tried using the "vlc media player" and it threw the error:
Your input can't be opened:
VLC is unable to open the MRL 'http://(my raspberry pi's address):8088/hls/BBB.m3u8'. Check the log for details.
I have confirmed the file is in the proper location. Any possible thoughts for a fix?
note any mention of (my raspberry pi's address) is to replace my real address, no I did not use that as the address when testing lol