[FFmpeg-devel] [PATCH] lavd/xcbgrab: do not try to create refcounted packets.

Andy Furniss adf.lists at gmail.com
Thu Oct 27 17:09:06 EEST 2016

Nicolas George wrote:
> The framework will allocate a buffer and copy the data to it,
> that takes time. But it avoids constently creating and
> destroyng the shared memory segment, and that saves more time.
> On my setup,
> from ~200 to ~300 FPS at full screen (1920×1200),
> from ~1400 to ~3300 at smaller size (640×480),
> similar to legacy x11grab.

Nice, thanks for doing this.

Beats legacy by a couple of fps on my old CPU and combined
with nv12 conversion makes the difference between being able
to do 1080p60 and not.

> Plus, shared memory segments are a scarce resource,
> allocating potentially many is a bad idea.
> Note: if the application were to drop all references to the
> buffer before the next call to av_read_frame(), then passing
> the shared memory segment as a refcounted buffer would be
> even more efficient, but it is hard to guarantee, and it does
> not happen with the ffmpeg command-line tool. Using a small
> number of preallocated buffers and resorting to a copy when
> the pool is exhausted would be a solution to get the better
> of both worlds.

Next 2160p60 :-) only joking, though for those with GPUs that do
shader BGR0 -> 420 CSC I guess it could make a difference - but then
in that case it would be even better if they could avoid  having to
copy over and back all together.

More information about the ffmpeg-devel mailing list