Opened 2 years ago

Last modified 21 months ago

#10440 new defect

Segmentation fault (core dumped) when trying to generate hls output from .mp4 file

Reported by: ffmpeg.golden Owned by:
Priority: important Component: undetermined
Version: 6.0 Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description (last modified by ffmpeg.golden)

Summary of the bug:

I have a vod file and related caption file. I am trying to package them as a live HLS stream with following command. It fails with error Segmentation fault. This should be working fine and produce hls output on disk. This is working fine in version 4.4.1 so something along the line broke it in 5.0.

How to reproduce:

ffmpeg -re -i keynote.mp4 -i english.vtt -c copy \ -map 1:s:0 -c:s webvtt \ -filter_complex "[0:v]split=3[v1][v2][v3]; [v1]copy[v1out]; [v2]scale=w=1280:h=720[v2out]; [v3]scale=w=640:h=360[v3out]" \ -map [v1out] -c:v:0 libx264 -x264-params "nal-hrd=cbr:force-cfr=1" -b:v:0 2M -maxrate:v:0 2M -minrate:v:0 2M -bufsize:v:0 10M -preset fast -g 48 -sc_threshold 0 -keyint_min 48 \ -map [v2out] -c:v:1 libx264 -x264-params "nal-hrd=cbr:force-cfr=1" -b:v:1 1M -maxrate:v:1 1M -minrate:v:1 1M -bufsize:v:1 1M -preset fast -g 48 -sc_threshold 0 -keyint_min 48 \ -map [v3out] -c:v:2 libx264 -x264-params "nal-hrd=cbr:force-cfr=1" -b:v:2 500K -maxrate:v:2 500K -minrate:v:2 500K -bufsize:v:2 500K -preset fast -g 48 -sc_threshold 0 -keyint_min 48 \ -map a:0 -c:a:0 aac -b:a:0 96k -ac 2 -map a:0 -c:a:1 aac -b:a:1 96k -ac 2 -map a:0 -c:a:2 aac -b:a:2 48k -ac 2 \ -avoid_negative_ts 1 -f hls -hls_time 6 -hls_list_size 10 \ -hls_flags independent_segments -hls_segment_type mpegts -hls_segment_filename stream_%v_data%02d.ts -master_pl_name master.m3u8 \ -var_stream_map "v:0,a:0,s:0,sgroup:subtitle v:1,a:1 v:2,a:2" \ stream_%v.m3u8 

