Difference between revisions of "Nginx: Konfigurasi RTMP dengan HLS dan Dash"
Jump to navigation
Jump to search
Onnowpurbo (talk | contribs) |
Onnowpurbo (talk | contribs) |
||
Line 74: | Line 74: | ||
# -f flv rtmp://localhost:1935/hls/movie | # -f flv rtmp://localhost:1935/hls/movie | ||
+ | |||
+ | # avconv -loglevel verbose -re -i movie.avi -vcodec libx264 | ||
+ | # -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1 | ||
+ | # -f flv rtmp://localhost:1935/hls/movie | ||
Default playlist address pada setup ini adalah: | Default playlist address pada setup ini adalah: |
Revision as of 13:56, 1 November 2014
Untuk mendukung HLS & Dash, kita perlu mengubah sedikit konfigurasi nginx.conf
vi /usr/local/nginx/conf/nginx.conf
ubah agar
http { server { listen 80; location /hls { # Serve HLS fragments types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } root /tmp; add_header Cache-Control no-cache; } location /dash { # Serve DASH fragments root /tmp; add_header Cache-Control no-cache; } } }
Kita butuh menambahkan folder tmp/dash and tmp/hls di root folder untuk nginx.
mkdir /tmp/hls mkdir /tmp/dash chmod -Rf 777 /tmp/hls chmod -Rf 777 /tmp/dash
Juga di bagian rtmp:
rtmp { server { listen 1935; chunk_size 4000; application live { live on; record off; } application hls { live on; hls on; hls_path /tmp/hls; } # MPEG-DASH is similar to HLS application dash { live on; dash on; dash_path /tmp/dash; } } }
Contoh sederhana untuk men-stream sebuah video .avi menggunakan ffmpeg:
# ffmpeg -loglevel verbose -re -i movie.avi -vcodec libx264 # -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1 # -f flv rtmp://localhost:1935/hls/movie
# avconv -loglevel verbose -re -i movie.avi -vcodec libx264 # -vprofile baseline -acodec libmp3lame -ar 44100 -ac 1 # -f flv rtmp://localhost:1935/hls/movie
Default playlist address pada setup ini adalah:
http://server.ip/hls/StreamKey.m3u8
StreamKey pada contoh ffmpeg commandline di atas adalah “movie”. Ingat, address rtmp address selalu rtmp://ip/ApplicationName/StreamKey.