[FFmpeg-devel] Adding Webvtt in hls muxer

Deron deron at pagestream.org
Thu Mar 12 15:33:22 CET 2015

On 2/26/15 4:26 AM, Anshul wrote:
> On 02/25/2015 10:04 PM, Deron wrote:
>> On 2/21/15 8:05 AM, Deron wrote:
>>> On 2/15/15 5:44 AM, Anshul wrote:
>>>> attached another cleaned patch.
>>>> -Anshul
>>> Not sure if I should be posting here, privately, or do the user list 
>>> since it is an unaccepted patch... This patch applies cleanly to 
>>> ffmpeg git of that day, and with minor adjustment to current git, 
>>> but either crashes the same for me right away. Here is the back 
>>> trace from gdb:
>>> Program received signal SIGSEGV, Segmentation fault.
>>> __GI___libc_realloc (oldmem=0x70, bytes=8) at malloc.c:2977
>>> 2977    malloc.c: No such file or directory.
>>> (gdb) bt
>>> #0  __GI___libc_realloc (oldmem=0x70, bytes=8) at malloc.c:2977
>>> #1  0x00007ffff7609b99 in avformat_new_stream (s=s at entry=0xe2dbc0, 
>>> c=c at entry=0x0) at libavformat/utils.c:3655
>>> #2  0x00007ffff75451c4 in hls_mux_init (s=0x6787c0) at 
>>> libavformat/hlsenc.c:194
>>> #3  hls_write_header (s=0x6787c0) at libavformat/hlsenc.c:490
>>> #4  0x00007ffff75999ec in avformat_write_header (s=s at entry=0x6787c0, 
>>> options=0x6a9948) at libavformat/mux.c:406
>>> #5  0x0000000000424c00 in transcode_init () at ffmpeg.c:3096
>>> #6  0x0000000000407581 in transcode () at ffmpeg.c:3815
>>> #7  main (argc=13, argv=0x7fffffffe5a8) at ffmpeg.c:4022
>>> The command (I've tried all sorts of combinations. If I don't 
>>> provide a subtitle stream, it does not crash. Otherwise it does. 
>>> Unpatched can generate a webvtt from the subtitle stream without 
>>> crashing.)
>>> ffmpeg -loglevel debug -f lavfi -i movie=out.ts\[out0+subcc\] -f hls 
>>> -hls_segment_filename /var/www/html/stream/kota/v.low.%d.ts 
>>> -hls_subtitle_path /var/www/html/stream/kota/ -y 
>>> /var/www/html/stream/kota/v.low.m3u8
>> I did find the problem. The patch does not properly initialize 
>> hls->vtt_oformat (etc) if you provide the "-hls_segment_filename" 
>> parameter as I have done.
>> Deron
> I have attached new patch with correctly initializing the webvtt, can 
> you please check this patch again.
> -Anshul 

Besides needing some minor changes to apply to git head, this works.  
I'm not sure that the CC is 100% correct, but I have not sat down and 
compared to any other output yet. Certainly close, it just seems a 
little off and I can't put my finger on it. Not a timing issue, just 
seems jumpy and hard to read. Could just be the Apple player, or could 
be that the segmenter is not duplicating items that span multiple segments.

I do have a couple requests, but once this is accepted I think I can 
make the patch. One is the support m3u8 rename like the mpegts segments 
do, and the other is to support WebVTT segmenting on a subtitle only 
stream. I'd like to see/submit an audio only stream segmenter patch as 
well, but that is well outside this patch :-)

Either way, thanks!


More information about the ffmpeg-devel mailing list