title: FFMpeg WebVTT hls playlist out of sync
body: <p>I am using the following commands with FFmpeg to encode a .mov video to hls and then also create a playlist for subtitles converting a .srt file to .vtt.</p>
  
  <pre><code>// Creating hls playlist 
  
  ffmpeg -hide_banner -y -i /Users/dave/mermaid.mov -c:a aac -ar 48000 -c:v h264 -profile:v baseline -avoid_negative_ts 0 -start_number 0 -hls_time 10 -hls_playlist_type vod -hls_list_size 0 -f hls -vf scale=w=640:h=360:force_original_aspect_ratio=decrease -b:v 800k -maxrate 856k -bufsize 1200k -b:a 96k -hls_segment_filename /Users/dave/mermaid/360/360p_%03d.ts /Users/dave/dave/mermaid/360/360p.m3u8 
  -c:a aac -ar 48000 -c:v h264 -profile:v baseline -avoid_negative_ts 0 -start_number 0 -hls_time 10 -hls_playlist_type vod -hls_list_size 0 -f hls -vf scale=w=842:h=480:force_original_aspect_ratio=decrease -b:v 1400k -maxrate 1498k -bufsize 2100k -b:a 128k -hls_segment_filename /Users/dave/Desktop/mermaid/480/480p_%03d.ts /Users/dave/Desktop/mermaid/480/480p.m3u8 
  -c:a aac -ar 48000 -c:v h264 -profile:v baseline -avoid_negative_ts 0 -start_number 0 -hls_time 10 -hls_playlist_type vod -hls_list_size 0 -f hls -vf scale=w=1280:h=720:force_original_aspect_ratio=decrease -b:v 2800k -maxrate 2996k -bufsize 4200k -b:a 128k -hls_segment_filename /Users/dave/Desktop/mermaid/720/720p_%03d.ts /Users/dave/Desktop/mermaid/720/720p.m3u8 
  -c:a aac -ar 48000 -c:v h264 -profile:v baseline -avoid_negative_ts 0 -start_number 0 -hls_time 10 -hls_playlist_type vod -hls_list_size 0 -f hls -vf scale=w=1920:h=1080:force_original_aspect_ratio=decrease -b:v 5000k -maxrate 5350k -bufsize 7500k -b:a 192k -hls_segment_filename /Users/dave/Desktop/mermaid/1080/1080p_%03d.ts /Users/dave/Desktop/mermaid/1080/1080p.m3u8
  
  // Creating subtitles
  
  ffmpeg -i /Users/dave/mermaid.mov -i /Users/dave/little-mermaid.srt -c copy -c:s webvtt -start_number 0 -hls_time 10000000 -hls_flags single_file -hls_playlist_type vod -f hls -avoid_negative_ts 0 /Users/dave/mermaid/English/master.m3u8
  </code></pre>
  
  <p>I am also doing this with AWS Media Convert the AWS conversion works fine the subtitles are perfectly in time but the FFMPEG version seems to be out of sync by about 1 second.</p>
  
  <p>Here are both files for to compare the exact same files are used for both.</p>
  
  <p>AWS Media Convert: <a href="https://d25hd5yfabpc2n.cloudfront.net/c0017bfe-3617-47a5-9525-86d69c73cf57/master.m3u8" rel="nofollow noreferrer">https://d25hd5yfabpc2n.cloudfront.net/c0017bfe-3617-47a5-9525-86d69c73cf57/master.m3u8</a></p>
  
  <p>Local FFMPEG: <a href="https://d25hd5yfabpc2n.cloudfront.net/stackoverflow/master.m3u8" rel="nofollow noreferrer">https://d25hd5yfabpc2n.cloudfront.net/stackoverflow/master.m3u8</a></p>
  
  <p>The only thing I can see if I download both playlists is the AWS one has FRAME-RATE set.</p>
  
  <p>Here is an example of both videos playing the FFMEPG one is noticeably out of sync </p>
  
  <p><a href="https://output.jsbin.com/xopohupivu/" rel="nofollow noreferrer">https://output.jsbin.com/xopohupivu/</a></p>
  
  <p>Another thing I have noticed is the AWS webvtt version has this at the top of the webvtt file.</p>
  
  <pre><code>WEBVTT  #Elemental Media Engine(TM) 2.16.0.602399
  X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:191970
  </code></pre>
  
  <p>Not sure what is happening here can't find any information on how to implement this with FFMPEG.</p>
  
  <p>Thanks</p>