[FFmpeg-trac] #4348(undetermined:new): Slight audio latency when grabbing system audio from pulseaudio

FFmpeg trac at avcodec.org
Tue Mar 3 11:51:05 CET 2015


#4348: Slight audio latency when grabbing system audio from pulseaudio
-------------------------------------+-------------------------------------
             Reporter:  skriticos    |                     Type:  defect
               Status:  new          |                 Priority:  normal
            Component:               |                  Version:  git-
  undetermined                       |  master
             Keywords:  pulseaudio   |               Blocked By:
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------
 Summary of the bug:

 I'm doing screen-recordings in which I mix system audio from pulse and
 audio from an external microphone. The recording works, but the system
 audio has a slight delay (< 1 sec), just enough to be annoying.

 The recording output shows two different warning messages:

 1: [pulse @ 0x2804980] pa_stream_get_latency() failed
 2:
 [alsa @ 0x282d860] Thread message queue blocking; consider raising the
 thread_queue_size option (current value: 8)
 [output stream 0:0 @ 0x2848f40] 100 buffers queued in output stream 0:0,
 something may be wrong.
 [x11grab @ 0x283f220] Thread message queue blocking; consider raising the
 thread_queue_size option (current value: 8)
 [pulse @ 0x2804980] Thread message queue blocking; consider raising the
 thread_queue_size option (current value: 8)

 How to reproduce:

 I'm using the following command to record the video. The first part grabs
 the microphone and system audio stream and mixes them together, then the
 video and puts it all together into a matroska file with one merged audio
 stream and one video stream of the desktop.

 {{{
 nice -10 ffmpeg \
     -f pulse -i alsa_output.pci-0000_00_1b.0.analog-stereo.monitor \
     -f alsa -i hw:1,0 \
     -filter_complex amix -async 1 \
     -f x11grab -r 30 -s hd1080 -i :0.0 \
     -map 0:a -map 2:v \
     -acodec libvorbis -ab 160k \
     -vcodec libx264 -tune stillimage -crf 12 -preset ultrafast \
     -threads 4 \
     -y \
     $1.mkv
 }}}

 ffmpeg version: efd3f407e50ec04eb9b90825bf8436f221e65de8
 Compiled form git master today.
 Configuration:
 % ./configure --enable-gpl --enable-pthreads --enable-libpulse --enable-
 libx264 --enable-libvorbis --enable-libmp3lame --enable-libopus --extra-
 libs=-lasound

 Full recording output:
 {{{
 % record-fs-dual-audio.sh test
 ffmpeg version N-70373-gefd3f40 Copyright (c) 2000-2015 the FFmpeg
 developers
   built with gcc 4.9.1 (Ubuntu 4.9.1-16ubuntu6)
   configuration: --enable-gpl --enable-pthreads --enable-libpulse
 --enable-libx264 --enable-libvorbis --enable-libmp3lame --enable-libopus
 --extra-libs=-lasound
   libavutil      54. 19.100 / 54. 19.100
   libavcodec     56. 26.100 / 56. 26.100
   libavformat    56. 23.106 / 56. 23.106
   libavdevice    56.  4.100 / 56.  4.100
   libavfilter     5. 11.102 /  5. 11.102
   libswscale      3.  1.101 /  3.  1.101
   libswresample   1.  1.100 /  1.  1.100
   libpostproc    53.  3.100 / 53.  3.100
 [pulse @ 0x25b9980] pa_stream_get_latency() failed
     Last message repeated 1 times
 Guessed Channel Layout for  Input Stream #0.0 : stereo
 Input #0, pulse, from 'alsa_output.pci-0000_00_1b.0.analog-
 stereo.monitor':
   Duration: N/A, start: 1425379593.636540, bitrate: 1536 kb/s
     Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
 Guessed Channel Layout for  Input Stream #1.0 : stereo
 Input #1, alsa, from 'hw:1,0':
   Duration: N/A, start: 1425379594.028598, bitrate: 1536 kb/s
     Stream #1:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
 [x11grab @ 0x25f3e60] Stream #0: not enough frames to estimate rate;
 consider increasing probesize
 Input #2, x11grab, from ':0.0':
   Duration: N/A, bitrate: N/A
     Stream #2:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1080, 30
 fps, 30 tbr, 1000k tbn, 30 tbc
 -async is forwarded to lavfi similarly to -af
 aresample=async=1:min_hard_comp=0.100000:first_pts=0.
     Last message repeated 1 times
 No pixel format specified, yuv444p for H.264 encoding chosen.
 Use -pix_fmt yuv420p for compatibility with outdated media players.
 [libx264 @ 0x260a900] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2
 AVX
 [libx264 @ 0x260a900] profile High 4:4:4 Predictive, level 4.0, 4:4:4
 8-bit
 [libx264 @ 0x260a900] 264 - core 142 r2431 a5831aa - H.264/MPEG-4 AVC
 codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - options:
 cabac=0 ref=1 deblock=0:-3:-3 analyse=0:0 me=dia subme=0 psy=1
 psy_rd=2.00:0.70 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0
 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=6 threads=4
 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0
 bluray_compat=0 constrained_intra=0 bframes=0 weightp=0 keyint=250
 keyint_min=25 scenecut=0 intra_refresh=0 rc=crf mbtree=0 crf=12.0
 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=0
 Output #0, matroska, to 'test.mkv':
   Metadata:
     encoder         : Lavf56.23.106
     Stream #0:0: Audio: vorbis (libvorbis) (oV[0][0] / 0x566F), 48000 Hz,
 stereo, fltp, 160 kb/s (default)
     Metadata:
       encoder         : Lavc56.26.100 libvorbis
     Stream #0:1: Video: h264 (libx264) (H264 / 0x34363248), yuv444p,
 1920x1080, q=-1--1, 30 fps, 1k tbn, 30 tbc
     Metadata:
       encoder         : Lavc56.26.100 libx264
 Stream mapping:
   Stream #0:0 (pcm_s16le) -> amix:input0 (graph 0)
   Stream #1:0 (pcm_s16le) -> amix:input1 (graph 0)
   amix (graph 0) -> Stream #0:0 (libvorbis)
   Stream #2:0 -> #0:1 (rawvideo (native) -> h264 (libx264))
 Press [q] to stop, [?] for help
 [alsa @ 0x25e2800] Thread message queue blocking; consider raising the
 thread_queue_size option (current value: 8)
 [output stream 0:0 @ 0x25fd6a0] 100 buffers queued in output stream 0:0,
 something may be wrong.
 [x11grab @ 0x25f3e60] Thread message queue blocking; consider raising the
 thread_queue_size option (current value: 8)
 [pulse @ 0x25b9980] Thread message queue blocking; consider raising the
 thread_queue_size option (current value: 8)
 frame=  158 fps= 30 q=-1.0 Lsize=    2906kB time=00:00:05.26
 bitrate=4520.4kbits/s
 video:2831kB audio:68kB subtitle:0kB other streams:0kB global headers:4kB
 muxing overhead: 0.273924%
 [libx264 @ 0x260a900] frame I:1     Avg QP: 9.00  size:531756
 [libx264 @ 0x260a900] frame P:157   Avg QP: 3.13  size: 15072
 [libx264 @ 0x260a900] mb I  I16..4: 100.0%  0.0%  0.0%
 [libx264 @ 0x260a900] mb P  I16..4:  0.5%  0.0%  0.0%  P16..4:  7.0%  0.0%
 0.0%  0.0%  0.0%    skip:92.5%
 [libx264 @ 0x260a900] coded y,u,v intra: 22.3% 23.4% 23.3% inter: 1.9%
 1.8% 1.8%
 [libx264 @ 0x260a900] i16 v,h,dc,p: 79% 19%  2%  0%
 [libx264 @ 0x260a900] kb/s:4402.05
 Received signal 2: terminating.
 }}}

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


More information about the FFmpeg-trac mailing list