[FFmpeg-trac] #1478(undetermined:new): PulseAudio input performance regression

FFmpeg trac at avcodec.org
Fri Jun 22 18:14:38 CEST 2012

#1478: PulseAudio input performance regression
             Reporter:               |                     Type:  defect
  GreatEmerald                       |                 Priority:  important
               Status:  new          |                  Version:  git-
            Component:               |  master
  undetermined                       |               Blocked By:
             Keywords:               |  Reproduced by developer:  0
             Blocking:               |
Analyzed by developer:  0            |
 Summary of the bug:

 There has been a regression that severely reduces the performance of
 recording input !PulseAudio streams using the ''pulse'' input device.
 Before the regression, I could record one audio and one video stream at a
 constant 30 frames per second (capped), but after the regression the
 recording keeps dropping frames, resulting in an unacceptable 25 FPS on
 average recording performance. It doesn't matter what video or audio
 codecs are in use, the result is always the same.

 In order to identify where the problem lies, I used git bisect to see what
 was the regressing commit. Unfortunately, the last bisected commits didn't
 build properly (configure doesn't give me all of the options that I use
 for building a complete FFmpeg, and even with some of the options
 disabled, it only builds the libraries, and not the binary, which doesn't
 allow me to test whether the regression is still there or not). Still,
 bisecting allowed me to narrow down the list to these commits:


 More precisely, commit 4778783160fb8d7aa39dafdabc756f1691b830f7 is the
 first confirmed bad commit, while commit
 dcd207c4cbcd9dd72b73e5b544c055b29885be64 was the last known good commit.

 There is a non-ideal workaround for this regression, which is to switch to
 ALSA input rather than use the native !PulseAudio one. However, that
 creates popping sounds in the recording.

 I'm using openSUSE 12.1 x86_64, currently with !PulseAudio 2.0, although
 before that I used PA 1.1. There is no change in performance between the
 two versions.

 From the hardware side, I have two sound cards - a dedicated Creative
 !SoundBlaster X-Fi !XtremeGamer card, and an integrated Intel Azalia chip.
 Using either soundcard, recording an output monitor (system sounds)
 doesn't cause this problem, but recording an actual input device, such as
 a microphone, does.

 How to reproduce:

 To test this, I run FFmpeg like this:

 /usr/bin/ffmpeg -xerror \
  -f pulse -i alsa_input.pci-0000_00_14.2.analog-stereo \
  -f x11grab -i :0.0 \
  -codec:a pcm_s16le -threads 0 -y Video.mkv

 The complete output of this command, using the last confirmed bad version,
 is as follows:

 ffmpeg version N-39892-g4778783 Copyright (c) 2000-2012 the FFmpeg
   built on Jun 22 2012 18:44:00 with gcc 4.6.2
   configuration: --shlibdir=/usr/lib64 --prefix=/usr
 --mandir=/usr/share/man --libdir=/usr/lib64 --enable-shared --disable-
 static --enable-debug --disable-stripping --extra-cflags='-fmessage-
 length=0 -O2 -march=native -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-
 tables -fasynchronous-unwind-tables -g -fPIC -I/usr/include/gsm' --enable-
 gpl --enable-x11grab --enable-version3 --enable-pthreads --enable-avfilter
   libavutil      51. 46.100 / 51. 46.100
   libavcodec     54. 14.101 / 54. 14.101
   libavformat    54.  3.100 / 54.  3.100
   libavdevice    53.  4.100 / 53.  4.100
   libavfilter     2. 70.100 /  2. 70.100
   libswscale      2.  1.100 /  2.  1.100
   libswresample   0. 11.100 /  0. 11.100
   libpostproc    52.  0.100 / 52.  0.100
 Input #0, pulse, from 'alsa_input.pci-0000_00_14.2.analog-stereo':
   Duration: N/A, start: 0.634532, bitrate: N/A
     Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
 [x11grab @ 0x63a7c0] device: :0.0 -> display: :0.0 x: 0 y: 0 width: 640
 height: 480
 [x11grab @ 0x63a7c0] shared memory extension found
 Input #1, x11grab, from ':0.0':
   Duration: N/A, start: 1340381175.492614, bitrate: N/A
     Stream #1:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 640x480,
 294617 kb/s, 29.97 tbr, 1000k tbn, 29.97 tbc
 Incompatible pixel format 'bgr0' for codec 'mpeg4', auto-selecting format
 [buffer @ 0x639680] w:640 h:480 pixfmt:bgr0 tb:1/1000000 sar:0/1
 [buffersink @ 0x641620] auto-inserting filter 'auto-inserted scale 0'
 between the filter 'src' and the filter 'out'
 [scale @ 0x641ec0] w:640 h:480 fmt:bgr0 sar:0/1 -> w:640 h:480 fmt:yuv420p
 sar:0/1 flags:0x4
 Guessed Channel Layout for  Input Stream #0.0 : stereo
 Output #0, matroska, to 'Video.mkv':
     encoder         : Lavf54.3.100
     Stream #0:0: Video: mpeg4, yuv420p, 640x480, q=2-31, 200 kb/s, 1k tbn,
 29.97 tbc
     Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
 Stream mapping:
   Stream #1:0 -> #0:0 (rawvideo -> mpeg4)
   Stream #0:0 -> #0:1 (pcm_s16le -> pcm_s16le)
 Press [q] to stop, [?] for help
 frame=  264 fps= 24 q=25.8 Lsize=    2764kB time=00:00:10.98
 bitrate=2061.9kbits/s dup=0 drop=27
 video:687kB audio:2059kB global headers:0kB muxing overhead 0.625024%

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

More information about the FFmpeg-trac mailing list