[FFmpeg-trac] #6764(avcodec:new): encoding mono audio with opus codec segfaults

FFmpeg trac at avcodec.org
Sat Oct 21 20:28:07 EEST 2017

#6764: encoding mono audio with opus codec segfaults
             Reporter:  jcowgill  |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avcodec   |                  Version:  git-master
             Keywords:            |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
 Attempting to encode any mono audio with the opus codec (any mux) causes
 ffmpeg to segfault. This is a regression in 3.4 (3.3 works).

 gdb --args ./ffmpeg_g -f lavfi -i sine=d=0.1 -strict -2 -c:a opus -f null
 GNU gdb (Debian 7.12-6+b1)
 Copyright (C) 2016 Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later
 This is free software: you are free to change and redistribute it.
 There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
 and "show warranty" for details.
 This GDB was configured as "x86_64-linux-gnu".
 Type "show configuration" for configuration details.
 For bug reporting instructions, please see:
 Find the GDB manual and other documentation resources online at:
 For help, type "help".
 Type "apropos word" to search for commands related to "word"...
 Reading symbols from ./ffmpeg_g...done.
 (gdb) r
 Starting program: /home/jcowgill/deb-pkg/ffmpeg/upstream/ffmpeg_g -f lavfi
 -i sine=d=0.1 -strict -2 -c:a opus -f null /dev/null
 [Thread debugging using libthread_db enabled]
 Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
 ffmpeg version N-87950-g53eea3a569 Copyright (c) 2000-2017 the FFmpeg
   built with gcc 7 (Debian 7.2.0-11)
   configuration: --disable-doc --disable-optimizations --enable-debug
   libavutil      55. 79.100 / 55. 79.100
   libavcodec     57.108.101 / 57.108.101
   libavformat    57. 84.101 / 57. 84.101
   libavdevice    57. 11.101 / 57. 11.101
   libavfilter     6.108.100 /  6.108.100
   libswscale      4.  9.100 /  4.  9.100
   libswresample   2. 10.100 /  2. 10.100
 [New Thread 0x7ffff6e01700 (LWP 25127)]
 [New Thread 0x7ffff6600700 (LWP 25128)]
 [New Thread 0x7ffff5dff700 (LWP 25129)]
 [New Thread 0x7ffff55fe700 (LWP 25130)]
 Input #0, lavfi, from 'sine=d=0.1':
   Duration: N/A, start: 0.000000, bitrate: 705 kb/s
     Stream #0:0: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s
 Stream mapping:
   Stream #0:0 -> #0:0 (pcm_s16le (native) -> opus (native))
 Press [q] to stop, [?] for help
 [New Thread 0x7ffff4dfd700 (LWP 25131)]
 [New Thread 0x7ffff45fc700 (LWP 25132)]
 [New Thread 0x7ffff3dfb700 (LWP 25133)]
 [New Thread 0x7ffff35fa700 (LWP 25134)]
 Output #0, null, to '/dev/null':
     encoder         : Lavf57.84.101
     Stream #0:0: Audio: opus, 48000 Hz, mono, fltp, 48 kb/s
       encoder         : Lavc57.108.101 opus
 [Parsed_sine_0 @ 0x55555772de20] EOF timestamp not reliable

 Thread 1 "ffmpeg_g" received signal SIGSEGV, Segmentation fault.
 0x000055555652c855 in pvq_band_cost (pvq=0x555557770660, f=0x7ffff7e24040,
 rc=0x7fffffffd160, band=0, bits=0x7fffffffd15c, lambda=1)
     at libavcodec/opus_pvq.c:928
 928             err_y += (Y[i] - Y_orig[i])*(Y[i] - Y_orig[i]);
 (gdb) p Y
 $1 = (float *) 0x0
 (gdb) bt
 #0  0x000055555652c855 in pvq_band_cost (pvq=0x555557770660,
 f=0x7ffff7e24040, rc=0x7fffffffd160, band=0, bits=0x7fffffffd15c,
     at libavcodec/opus_pvq.c:928
 #1  0x0000555555dc7c42 in bands_dist (s=0x555557742e40, f=0x7ffff7e24040,
 total_dist=0x7fffffffd70c) at libavcodec/opusenc_psy.c:323
 #2  0x0000555555dc7d85 in celt_search_for_intensity (s=0x555557742e40,
 f=0x7ffff7e24040) at libavcodec/opusenc_psy.c:354
 #3  0x0000555555dc82b6 in ff_opus_psy_celt_frame_process
 (s=0x555557742e40, f=0x7ffff7e24040, index=0) at
 #4  0x0000555555dc3b3b in celt_encode_frame (s=0x555557742e20,
 rc=0x5555578cc780, f=0x7ffff7e24040, index=0) at libavcodec/opusenc.c:869
 #5  0x0000555555dc421b in opus_encode_frame (avctx=0x555557742940,
 avpkt=0x55555774c180, frame=0x0, got_packet_ptr=0x7fffffffd9ac)
     at libavcodec/opusenc.c:997
 #6  0x0000555555b297c8 in avcodec_encode_audio2 (avctx=0x555557742940,
 avpkt=0x55555774c180, frame=0x0, got_packet_ptr=0x7fffffffd9ac)
     at libavcodec/encode.c:198
 #7  0x0000555555b2a312 in do_encode (avctx=0x555557742940, frame=0x0,
 got_packet=0x7fffffffd9ac) at libavcodec/encode.c:381
 #8  0x0000555555b2a4be in avcodec_send_frame (avctx=0x555557742940,
 frame=0x0) at libavcodec/encode.c:427
 #9  0x0000555555636b74 in flush_encoders () at fftools/ffmpeg.c:1931
 #10 0x0000555555640d80 in transcode () at fftools/ffmpeg.c:4647
 #11 0x0000555555641447 in main (argc=12, argv=0x7fffffffe0f8) at

Ticket URL: <https://trac.ffmpeg.org/ticket/6764>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list