[FFmpeg-trac] #615(undetermined:reopened): ALSA buffer xrun

FFmpeg trac at avcodec.org
Tue Mar 24 03:02:23 CET 2015


#615: ALSA buffer xrun
-------------------------------------+-------------------------------------
             Reporter:  burek        |                    Owner:  michael
                 Type:  defect       |                   Status:  reopened
             Priority:  normal       |                Component:
              Version:  git-master   |  undetermined
             Keywords:               |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0
-------------------------------------+-------------------------------------

Comment (by peterbecich):

 Replying to [comment:13 reimar]:
 > Replying to [comment:9 burek]:
 > > I'm also starting to believe it might be an ALSA bug actually.
 Because, every time I try to capture video from my usb webcam and audio
 (either from webcam or pci sound card), these errors are kinda normal
 thing to happen.
 >
 > Did you try capturing audio and video at the same time bug from
 different FFmpeg processes?
 > I would have guessed that due to the overhead of video processing FFmpeg
 might not get data often enough from the audio device.
 > Even if that is not the case, clocks and thus timestamps for audio and
 video running apart might cause FFmpeg to read audio data not often
 enough.
 > For both cases creating a separate thread that can buffer far more data
 than ALSA on its own (similar to what is done in libavformat/udp.c) should
 help.

 Thanks for this.  Using two separate ffmpeg processes has solved my
 problem, written up here:  http://stackoverflow.com/questions/28359855
 /alsa-buffer-xrun-induced-by-low-quality-source-in-ffmpeg-capture

 I am transferring video tape.  The "ALSA buffer xrun" was triggered by any
 noisy/garbage parts of the tape, like the beginning of it.  The "xruns"
 then persist into quality parts of the tape, leading me to think this is a
 chain reaction.  The video is fine, though.


 {{{
 .
 .
 [alsa @ 0x22038a0] ALSA buffer xrun.8980kB time=00:00:21.84
 bitrate=7118.8kbits/s
 [alsa @ 0x22038a0] ALSA buffer xrun.2032kB time=00:00:24.55
 bitrate=7349.3kbits/s
 [alsa @ 0x22038a0] ALSA buffer xrun.4612kB time=00:00:27.27
 bitrate=7391.1kbits/s
 .
 .
 }}}

 A notable feature is that after the "xruns" begin, the bitrate of the
 encoding shoots up higher than normal.

 I haven't figured out how to increase the ALSA buffer size in Ubuntu
 (question here: http://askubuntu.com/questions/564033/increasing-alsas-
 buffer-size), and also have not figured out how to increase the ALSA
 thread queue size to fix this error message:

 {{{
 [alsa @ 0x31ab8a0] Thread message queue blocking; consider raising the
 thread_queue_size option (current value: 8)
 }}}

 If I'm reading this correctly, the option to change the ALSA thread queue
 size is coming soon: http://lists.mplayerhq.hu/pipermail/ffmpeg-
 devel/2015-February/169292.html

--
Ticket URL: <https://trac.ffmpeg.org/ticket/615#comment:27>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list