[FFmpeg-devel] [PATCH 6/6] doc/indevs: Document kmsgrab input device

Mark Thompson sw at jkqxz.net
Tue Sep 12 02:23:35 EEST 2017


---
On 11/09/17 23:15, Paul B Mahol wrote:
> On 9/12/17, Mark Thompson <sw at jkqxz.net> wrote:
>> On 07/09/17 22:56, Mark Thompson wrote:
>>> ---
>>> Now sets the trusted packet flag; otherwise unchanged.
>>>
>>>
>>>  configure                |   1 +
>>>  libavdevice/Makefile     |   1 +
>>>  libavdevice/alldevices.c |   1 +
>>>  libavdevice/kmsgrab.c    | 455
>>> +++++++++++++++++++++++++++++++++++++++++++++++
>>>  4 files changed, 458 insertions(+)
>>>  create mode 100644 libavdevice/kmsgrab.c
>>
>> Series approved by atomnuker on IRC.  Does anyone else want to comment on
>> the wrapped_avframe / AV_PKT_FLAG_TRUSTED setup (or anything else)?  If not,
>> I'll push this the day after tomorrow.
> 
> Missing docs.


 doc/indevs.texi | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/doc/indevs.texi b/doc/indevs.texi
index ad6418751b..30b7ac2380 100644
--- a/doc/indevs.texi
+++ b/doc/indevs.texi
@@ -331,6 +331,68 @@ ffmpeg -channels 16 -format_code Hi50 -f decklink -i 'UltraStudio Mini Recorder'
 
 @end itemize
 
+ at section kmsgrab
+
+KMS video input device.
+
+Captures the KMS scanout framebuffer associated with a specified CRTC or plane as a
+DRM object that can be passed to other hardware functions.
+
+Requires either DRM master or CAP_SYS_ADMIN to run.
+
+If you don't understand what all of that means, you probably don't want this.  Look at
+ at option{x11grab} instead.
+
+ at subsection Options
+
+ at table @option
+
+ at item device
+DRM device to capture on.  Defaults to @option{/dev/dri/card0}.
+
+ at item format
+Pixel format of the framebuffer.  Defaults to @option{bgr0}.
+
+ at item format_modifier
+Format modifier to signal on output frames.  This is necessary to import correctly into
+some APIs, but can't be autodetected.  See the libdrm documentation for possible values.
+
+ at item crtc_id
+KMS CRTC ID to define the capture source.  The first active plane on the given CRTC
+will be used.
+
+ at item plane_id
+KMS plane ID to define the capture source.  Defaults to the first active plane found if
+neither @option{crtc_id} nor @option{plane_id} are specified.
+
+ at item framerate
+Framerate to capture at.  This is not synchronised to any page flipping or framebuffer
+changes - it just defines the interval at which the framebuffer is sampled.  Sampling
+faster than the framebuffer update rate will generate independent frames with the same
+content.  Defaults to @code{30}.
+
+ at end table
+
+ at subsection Examples
+
+ at itemize
+
+ at item
+Capture from the first active plane, download the result to normal frames and encode.
+This will only work if the framebuffer is both linear and mappable - if not, the result
+may be scrambled or fail to download.
+ at example
+ffmpeg -f kmsgrab -i - -vf 'hwdownload,format=bgr0' output.mp4
+ at end example
+
+ at item
+Capture from CRTC ID 42 at 60fps, map the result to VAAPI, convert to NV12 and encode as H.264.
+ at example
+ffmpeg -crtc_id 42 -framerate 60 -f kmsgrab -i - -vf 'hwmap=derive_device=vaapi,scale_vaapi=w=1920:h=1080:format=nv12' -c:v h264_vaapi output.mp4
+ at end example
+
+ at end itemize
+
 @section libndi_newtek
 
 The libndi_newtek input device provides capture capabilities for using NDI (Network
-- 
2.11.0


More information about the ffmpeg-devel mailing list