title: nginx rtmp to hls streaming
body: <p>My scenario is to pull data from a RTSP source via ffmpeg, send it to nginx-rtmp, and use nginx to provide hls playback. There are quite a lot of tutorials and q&amp;a's on the internet. I followed this one:</p>
  <p><a href="https://docs.peer5.com/guides/setting-up-hls-live-streaming-server-using-nginx/" rel="nofollow noreferrer">https://docs.peer5.com/guides/setting-up-hls-live-streaming-server-using-nginx/</a></p>
  <p>However, it miserably failed.  To make things simpler to understand, I would like to ask the <strong>core</strong> question:</p>
  <p><strong>Who is responsible to create the m3u8 playlist file?</strong></p>
  <p>I tried to experiment in two steps: first, try to push a local mp4 file and play it back via HLS:</p>
  <p>Following the above tutorial, I try to use ffmpeg to push a local mp4 file to nginx-rtmp, and use videojs to play it.  The browser reported error:</p>
  <pre><code>VIDEOJS: ERROR: (CODE:4 MEDIA_ERR_SRC_NOT_SUPPORTED) No compatible source was found for this media. 
  </code></pre>
  <p>Secondly, I have successfully saved the video file pushed to nginx-rtmp as a series of FLV file, and I know that I can use <strong>exec_push</strong> to call <code>ffmpeg</code> to convert flv to a format that is compatible with HLS.  Again, here the core question is, howto create and <strong>UPDATE</strong> the m3u8 file as new video data is coming in endlessly.</p>
  <p>For now, I would like experts to help me tackle the first question -- playback static mp4 file through HLS.  Any tutorials on m3u8 playlist and mpeg-ts files are also much appreciated!</p>