Output:

ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 10 (GCC) configuration: --prefix=/opt/ --libdir=/opt/lib64 --disable-debug --enable-gpl --enable-libx264 --enable-libmp3lame --enable-hardcoded-tables libavutil 58. 2.100 / 58. 2.100 libavcodec 60. 3.100 / 60. 3.100 libavformat 60. 3.100 / 60. 3.100 libavdevice 60. 1.100 / 60. 1.100 libavfilter 9. 3.100 / 9. 3.100 libswscale 7. 1.100 / 7. 1.100 libswresample 4. 10.100 / 4. 10.100 libpostproc 57. 1.100 / 57. 1.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'keynote.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2023-05-14T00:30:07.000000Z Duration: 02:05:19.83, start: 0.000000, bitrate: 884 kb/s Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 753 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default) Metadata: creation_time : 2023-05-14T00:30:07.000000Z handler_name : ISO Media file produced by Google Inc. Created on: 05/13/2023. vendor_id : [0][0][0][0] Stream #0:1[0x2](eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: creation_time : 2023-05-14T00:30:07.000000Z handler_name : ISO Media file produced by Google Inc. Created on: 05/13/2023. vendor_id : [0][0][0][0] Input #1, webvtt, from 'english.vtt': Duration: N/A, bitrate: N/A Stream #1:0: Subtitle: webvtt Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 0, only the last option '-c:s webvtt' will be used. Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 1, only the last option '-c:v:0 libx264' will be used. Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 2, only the last option '-c:v:1 libx264' will be used. Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 3, only the last option '-c:v:2 libx264' will be used. Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 4, only the last option '-c:a:0 aac' will be used. Multiple -ac options specified for stream 4, only the last option '-ac 2' will be used. Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 5, only the last option '-c:a:1 aac' will be used. Multiple -ac options specified for stream 5, only the last option '-ac 2' will be used. Multiple -c, -codec, -acodec, -vcodec, -scodec or -dcodec options specified for stream 6, only the last option '-c:a:2 aac' will be used. Multiple -ac options specified for stream 6, only the last option '-ac 2' will be used. Stream mapping: Stream #0:0 (h264) -> split:default (graph 0) Stream #1:0 -> #0:0 (webvtt (native) -> webvtt (native)) copy:default (graph 0) -> Stream #0:1 (libx264) scale:default (graph 0) -> Stream #0:2 (libx264) scale:default (graph 0) -> Stream #0:3 (libx264) Stream #0:1 -> #0:4 (aac (native) -> aac (native)) Stream #0:1 -> #0:5 (aac (native) -> aac (native)) Stream #0:1 -> #0:6 (aac (native) -> aac (native)) Press [q] to stop, [?] for help [libx264 @ 0x3efe000] using SAR=1/1 [libx264 @ 0x3efe000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512 [libx264 @ 0x3efe000] profile High, level 3.1 [libx264 @ 0x3efe000] 264 - core 152 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=22 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=48 keyint_min=25 scenecut=0 intra_refresh=0 rc_lookahead=30 rc=cbr mbtree=1 bitrate=2000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=2000 vbv_bufsize=10000 nal_hrd=cbr filler=1 ip_ratio=1.40 aq=1:1.00 [libx264 @ 0x3f00640] using SAR=1/1 [libx264 @ 0x3f00640] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512 [libx264 @ 0x3f00640] profile High, level 3.1 [libx264 @ 0x3f00640] 264 - core 152 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=22 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=48 keyint_min=25 scenecut=0 intra_refresh=0 rc_lookahead=30 rc=cbr mbtree=1 bitrate=1000 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=1000 vbv_bufsize=1000 nal_hrd=cbr filler=1 ip_ratio=1.40 aq=1:1.00 [libx264 @ 0x3f02540] using SAR=1/1 [libx264 @ 0x3f02540] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 AVX512 [libx264 @ 0x3f02540] profile High, level 3.0 [libx264 @ 0x3f02540] 264 - core 152 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=2 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=11 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=48 keyint_min=25 scenecut=0 intra_refresh=0 rc_lookahead=30 rc=cbr mbtree=1 bitrate=500 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 vbv_maxrate=500 vbv_bufsize=500 nal_hrd=cbr filler=1 ip_ratio=1.40 aq=1:1.00 [hls @ 0x3ef9400] Opening 'stream_00.vtt' for writing Output #0, hls, to 'stream_%v.m3u8': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 encoder : Lavf60.3.100 Stream #0:0: Subtitle: webvtt Metadata: encoder : Lavc60.3.100 webvtt Stream #0:1: Video: h264, yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 2000 kb/s, 29.97 fps, 90k tbn (default) Metadata: encoder : Lavc60.3.100 libx264 Side data: cpb: bitrate max/min/avg: 2000000/0/2000000 buffer size: 10000000 vbv_delay: N/A Stream #0:2: Video: h264, yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 1000 kb/s, 29.97 fps, 90k tbn Metadata: encoder : Lavc60.3.100 libx264 Side data: cpb: bitrate max/min/avg: 1000000/0/1000000 buffer size: 1000000 vbv_delay: N/A Stream #0:3: Video: h264, yuv420p(tv, bt709, progressive), 640x360 [SAR 1:1 DAR 16:9], q=2-31, 500 kb/s, 29.97 fps, 90k tbn Metadata: encoder : Lavc60.3.100 libx264 Side data: cpb: bitrate max/min/avg: 500000/0/500000 buffer size: 500000 vbv_delay: N/A Stream #0:4(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 96 kb/s (default) Metadata: creation_time : 2023-05-14T00:30:07.000000Z handler_name : ISO Media file produced by Google Inc. Created on: 05/13/2023. vendor_id : [0][0][0][0] encoder : Lavc60.3.100 aac Stream #0:5(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 96 kb/s (default) Metadata: creation_time : 2023-05-14T00:30:07.000000Z handler_name : ISO Media file produced by Google Inc. Created on: 05/13/2023. vendor_id : [0][0][0][0] encoder : Lavc60.3.100 aac Stream #0:6(eng): Audio: aac (LC), 44100 Hz, stereo, fltp, 48 kb/s (default) Metadata: creation_time : 2023-05-14T00:30:07.000000Z handler_name : ISO Media file produced by Google Inc. Created on: 05/13/2023. vendor_id : [0][0][0][0] encoder : Lavc60.3.100 aac Segmentation fault (core dumped)q=21.0 size=N/A time=00:00:04.59 bitrate=N/A speed=2.29x 

