Opened 3 months ago

Last modified 3 months ago

#10834 new defect

ffmpeg does not gracefully stops when receiving SIGTERM

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

Description (last modified by razvan)

Ubuntu 22.04.3 LTS
I use ffmpeg to record sound from pulseaudio :

ffmpgeg -hide_banner -nostdin -nostats -thread_queue_size 9000 -use_wallclock_as_timestamps 1 -f pulse -ar 44100 -i recorded.app.monitor -acodec flac -ac 1 rec.flac

I use this to stop it :

kill -15 <ffmpeg pid>

This used to work gracefully with no error reported until around 2 month ago.

Now, first kill -15 <ffmpeg pid> doesn't do anything, even if I wait 60 seconds. Nothing new is printed in stdout / log
After second kill -15 <ffmpeg pid> these errors are displayed:

[aost#0:0/flac @ 0x557dba199800] Error submitting a packet to the muxer: Immediate exit requested
[aost#0:0/flac @ 0x557dba199800] Error submitting a packet to the muxer: Immediate exit requested
[out#0/flac @ 0x557dba1984c0] Error muxing a packet
[out#0/flac @ 0x557dba1984c0] Task finished with error code: -1414092869 (Immediate exit requested)
[out#0/flac @ 0x557dba1984c0] Terminating thread with return code -1414092869 (Immediate exit requested)
[out#0/flac @ 0x557dba1984c0] Error writing trailer: Immediate exit requested
[out#0/flac @ 0x557dba1984c0] Error closing file: Immediate exit requested
[out#0/flac @ 0x557dba1984c0] video:0kB audio:3323kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
size=    3072kB time=00:01:19.92 bitrate= 314.9kbits/s speed=   1x    
Exiting normally, received signal 15.

ffmpeg compiled from latest git master

ffmpeg version N-113445-ge0da916b8f-30.ian.2024 Copyright (c) 2000-2024 the FFmpeg developers
built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
configuration: --prefix=/dev/shm/ffbuild --pkg-config-flags=--static --extra-cflags=-I/dev/shm/ffbuild/include --extra-ldflags=-L/dev/shm/ffbuild/lib --extra-ldflags=-L/usr/lib/x86_64-linux-gnu --extra-libs='-lpthread -lm' --ld=g++ --bindir=/dev/shm/ffbin --extra-version=30.ian.2024 --arch=x86_64 --enable-gpl --enable-version3 --enable-gnutls --enable-libass --enable-libfreetype --enable-libfontconfig --enable-libcaca --enable-libcodec2 --enable-libmp3lame --enable-libvorbis --enable-opengl --enable-libpulse --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-libopus --enable-libvpx --enable-libdav1d --enable-libvmaf --enable-libxvid --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libtheora --enable-libvidstab --enable-libxml2 --enable-lv2 --enable-libxcb --enable-libxcb-shm --enable-libzmq --enable-libzimg --enable-nonfree
libavutil      58. 36.101 / 58. 36.101
libavcodec     60. 38.100 / 60. 38.100
libavformat    60. 20.100 / 60. 20.100
libavdevice    60.  4.100 / 60.  4.100
libavfilter     9. 17.100 /  9. 17.100
libswscale      7.  6.100 /  7.  6.100
libswresample   4. 13.100 /  4. 13.100
libpostproc    57.  4.100 / 57.  4.100

full ffmpeg report with level 32

ffmpeg started on 2024-01-30 at 14:40:43
Report written to "30.ian-14.40.43.log"
Log level: 32
Command line:
ffmpeg -hide_banner -nostdin -nostats -thread_queue_size 9000 -use_wallclock_as_timestamps 1 -f pulse -ar 44100 -i recorded.app.monitor -acodec flac -ac 1 30.ian-14.40.43.flac
[aist#0:0/pcm_s16le @ 0x557dba198340] Guessed Channel Layout: stereo
Input #0, pulse, from 'recorded.app.monitor':
  Duration: N/A, start: 1706618443.679145, bitrate: 1411 kb/s
  Stream #0:0: Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (pcm_s16le (native) -> flac (native))
Output #0, flac, to '30.ian-14.40.43.flac':
  Metadata:
    encoder         : Lavf60.20.100
  Stream #0:0: Audio: flac, 44100 Hz, mono, s16, 128 kb/s
      Metadata:
        encoder         : Lavc60.38.100 flac
[aost#0:0/flac @ 0x557dba199800] Error submitting a packet to the muxer: Immediate exit requested
[aost#0:0/flac @ 0x557dba199800] Error submitting a packet to the muxer: Immediate exit requested
[out#0/flac @ 0x557dba1984c0] Error muxing a packet
[out#0/flac @ 0x557dba1984c0] Task finished with error code: -1414092869 (Immediate exit requested)
[out#0/flac @ 0x557dba1984c0] Terminating thread with return code -1414092869 (Immediate exit requested)
[out#0/flac @ 0x557dba1984c0] Error writing trailer: Immediate exit requested
[out#0/flac @ 0x557dba1984c0] Error closing file: Immediate exit requested
[out#0/flac @ 0x557dba1984c0] video:0kB audio:3323kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
size=    3072kB time=00:01:19.92 bitrate= 314.9kbits/s speed=   1x    
Exiting normally, received signal 15.

Thanks
Razvan

Change History (1)

comment:1 by razvan, 3 months ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.