[FFmpeg-trac] #5812(avformat:new): Last segment and #EXT-X-ENDLIST tag missing from generated HLS subtitle playlist

FFmpeg trac at avcodec.org
Tue Aug 30 21:11:06 EEST 2016


#5812: Last segment and #EXT-X-ENDLIST tag missing from generated HLS subtitle
playlist
-------------------------------------+-------------------------------------
             Reporter:               |                     Type:  defect
  germancameron                      |                 Priority:  normal
               Status:  new          |                  Version:
            Component:  avformat     |  unspecified
             Keywords:  hls,         |               Blocked By:
  subtitle, playlist                 |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:
 I am trying to convert a video with subtitles to HLS format. ffmpeg
 produced two playlists, one with ".ts" segments called out.m3u8 and one
 with ".vtt" segments called out_vtt.m3u8. The out.m3u8 file ends like
 this:
 {{{
 #EXTINF:2.502500,
 out102.ts
 #EXTINF:4.504500,
 out103.ts
 #EXT-X-ENDLIST
 }}}
 where as the out_vtt.m3u8 file ends like this:
 {{{
 #EXTINF:2.836167,
 out101.vtt
 #EXTINF:2.502500,
 out102.vtt
 }}}
 note there is no #EXT-X-ENDLIST and it's missing the last segment.

 How to reproduce:
 {{{
 ./ffmpeg -report -i /home/dev/Videos/navillera.mp4 -c:v copy -bsf:v
 h264_mp4toannexb -c:a copy -hls_list_size 0 /home/dev/Videos/hls/out.m3u8
 ffmpeg version N-81312-gb83d907 Copyright (c) 2000-2016 the FFmpeg
 developers
   built with gcc 4.9.2 (Debian 4.9.2-10)
 }}}

 I'm fairly sure I know what the issue is, this is a snippet from
 libavformat/hslenc.c, function hls_write_trailer:
 {{{
     if (vtt_oc) {
         av_freep(&hls->vtt_basename);
         av_freep(&hls->vtt_m3u8_name);
         avformat_free_context(vtt_oc);
     }

     hls->avf = NULL;
     hls_window(s, 1);
 }}}

 as you can see, the variable hls->vtt_m3u8_name is being freed before
 calling hls_window, a truncated snippet from the function hls_window looks
 like this:
 {{{
     if( hls->vtt_m3u8_name ) {
         ...
         if (last)
             avio_printf(sub_out, "#EXT-X-ENDLIST\n");

     }
 }}}
 it needs that variable that is being freed so that whole if statement body
 is being skipped.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/5812>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list