Source Files:

Download Google IO 2023 youtube video and subtitles using following.
https://ssyoutube.com/en111ZX/youtube-video-downloader
https://downsub.com/

Change History (7)

comment:1 by ffmpeg.golden, 2 years ago

Description: modified (diff)

comment:2 by ffmpeg.golden, 2 years ago

Description: modified (diff)

comment:3 by ffmpeg.golden, 2 years ago

Description: modified (diff)

comment:4 by ffmpeg.golden, 2 years ago

Description: modified (diff)

comment:5 by Leo Izen, 2 years ago

Priority: criticalimportant

comment:6 by piusbnsl, 2 years ago

I am getting the same error. Following is the command I used -

ffmpeg \ -report \ -i fireship-rust.mp4 \ -i fireship-rust.vtt \ -filter_complex "[0:v]scale=1280:720[vyuv];[vyuv]split=2[v0][vtemp1];[vtemp1]scale=w=960:h=540[v1];" \ -map "[v0]" -map "[v1]" -map 0:a -map 0:a -map 1:s -map 1:s \ -b:v:0 3500k -maxrate:v:0 3500k -bufsize:v:0 3500k \ -b:v:1 1690k -maxrate:v:1 1690k -bufsize:v:1 1690k \ -b:a 128k \ -c:s webvtt \ -c:v libx264 \ -c:a aac \ -f hls \ -var_stream_map "v:0,a:0,s:0,sgroup:subtitle v:1,a:1,s:1,sgroup:subtitle" \ -master_pl_name master.m3u8 \ stream_%v/stream.m3u8 

I am getting similar logs as above. I have pasted the whole report here - https://pastebin.com/mfqL24EZ

I have tried multiple variations of the above command and am not able to get the subtitles working with multiple streams. It works fine for single stream -

ffmpeg \ -i fireship-rust.mp4 \ -i fireship-rust.vtt \ -filter_complex "[0:v]scale=1280:720[v0];" \ -map "[v0]" -map 0:a -map 1:s \ -b:v:0 3500k -maxrate:v:0 3500k -bufsize:v:0 3500k \ -b:a 128k \ -c:s webvtt \ -c:v libx264 \ -c:a aac \ -f hls \ -var_stream_map "v:0,a:0,s:0,sgroup:subtitle" \ -master_pl_name master.m3u8 \ stream_%v/stream.m3u8 

or

ffmpeg \ -i fireship-rust.mp4 \ -i fireship-rust.vtt \ -filter_complex "[0:v]scale=1280:720[vyuv];[vyuv]split=2[v0][vtemp1];[vtemp1]scale=w=960:h=540[v1];" \ -map "[v0]" -map 0:a -map 1:s \ -b:a 128k \ -c:s webvtt \ -c:v libx264 \ -c:a aac \ -f hls \ -var_stream_map "v:0,a:0,s:0,sgroup:subtitle" \ -master_pl_name master.m3u8 \ -hls_time 2 \ -hls_segment_filename stream_%v/data%03d.ts \ stream_%v/stream.m3u8 \ -map "[v1]" -map 0:a \ output.mkv 

Let me know if you need my help anyhow debugging this.

comment:7 by ffmpeg.golden, 21 months ago

checking of any progress here

Note: See TracTickets for help on using tickets.