Opened 3 years ago

Closed 3 years ago

#5812 closed defect (fixed)

Last segment and #EXT-X-ENDLIST tag missing from generated HLS subtitle playlist

Reported by: germancameron Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: hls
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

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.

Attachments (1)

ffmpeg-20160830-174229.log (593.4 KB) - added by germancameron 3 years ago.
Report generated by ffmpeg

Download all attachments as: .zip

Change History (4)

comment:1 follow-up: Changed 3 years ago by cehoyos

  • Keywords subtitle playlist removed

Please provide your command line together with the complete, uncut console output to make this a valid ticket.
If you can fix the issue, please send your patch made with git format-patch to the development mailing list.

Changed 3 years ago by germancameron

Report generated by ffmpeg

comment:2 in reply to: ↑ 1 Changed 3 years ago by germancameron

Replying to cehoyos:

Please provide your command line together with the complete, uncut console output to make this a valid ticket.
If you can fix the issue, please send your patch made with git format-patch to the development mailing list.

I have attached the log to the ticket because I think it is too long to paste into the description.

comment:3 Changed 3 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from new to closed
  • Version changed from unspecified to git-master

Applied as cefce6e2c1e3b94bc6f41b96dbdfa4919e8c29d7 - thank you for the report and the fix!

Note: See TracTickets for help on using tickets.