[FFmpeg-trac] #4513(undetermined:new): Avfoundation Audio stutters / sounds broken with screen capture

FFmpeg trac at avcodec.org
Thu Jun 6 11:52:48 EEST 2019


#4513: Avfoundation Audio stutters / sounds broken with screen capture
-------------------------------------+-------------------------------------
             Reporter:  kevincast    |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
                                     |  undetermined
              Version:  git-master   |               Resolution:
             Keywords:               |               Blocked By:
  avfoundation                       |
             Blocking:               |  Reproduced by developer:  0
Analyzed by developer:  0            |
-------------------------------------+-------------------------------------

Comment (by kmark):

 I've attached the patch from the mailing list rebased on the current
 master (78e1d7f42110aec8d4cd703a7939c64b5a191952) and an additional patch
 which increases the QUEUE_SIZE to 400. I can confirm it successfully
 builds although I haven't tested it again since I last posted. I'll post
 the commit message from that second patch here as it is relevant for this
 discussion:

     By increasing the QUEUE_SIZE the chance of frames dropping out of the
 buffer is significantly reduced. It's been noted in trac #4513 by
 nickcrabtree that the current size of 4 is too low for most (any?)
 applications. 400 is ultimately an arbitrary-but-tested number.

     I've noticed that even with QUEUE_SIZE set to 400 I can still run into
 a situation where it's not high enough as evidence by the log output.
 However this is always in instances where my system is consistently
 encoding at a rate slower than frames are being pulled from AVFoundation
 so the buffer overrun is inevitable unless the duration left to encode is
 short. So it's hard to put the blame on this code when the problem can be
 alleviated by changing a runtime configuration elsewhere.

     Given the above limitation it seems clear that increasing QUEUE_SIZE
 is not a magic fix but gives the encoder more wiggle room to temporarily
 lag behind frames pulled in from AVFoundation. If you do see "video queue
 is full, the oldest frame has been dropped" in your log then increasing
 QUEUE_SIZE further may work in some instances but fixing the underlying
 issue would require an increase in encoder speed or a frame-rate reduction
 on the AVFoundation end.

     One last note is that while I use the term encoder here (as that's
 likely to be the slowest part of your pipeline) I am really referring to
 anything downstream of AVFoundation's input.

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


More information about the FFmpeg-trac mailing list