title: How to add a subtitle to an HLS playlist using FFmpeg?
body: <p>I have a video (<code>video.mp4</code>) and a subtitle file (<code>subtitle.srt</code>).</p>
  <p>I'm trying to use FFmpeg to generate a VoD HLS playlist with 3 different resolutions for the video; and I also want the subtitle file to turn into segmented <code>.vtt</code> files.</p>
  <p>I've tried the following command, but it doesn't work, it gives me a &quot;Conversion failed!&quot; message without any further information:</p>
  <pre class="lang-sh prettyprint-override"><code>ffmpeg -i video.mp4 -i subtitle.srt \
  -preset slow -g 60 -sc_threshold 0 \
  -map 0 -map 0 -map 0 -map 1 \
  -s:v:0 640x360 -c:v:0 h264 -b:v:0 500k \
  -s:v:1 854x480 -c:v:1 h264 -b:v:1 1000k \
  -s:v:2 1280x720 -c:v:2 h264 -b:v:2 2000K \
  -c:a copy -c:s webvtt \
  -f hls -hls_playlist_type vod -var_stream_map &quot;v:0,a:0 v:1,a:1 v:2,a:2&quot; \
  -master_pl_name master.m3u8 -hls_time 6 -hls_list_size 0 -hls_allow_cache 1 -start_number 1 \
  -hls_segment_filename &quot;output/hls/%v/seg-%d.ts&quot; output/hls/%v/index.m3u8
  </code></pre>
  <p>I'm struggling to find any useful information in FFmpeg docs or anywhere else regarding how subtitles can be added to an HLS playlist. What should the command be like exactly? What am I missing in mine?</p>