Opened 20 months ago

Last modified 6 months ago

#9719 new defect

FFmpeg HLS output with subtitles results in segmentation fault starting from 5.x

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

Description (last modified by wout)

I am trying to create a HLS output for multiple video, audio and subtitles. I map the lowest video stream (0:v:2) multiple times to allow using it in the var_stream_map for subtitle only entries. This is needed because I cannot specify an entry without a video (for example "s:0,name:en,sgroup:subtitle,language:en,default:NO" is not allowed)

ffmpeg -re -fflags +genpts -i /path/to/multilang.mp4 -i /path/to/en.vtt -i /path/to/it.vtt -i /path/to/de.vtt -i /path/to/ru.vtt -i /path/to/fa.vtt -i /path/to/da.vtt -i /path/to/es.vtt -i /path/to/hr.vtt -c:a copy -c:v copy -c:s webvtt  -map 1:s:0 -map 2:s:0 -map 3:s:0 -map 4:s:0 -map 5:s:0 -map 6:s:0 -map 7:s:0 -map 8:s:0 -map 0:v:2 -map 0:v:2 -map 0:v:2 -map 0:v:2 -map 0:v:2 -map 0:v:2 -map 0:v:2 -map 0:v:2 -map 0:a:0 -map 0:a:1 -map 0:a:2 -map 0:a:3 -map 0:a:4 -map 0:a:5 -map 0:a:6 -map 0:v:0 -map 0:v:1 -map 0:v:2 -map 0:v:3 -map 0:v:4 -max_interleave_delta 10000000 -muxdelay 0 -f hls -var_stream_map "a:0,name:en_audio,agroup:audio,language:en,default:YES a:1,name:it_audio,agroup:audio,language:it,default:NO a:2,name:ru_audio,agroup:audio,language:ru,default:NO a:3,name:ar_audio,agroup:audio,language:ar,default:NO a:4,name:da_audio,agroup:audio,language:da,default:NO a:5,name:sw_audio,agroup:audio,language:sw,default:NO a:6,name:zh_audio,agroup:audio,language:zh,default:NO v:0,name:en,s:0,sgroup:subtitle,language:en,default:NO v:1,name:it,s:1,sgroup:subtitle,language:it,default:NO v:2,name:de,s:2,sgroup:subtitle,language:de,default:NO v:3,name:ru,s:3,sgroup:subtitle,language:ru,default:NO v:4,name:fa,s:4,sgroup:subtitle,language:fa,default:NO v:5,name:da,s:5,sgroup:subtitle,language:da,default:NO v:6,name:es,s:6,sgroup:subtitle,language:es,default:NO v:7,name:hr,s:7,sgroup:subtitle,language:hr,default:NO v:8,name:1080p,agroup:audio v:9,name:720p,agroup:audio v:10,name:480p,agroup:audio v:11,name:360p,agroup:audio v:12,name:240p,agroup:audio" -master_pl_name master.m3u8 -hls_delete_threshold 4 -hls_segment_filename "/path/to/hls/%v_%d.ts" -hls_start_number_source datetime -hls_time 10 -hls_init_time 10 -hls_list_size 6 -hls_flags delete_segments+independent_segments+round_durations "/path/to/hls/%v.m3u8" 

This worked perfectly in previous FFmpeg versions, but starting from 5.x
this results in a segmentation fault:

Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x000056073c3a6edd in ff_write_chained (dst=0x56073f3eda40, dst_stream=-1, pkt=0x56073ea5d4c0, src=<optimized out>, interleave=0) at libavformat/mux.c:1310
(gdb) backtrace
#0  0x000055ec0a65f9ed in ff_write_chained (dst=0x55ec0d193800, dst_stream=-8, pkt=0x55ec0ceda380, src=<optimized out>, interleave=0) at libavformat/mux.c:1363
#1  0x000055ec0a5e87fb in hls_write_packet (s=<optimized out>, pkt=0x55ec0ceda380) at libavformat/hlsenc.c:2669
#2  0x000055ec0a65c864 in write_packet (s=s@entry=0x55ec0d1a3900, pkt=pkt@entry=0x55ec0ceda380) at libavformat/mux.c:771
#3  0x000055ec0a65cd7b in interleaved_write_packet (has_packet=0, flush=<optimized out>, pkt=<optimized out>, s=<optimized out>) at libavformat/mux.c:1145
#4  write_packet_common (s=s@entry=0x55ec0d1a3900, st=<optimized out>, pkt=pkt@entry=0x55ec0ceda380, interleaved=interleaved@entry=1) at libavformat/mux.c:1170
#5  0x000055ec0a65df5b in write_packets_common (s=s@entry=0x55ec0d1a3900, pkt=pkt@entry=0x55ec0ceda380, interleaved=interleaved@entry=1) at libavformat/mux.c:1230
#6  0x000055ec0a65f65a in write_packets_common (interleaved=1, pkt=0x55ec0ceda380, s=0x55ec0d1a3900) at libavformat/mux.c:1214
#7  av_interleaved_write_frame (s=s@entry=0x55ec0d1a3900, pkt=pkt@entry=0x55ec0ceda380) at libavformat/mux.c:1286
#8  0x000055ec0a2b53f0 in of_write_packet (of=<optimized out>, pkt=0x55ec0ceda380, ost=0x55ec0ced9940, unqueue=<optimized out>) at fftools/ffmpeg_mux.c:181
#9  0x000055ec0a2d4e88 in do_streamcopy (pkt=<optimized out>, ost=<optimized out>, ist=<optimized out>) at fftools/ffmpeg.c:1938
#10 process_input_packet (ist=<optimized out>, pkt=<optimized out>, no_eof=<optimized out>) at fftools/ffmpeg.c:2601
#11 0x000055ec0a2d7666 in process_input (file_index=<optimized out>) at fftools/ffmpeg.c:4225
#12 transcode_step () at fftools/ffmpeg.c:4365
#13 transcode () at fftools/ffmpeg.c:4419
#14 0x000055ec0a2b0cbe in main (argc=109, argv=0x7ffd7456d108) at fftools/ffmpeg.c:4625

It is caused by commit c64d56a2f53455f803456811873ff08fce98e122 as reverting it resolves the issue.

Change History (2)

comment:1 by wout, 19 months ago

Description: modified (diff)
Version: unspecifiedgit-master

comment:2 by ffmpeg.golden, 6 months ago

Hello, any progerss on this issue ? We are stuck on using 4.x version of FFMPEG due to this bug.

Note: See TracTickets for help on using tickets.