Linux hls streaming ffmpeg+nginx
First you need to install ffmpeg on your linux server
now we need to install all necessary packets by typing
sudo -s
apt-get install make automake g++ bzip2 python unzip patch subversion ruby build-essential git-core checkinstall yasm texi2html libfaac-dev libmp3lame-dev
apt-get install build-essential
wget http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz
tar xvzf yasm-1.2.0.tar.gz
cd yasm-1.2.0/
./configure
make
make install
cd ..
git clone git://git.videolan.org/x264.git
cd x264/
./configure --enable-shared
make
make install
cd ..
now we need to download and compile the latest ffmpeg version by typing
wget http://ffmpeg.org/releases/ffmpeg-3.3.3.tar.bz2
tar xvjf ffmpeg-3.3.3.tar.bz2
cd ffmpeg-3.3.3
./configure --enable-gpl --enable-libx264 --enable-libvpx
make
make install
ldconfig
cd ..
now we need to install nginx by typing
apt-get install nginx
now we need to go configure nginx by typing
cd /etc/nginx/site-enable
rm default
nano default
now we need to put our config
server {
listen 80;
server_name my.server;
location / {
root /var/www/html/;
}
}
service nginx restart
now we need to create the stream by typing
ffmpeg -i source -acodec copy -vcodec copy -f hls -hls_time 4 -hls_list_size 4 -hls_allow_cache 0 -hls_flags delete_segments /var/www/html/ch1.m3u8
now we can play our stream from remote machine by vlc
http://yourserver/ch1.m3u8
if you have any question you can leave the comments below
any donation is appreciated
btc 15QP34iQgVYP9qMZYyuV6KkaxiuiumGACj