Opened 13 hours ago
#11330 new defect
-f pulse cuts last 2 secodns of audio
Reported by: | chuckwoodchuck | Owned by: | |
---|---|---|---|
Priority: | important | Component: | ffmpeg |
Version: | unspecified | Keywords: | pulseaudio |
Cc: | chuckwoodchuck | Blocked By: | |
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Summary of the bug:
-f pulse cuts last 2-3 seconds of audio when stopped by hitting "q"
How to reproduce:
I observed the behavior by recording screen with x11grab for video and pulse for audio. Last 2 seconds of audio are missing in every file.
$ ffmpeg -y -f x11grab -i "$DISPLAY" -f pulse -i alsa_output.pci-0000_05_00.6.analog-stereo.monitor /tmp/recording.mp4
I decided to split video and audio with -map to separate files to measure the stream length, and indeed audio is shorter:
$ ffmpeg -y -f x11grab -i "$DISPLAY" -f pulse -i alsa_output.pci-0000_05_00.6.analog-stereo.monitor -map 0:v /tmp/foo.mp4 -map 1:a /tmp/foo_audio.mp4 $ ffprobe /tmp/foo_audio.mp4 |& grep Duration Duration: 00:00:02.08, start: 0.000000, bitrate: 135 kb/s $ ffprobe /tmp/foo.mp4 |& grep Duration Duration: 00:00:04.37, start: 0.000000, bitrate: 912 kb/s
It's not an issue with x11grab. Passing an arbitrary file in its place (-i something/mp4) produces the same effect with the audio being 2-3 seconds shorter.
The audio is not cut when total recording length is specified beforehand, with -t 15. It happens only when "q" is hit.
The issue occurs on ffmpeg versions 5.1, 7.1 (Debian stable/sid) and recent builds, too. There's no difference between the pulseaudio or pipewire-pulse as the backend.