On Wed, Jan 12, 2022 at 11:09:09PM -0300, James Almer wrote: > Signed-off-by: James Almer > --- > fftools/cmdutils.c | 42 +++++++++++++++--------- > fftools/cmdutils.h | 8 ----- > fftools/ffmpeg.c | 47 ++++++++++++++++---------- > fftools/ffmpeg.h | 7 ++-- > fftools/ffmpeg_filter.c | 52 ++++++++++++++++++++++------- > fftools/ffmpeg_opt.c | 62 ++++++++++++++++++++++++++++++----- > tests/fate/aac.mak | 2 +- > tests/fate/lavf-container.mak | 2 +- > 8 files changed, 155 insertions(+), 67 deletions(-) This or a prior patch introduces crashes (it bisected to this but this is my 2nd testcase the first did not reproduce reliably at all) Thread 1 "ffmpeg_g" received signal SIGSEGV, Segmentation fault. 0x00005555566ed811 in av_vlog (avcl=0x5555577400c0, level=24, fmt=0x5555568249e8 "%d frames left in the queue on closing\n", vl=0x7fffffffda50) at libavutil/log.c:428 428 if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) && (gdb) bt #0 0x00005555566ed811 in av_vlog (avcl=0x5555577400c0, level=24, fmt=0x5555568249e8 "%d frames left in the queue on closing\n", vl=0x7fffffffda50) at libavutil/log.c:428 #1 0x00005555566ed6bd in av_log (avcl=0x5555577400c0, level=24, fmt=0x5555568249e8 "%d frames left in the queue on closing\n") at libavutil/log.c:411 #2 0x0000555555c320b9 in ff_af_queue_close (afq=0x5555576c47c8) at libavcodec/audio_frame_queue.c:39 #3 0x0000555555e84c06 in mp3lame_encode_close (avctx=0x5555576bf180) at libavcodec/libmp3lame.c:86 #4 0x0000555555c373f7 in avcodec_close (avctx=0x5555576bf180) at libavcodec/avcodec.c:489 #5 0x0000555555f7feab in avcodec_free_context (pavctx=0x5555576a8858) at libavcodec/options.c:163 #6 0x000055555569cfe3 in ffmpeg_cleanup (ret=1) at fftools/ffmpeg.c:608 #7 0x0000555555694817 in exit_program (ret=1) at fftools/cmdutils.c:131 #8 0x000055555569ef1f in do_audio_out (of=0x5555576ae2c0, ost=0x5555576a8800, frame=0x5555576bf580) at fftools/ffmpeg.c:1056 #9 0x00005555556a117a in reap_filters (flush=0) at fftools/ffmpeg.c:1546 #10 0x00005555556ad8e5 in transcode_step () at fftools/ffmpeg.c:4643 #11 0x00005555556ad9e7 in transcode () at fftools/ffmpeg.c:4687 #12 0x00005555556ae45c in main (argc=12, argv=0x7fffffffe1c8) at fftools/ffmpeg.c:4903 (gdb) print avc->version Cannot access memory at address 0xc1528eb7c0ea0157 make -j32 && gdb --args ./ffmpeg_g -ss 8 -i NeroRecodeSample.mp4 -bitexact -t 3 -filter_complex '[0:2]scale=720:576[v];[v][0:5]overlay' -y file-whitesubs.avi it appears this file is at: https://samples.ffmpeg.org/MPEG-4/NeroRecodeSample-MP4/ Press [q] to stop, [?] for help [aac @ 0x16fb3540] This stream seems to incorrectly report its last channel as SCE[1], mapping to LFE[0] [aac @ 0x16fb3540] env_facs_q 253 is invalid ==21617== at 0x12A09F8: VALGRIND_PRINTF_BACKTRACE (valgrind.h:6303) ==21617== by 0x12A15B6: av_log_default_callback (log.c:397) ==21617== by 0x12A185D: av_vlog (log.c:432) ==21617== by 0x12A16BC: av_log (log.c:411) ==21617== by 0xEED8B6: read_sbr_envelope (aacsbr_template.c:865) ==21617== by 0xEEE22F: read_sbr_single_channel_element (aacsbr_template.c:983) ==21617== by 0xEEE762: read_sbr_data (aacsbr_template.c:1055) ==21617== by 0xEEEAFD: ff_decode_sbr_extension (aacsbr_template.c:1144) ==21617== by 0xECD082: decode_extension_payload (aacdec_template.c:2582) ==21617== by 0xED029B: aac_decode_frame_int (aacdec_template.c:3372) ==21617== by 0xED0842: aac_decode_frame (aacdec_template.c:3500) ==21617== by 0x8ABF66: decode_simple_internal (decode.c:329) ==21617== by 0x8ACB62: decode_simple_receive_frame (decode.c:528) ==21617== by 0x8ACC5C: decode_receive_frame_internal (decode.c:548) ==21617== by 0x8ACF38: avcodec_send_packet (decode.c:615) ==21617== by 0x258160: decode (ffmpeg.c:2276) ==21617== by 0x258354: decode_audio (ffmpeg.c:2319) ==21617== by 0x259949: process_input_packet (ffmpeg.c:2638) ==21617== by 0x26138A: process_input (ffmpeg.c:4493) ==21617== by 0x26187E: transcode_step (ffmpeg.c:4633) [aac @ 0x16fb3540] env_facs_q 252 is invalid ==21617== at 0x12A09F8: VALGRIND_PRINTF_BACKTRACE (valgrind.h:6303) ==21617== by 0x12A15B6: av_log_default_callback (log.c:397) ==21617== by 0x12A185D: av_vlog (log.c:432) ==21617== by 0x12A16BC: av_log (log.c:411) ==21617== by 0xEED8B6: read_sbr_envelope (aacsbr_template.c:865) ==21617== by 0xEEE5AC: read_sbr_channel_pair_element (aacsbr_template.c:1028) ==21617== by 0xEEE7A7: read_sbr_data (aacsbr_template.c:1060) ==21617== by 0xEEEAFD: ff_decode_sbr_extension (aacsbr_template.c:1144) ==21617== by 0xECD082: decode_extension_payload (aacdec_template.c:2582) ==21617== by 0xED029B: aac_decode_frame_int (aacdec_template.c:3372) ==21617== by 0xED0842: aac_decode_frame (aacdec_template.c:3500) ==21617== by 0x8ABF66: decode_simple_internal (decode.c:329) ==21617== by 0x8ACB62: decode_simple_receive_frame (decode.c:528) ==21617== by 0x8ACC5C: decode_receive_frame_internal (decode.c:548) ==21617== by 0x8ACF38: avcodec_send_packet (decode.c:615) ==21617== by 0x258160: decode (ffmpeg.c:2276) ==21617== by 0x258354: decode_audio (ffmpeg.c:2319) ==21617== by 0x259949: process_input_packet (ffmpeg.c:2638) ==21617== by 0x26138A: process_input (ffmpeg.c:4493) ==21617== by 0x26187E: transcode_step (ffmpeg.c:4633) [aac @ 0x16fb3540] noise_facs_q 255 is invalid ==21617== at 0x12A09F8: VALGRIND_PRINTF_BACKTRACE (valgrind.h:6303) ==21617== by 0x12A15B6: av_log_default_callback (log.c:397) ==21617== by 0x12A185D: av_vlog (log.c:432) ==21617== by 0x12A16BC: av_log (log.c:411) ==21617== by 0xEEDE4D: read_sbr_noise (aacsbr_template.c:923) ==21617== by 0xEEE615: read_sbr_channel_pair_element (aacsbr_template.c:1032) ==21617== by 0xEEE7A7: read_sbr_data (aacsbr_template.c:1060) ==21617== by 0xEEEAFD: ff_decode_sbr_extension (aacsbr_template.c:1144) ==21617== by 0xECD082: decode_extension_payload (aacdec_template.c:2582) ==21617== by 0xED029B: aac_decode_frame_int (aacdec_template.c:3372) ==21617== by 0xED0842: aac_decode_frame (aacdec_template.c:3500) ==21617== by 0x8ABF66: decode_simple_internal (decode.c:329) ==21617== by 0x8ACB62: decode_simple_receive_frame (decode.c:528) ==21617== by 0x8ACC5C: decode_receive_frame_internal (decode.c:548) ==21617== by 0x8ACF38: avcodec_send_packet (decode.c:615) ==21617== by 0x258160: decode (ffmpeg.c:2276) ==21617== by 0x258354: decode_audio (ffmpeg.c:2319) ==21617== by 0x259949: process_input_packet (ffmpeg.c:2638) ==21617== by 0x26138A: process_input (ffmpeg.c:4493) ==21617== by 0x26187E: transcode_step (ffmpeg.c:4633) Audio encoding failed ==21617== at 0x12A09F8: VALGRIND_PRINTF_BACKTRACE (valgrind.h:6303) ==21617== by 0x12A15B6: av_log_default_callback (log.c:397) ==21617== by 0x12A185D: av_vlog (log.c:432) ==21617== by 0x12A16BC: av_log (log.c:411) ==21617== by 0x252F14: do_audio_out (ffmpeg.c:1055) ==21617== by 0x255179: reap_filters (ffmpeg.c:1546) ==21617== by 0x2618E4: transcode_step (ffmpeg.c:4643) ==21617== by 0x2619E6: transcode (ffmpeg.c:4687) ==21617== by 0x26245B: main (ffmpeg.c:4903) ==21617== Invalid read of size 4 ==21617== at 0x12A1811: av_vlog (log.c:428) ==21617== by 0x12A16BC: av_log (log.c:411) ==21617== by 0x7E60B8: ff_af_queue_close (audio_frame_queue.c:39) ==21617== by 0xA38C05: mp3lame_encode_close (libmp3lame.c:86) ==21617== by 0x7EB3F6: avcodec_close (avcodec.c:489) ==21617== by 0xB33EAA: avcodec_free_context (options.c:163) ==21617== by 0x250FE2: ffmpeg_cleanup (ffmpeg.c:608) ==21617== by 0x248816: exit_program (cmdutils.c:131) ==21617== by 0x252F1E: do_audio_out (ffmpeg.c:1056) ==21617== by 0x255179: reap_filters (ffmpeg.c:1546) ==21617== by 0x2618E4: transcode_step (ffmpeg.c:4643) ==21617== by 0x2619E6: transcode (ffmpeg.c:4687) ==21617== by 0x26245B: main (ffmpeg.c:4903) ==21617== Address 0xc1528eb7c0ea0157 is not stack'd, malloc'd or (recently) free'd ==21617== ==21617== ==21617== Process terminating with default action of signal 11 (SIGSEGV) ==21617== General Protection Fault ==21617== at 0x12A1811: av_vlog (log.c:428) ==21617== by 0x12A16BC: av_log (log.c:411) ==21617== by 0x7E60B8: ff_af_queue_close (audio_frame_queue.c:39) ==21617== by 0xA38C05: mp3lame_encode_close (libmp3lame.c:86) ==21617== by 0x7EB3F6: avcodec_close (avcodec.c:489) ==21617== by 0xB33EAA: avcodec_free_context (options.c:163) ==21617== by 0x250FE2: ffmpeg_cleanup (ffmpeg.c:608) ==21617== by 0x248816: exit_program (cmdutils.c:131) ==21617== by 0x252F1E: do_audio_out (ffmpeg.c:1056) ==21617== by 0x255179: reap_filters (ffmpeg.c:1546) ==21617== by 0x2618E4: transcode_step (ffmpeg.c:4643) ==21617== by 0x2619E6: transcode (ffmpeg.c:4687) ==21617== by 0x26245B: main (ffmpeg.c:4903) ==21617== ==21617== HEAP SUMMARY: ==21617== in use at exit: 3,463,746 bytes in 473 blocks ==21617== total heap usage: 1,923 allocs, 1,450 frees, 9,590,510 bytes allocated ==21617== ==21617== 5,888 bytes in 16 blocks are possibly lost in loss record 159 of 180 ==21617== at 0x4C33B25: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==21617== by 0x4013646: allocate_dtv (dl-tls.c:286) ==21617== by 0x4013646: _dl_allocate_tls (dl-tls.c:530) ==21617== by 0xCB4F227: allocate_stack (allocatestack.c:627) ==21617== by 0xCB4F227: pthread_create@@GLIBC_2.2.5 (pthread_create.c:644) ==21617== by 0xB6C3FB: init_thread (pthread_frame.c:842) ==21617== by 0xB6C625: ff_frame_thread_init (pthread_frame.c:898) ==21617== by 0xB69E97: ff_thread_init (pthread.c:81) ==21617== by 0x7EAC52: avcodec_open2 (avcodec.c:330) ==21617== by 0x25AA65: init_input_stream (ffmpeg.c:2922) ==21617== by 0x25D48C: transcode_init (ffmpeg.c:3634) ==21617== by 0x261924: transcode (ffmpeg.c:4658) ==21617== by 0x26245B: main (ffmpeg.c:4903) ==21617== ==21617== LEAK SUMMARY: ==21617== definitely lost: 0 bytes in 0 blocks ==21617== indirectly lost: 0 bytes in 0 blocks ==21617== possibly lost: 5,888 bytes in 16 blocks ==21617== still reachable: 3,457,858 bytes in 457 blocks ==21617== suppressed: 0 bytes in 0 blocks ==21617== Reachable blocks (those to which a pointer was found) are not shown. ==21617== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==21617== ==21617== For counts of detected and suppressed errors, rerun with: -v ==21617== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0) thx [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB In a rich man's house there is no place to spit but his face. -- Diogenes of Sinope