3

I'm trying to created live event broadcast on my VPS server , to make the audience able watch my broadcast I use Nginx RTMP that's produce link at this format http://192.168.1.5:8080/hls/live.m3u8 this is my ffmpeg command

ffmpeg -re -i <input> -s 634x360 -vb 110k -c:v libx265 -preset ultrafast -c:a aac -ab 38k -ar 44100 -f mpegts rtmp://localhost/hls/live

command output

frame= 1465 fps= 25 q=-0.0 size= 1231kB time=00:00:58.56 bitrate= 172.2kbits/s speed=0.999x

Nginx config file

server {
listen      8080;
server_name  localhost;
 location /hls 
   {
     types 
       {
                application/dash+xml mpd;
                application/vnd.apple.mpegurl m3u8;
       }
      root /tmp;
      add_header Cache-Control no-cache;
    }
  }

so the encoding runs on mealtime but when I try to access live.m3u8 url I got nginx 404 Not Found error message like Nginx didn't generate .m3u file at all .

==update

Alright I found workaround solution to generate .m3u8 file directly from ffmpeg using this command

  ffmpeg -i <input> -map 0 -c:v libx265 -vb 300k -c:a aac -ab 38k -ar 44100 -preset veryfast -f ssegment -segment_list /var/www/vhl/live.m3u8 -segment_list_type hls -segment_list_size 10 -segment_list_flags +live -segment_time 10 -segment_wrap 30 /var/www/vhl/live%01d.ts 

I was able to play it via VLC for which is good for now to gain more performance e.g you have huge number of audience mount your output folder /var/www/vhl/ as tmpfs

  • HLS does not accept HEVC. – Gyan Jun 14 '18 at 4:33
  • 2
    HLS does support HEVC using an mp4 container. RTMP does not support HEVC. – SlimSCSI Jun 14 '18 at 14:37
  • Alright I found workaround solution to generate .m3u8 file directly from ffmpeg using this command ffmpeg -i <input> -map 0 -c:v libx265 -vb 300k -c:a aac -ab 38k -ar 44100 -preset veryfast -f ssegment -segment_list /var/www/dmain/live.m3u8 -segment_list_type hls -segment_list_size 10 -segment_list_flags +live -segment_time 10 -segment_wrap 30 /var/www/dmain/live%01d.ts I was able to play it via VLC for which is good for now . – Salem F Jun 15 '18 at 5:43
  • Sorry, I meant to write FLV. – Gyan Jun 16 '18 at 5:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.