1@chapter Input Devices
2@c man begin INPUT DEVICES
3
4Input devices are configured elements in FFmpeg which allow to access
5the data coming from a multimedia device attached to your system.
6
7When you configure your FFmpeg build, all the supported input devices
8are enabled by default. You can list all available ones using the
9configure option "--list-indevs".
10
11You can disable all the input devices using the configure option
12"--disable-indevs", and selectively enable an input device using the
13option "--enable-indev=@var{INDEV}", or you can disable a particular
14input device using the option "--disable-indev=@var{INDEV}".
15
16The option "-devices" of the ff* tools will display the list of
17supported input devices.
18
19A description of the currently available input devices follows.
20
21@section alsa
22
23ALSA (Advanced Linux Sound Architecture) input device.
24
25To enable this input device during configuration you need libasound
26installed on your system.
27
28This device allows capturing from an ALSA device. The name of the
29device to capture has to be an ALSA card identifier.
30
31An ALSA identifier has the syntax:
32@example
33hw:@var{CARD}[,@var{DEV}[,@var{SUBDEV}]]
34@end example
35
36where the @var{DEV} and @var{SUBDEV} components are optional.
37
38The three arguments (in order: @var{CARD},@var{DEV},@var{SUBDEV})
39specify card number or identifier, device number and subdevice number
40(-1 means any).
41
42To see the list of cards currently recognized by your system check the
43files @file{/proc/asound/cards} and @file{/proc/asound/devices}.
44
45For example to capture with @command{ffmpeg} from an ALSA device with
46card id 0, you may run the command:
47@example
48ffmpeg -f alsa -i hw:0 alsaout.wav
49@end example
50
51For more information see:
52@url{http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html}
53
54@section avfoundation
55
56AVFoundation input device.
57
58AVFoundation is the currently recommended framework by Apple for streamgrabbing on OSX >= 10.7 as well as on iOS.
59The older QTKit framework has been marked deprecated since OSX version 10.7.
60
61The filename passed as input is parsed to contain either a device name or index.
62The device index can also be given by using -video_device_index.
63A given device index will override any given device name.
64If the desired device consists of numbers only, use -video_device_index to identify it.
65The default device will be chosen if an empty string  or the device name "default" is given.
66The available devices can be enumerated by using -list_devices.
67The pixel format can be set using -pixel_format.
68Available formats:
69 monob, rgb555be, rgb555le, rgb565be, rgb565le, rgb24, bgr24, 0rgb, bgr0, 0bgr, rgb0,
70 bgr48be, uyvy422, yuva444p, yuva444p16le, yuv444p, yuv422p16, yuv422p10, yuv444p10,
71 yuv420p, nv12, yuyv422, gray
72
73@example
74ffmpeg -f avfoundation -i "0" out.mpg
75@end example
76
77@example
78ffmpeg -f avfoundation -video_device_index 0 -i "" out.mpg
79@end example
80
81@example
82ffmpeg -f avfoundation -pixel_format bgr0 -i "default" out.mpg
83@end example
84
85@example
86ffmpeg -f avfoundation -list_devices true -i ""
87@end example
88
89@section bktr
90
91BSD video input device.
92
93@section dshow
94
95Windows DirectShow input device.
96
97DirectShow support is enabled when FFmpeg is built with the mingw-w64 project.
98Currently only audio and video devices are supported.
99
100Multiple devices may be opened as separate inputs, but they may also be
101opened on the same input, which should improve synchronism between them.
102
103The input name should be in the format:
104
105@example
106@var{TYPE}=@var{NAME}[:@var{TYPE}=@var{NAME}]
107@end example
108
109where @var{TYPE} can be either @var{audio} or @var{video},
110and @var{NAME} is the device's name.
111
112@subsection Options
113
114If no options are specified, the device's defaults are used.
115If the device does not support the requested options, it will
116fail to open.
117
118@table @option
119
120@item video_size
121Set the video size in the captured video.
122
123@item framerate
124Set the frame rate in the captured video.
125
126@item sample_rate
127Set the sample rate (in Hz) of the captured audio.
128
129@item sample_size
130Set the sample size (in bits) of the captured audio.
131
132@item channels
133Set the number of channels in the captured audio.
134
135@item list_devices
136If set to @option{true}, print a list of devices and exit.
137
138@item list_options
139If set to @option{true}, print a list of selected device's options
140and exit.
141
142@item video_device_number
143Set video device number for devices with same name (starts at 0,
144defaults to 0).
145
146@item audio_device_number
147Set audio device number for devices with same name (starts at 0,
148defaults to 0).
149
150@item pixel_format
151Select pixel format to be used by DirectShow. This may only be set when
152the video codec is not set or set to rawvideo.
153
154@item audio_buffer_size
155Set audio device buffer size in milliseconds (which can directly
156impact latency, depending on the device).
157Defaults to using the audio device's
158default buffer size (typically some multiple of 500ms).
159Setting this value too low can degrade performance.
160See also
161@url{http://msdn.microsoft.com/en-us/library/windows/desktop/dd377582(v=vs.85).aspx}
162
163@end table
164
165@subsection Examples
166
167@itemize
168
169@item
170Print the list of DirectShow supported devices and exit:
171@example
172$ ffmpeg -list_devices true -f dshow -i dummy
173@end example
174
175@item
176Open video device @var{Camera}:
177@example
178$ ffmpeg -f dshow -i video="Camera"
179@end example
180
181@item
182Open second video device with name @var{Camera}:
183@example
184$ ffmpeg -f dshow -video_device_number 1 -i video="Camera"
185@end example
186
187@item
188Open video device @var{Camera} and audio device @var{Microphone}:
189@example
190$ ffmpeg -f dshow -i video="Camera":audio="Microphone"
191@end example
192
193@item
194Print the list of supported options in selected device and exit:
195@example
196$ ffmpeg -list_options true -f dshow -i video="Camera"
197@end example
198
199@end itemize
200
201@section dv1394
202
203Linux DV 1394 input device.
204
205@section fbdev
206
207Linux framebuffer input device.
208
209The Linux framebuffer is a graphic hardware-independent abstraction
210layer to show graphics on a computer monitor, typically on the
211console. It is accessed through a file device node, usually
212@file{/dev/fb0}.
213
214For more detailed information read the file
215Documentation/fb/framebuffer.txt included in the Linux source tree.
216
217To record from the framebuffer device @file{/dev/fb0} with
218@command{ffmpeg}:
219@example
220ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi
221@end example
222
223You can take a single screenshot image with the command:
224@example
225ffmpeg -f fbdev -frames:v 1 -r 1 -i /dev/fb0 screenshot.jpeg
226@end example
227
228See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
229
230@section gdigrab
231
232Win32 GDI-based screen capture device.
233
234This device allows you to capture a region of the display on Windows.
235
236There are two options for the input filename:
237@example
238desktop
239@end example
240or
241@example
242title=@var{window_title}
243@end example
244
245The first option will capture the entire desktop, or a fixed region of the
246desktop. The second option will instead capture the contents of a single
247window, regardless of its position on the screen.
248
249For example, to grab the entire desktop using @command{ffmpeg}:
250@example
251ffmpeg -f gdigrab -framerate 6 -i desktop out.mpg
252@end example
253
254Grab a 640x480 region at position @code{10,20}:
255@example
256ffmpeg -f gdigrab -framerate 6 -offset_x 10 -offset_y 20 -video_size vga -i desktop out.mpg
257@end example
258
259Grab the contents of the window named "Calculator"
260@example
261ffmpeg -f gdigrab -framerate 6 -i title=Calculator out.mpg
262@end example
263
264@subsection Options
265
266@table @option
267@item draw_mouse
268Specify whether to draw the mouse pointer. Use the value @code{0} to
269not draw the pointer. Default value is @code{1}.
270
271@item framerate
272Set the grabbing frame rate. Default value is @code{ntsc},
273corresponding to a frame rate of @code{30000/1001}.
274
275@item show_region
276Show grabbed region on screen.
277
278If @var{show_region} is specified with @code{1}, then the grabbing
279region will be indicated on screen. With this option, it is easy to
280know what is being grabbed if only a portion of the screen is grabbed.
281
282Note that @var{show_region} is incompatible with grabbing the contents
283of a single window.
284
285For example:
286@example
287ffmpeg -f gdigrab -show_region 1 -framerate 6 -video_size cif -offset_x 10 -offset_y 20 -i desktop out.mpg
288@end example
289
290@item video_size
291Set the video frame size. The default is to capture the full screen if @file{desktop} is selected, or the full window size if @file{title=@var{window_title}} is selected.
292
293@item offset_x
294When capturing a region with @var{video_size}, set the distance from the left edge of the screen or desktop.
295
296Note that the offset calculation is from the top left corner of the primary monitor on Windows. If you have a monitor positioned to the left of your primary monitor, you will need to use a negative @var{offset_x} value to move the region to that monitor.
297
298@item offset_y
299When capturing a region with @var{video_size}, set the distance from the top edge of the screen or desktop.
300
301Note that the offset calculation is from the top left corner of the primary monitor on Windows. If you have a monitor positioned above your primary monitor, you will need to use a negative @var{offset_y} value to move the region to that monitor.
302
303@end table
304
305@section iec61883
306
307FireWire DV/HDV input device using libiec61883.
308
309To enable this input device, you need libiec61883, libraw1394 and
310libavc1394 installed on your system. Use the configure option
311@code{--enable-libiec61883} to compile with the device enabled.
312
313The iec61883 capture device supports capturing from a video device
314connected via IEEE1394 (FireWire), using libiec61883 and the new Linux
315FireWire stack (juju). This is the default DV/HDV input method in Linux
316Kernel 2.6.37 and later, since the old FireWire stack was removed.
317
318Specify the FireWire port to be used as input file, or "auto"
319to choose the first port connected.
320
321@subsection Options
322
323@table @option
324
325@item dvtype
326Override autodetection of DV/HDV. This should only be used if auto
327detection does not work, or if usage of a different device type
328should be prohibited. Treating a DV device as HDV (or vice versa) will
329not work and result in undefined behavior.
330The values @option{auto}, @option{dv} and @option{hdv} are supported.
331
332@item dvbuffer
333Set maxiumum size of buffer for incoming data, in frames. For DV, this
334is an exact value. For HDV, it is not frame exact, since HDV does
335not have a fixed frame size.
336
337@item dvguid
338Select the capture device by specifying it's GUID. Capturing will only
339be performed from the specified device and fails if no device with the
340given GUID is found. This is useful to select the input if multiple
341devices are connected at the same time.
342Look at /sys/bus/firewire/devices to find out the GUIDs.
343
344@end table
345
346@subsection Examples
347
348@itemize
349
350@item
351Grab and show the input of a FireWire DV/HDV device.
352@example
353ffplay -f iec61883 -i auto
354@end example
355
356@item
357Grab and record the input of a FireWire DV/HDV device,
358using a packet buffer of 100000 packets if the source is HDV.
359@example
360ffmpeg -f iec61883 -i auto -hdvbuffer 100000 out.mpg
361@end example
362
363@end itemize
364
365@section jack
366
367JACK input device.
368
369To enable this input device during configuration you need libjack
370installed on your system.
371
372A JACK input device creates one or more JACK writable clients, one for
373each audio channel, with name @var{client_name}:input_@var{N}, where
374@var{client_name} is the name provided by the application, and @var{N}
375is a number which identifies the channel.
376Each writable client will send the acquired data to the FFmpeg input
377device.
378
379Once you have created one or more JACK readable clients, you need to
380connect them to one or more JACK writable clients.
381
382To connect or disconnect JACK clients you can use the @command{jack_connect}
383and @command{jack_disconnect} programs, or do it through a graphical interface,
384for example with @command{qjackctl}.
385
386To list the JACK clients and their properties you can invoke the command
387@command{jack_lsp}.
388
389Follows an example which shows how to capture a JACK readable client
390with @command{ffmpeg}.
391@example
392# Create a JACK writable client with name "ffmpeg".
393$ ffmpeg -f jack -i ffmpeg -y out.wav
394
395# Start the sample jack_metro readable client.
396$ jack_metro -b 120 -d 0.2 -f 4000
397
398# List the current JACK clients.
399$ jack_lsp -c
400system:capture_1
401system:capture_2
402system:playback_1
403system:playback_2
404ffmpeg:input_1
405metro:120_bpm
406
407# Connect metro to the ffmpeg writable client.
408$ jack_connect metro:120_bpm ffmpeg:input_1
409@end example
410
411For more information read:
412@url{http://jackaudio.org/}
413
414@section lavfi
415
416Libavfilter input virtual device.
417
418This input device reads data from the open output pads of a libavfilter
419filtergraph.
420
421For each filtergraph open output, the input device will create a
422corresponding stream which is mapped to the generated output. Currently
423only video data is supported. The filtergraph is specified through the
424option @option{graph}.
425
426@subsection Options
427
428@table @option
429
430@item graph
431Specify the filtergraph to use as input. Each video open output must be
432labelled by a unique string of the form "out@var{N}", where @var{N} is a
433number starting from 0 corresponding to the mapped input stream
434generated by the device.
435The first unlabelled output is automatically assigned to the "out0"
436label, but all the others need to be specified explicitly.
437
438If not specified defaults to the filename specified for the input
439device.
440
441@item graph_file
442Set the filename of the filtergraph to be read and sent to the other
443filters. Syntax of the filtergraph is the same as the one specified by
444the option @var{graph}.
445
446@end table
447
448@subsection Examples
449
450@itemize
451@item
452Create a color video stream and play it back with @command{ffplay}:
453@example
454ffplay -f lavfi -graph "color=c=pink [out0]" dummy
455@end example
456
457@item
458As the previous example, but use filename for specifying the graph
459description, and omit the "out0" label:
460@example
461ffplay -f lavfi color=c=pink
462@end example
463
464@item
465Create three different video test filtered sources and play them:
466@example
467ffplay -f lavfi -graph "testsrc [out0]; testsrc,hflip [out1]; testsrc,negate [out2]" test3
468@end example
469
470@item
471Read an audio stream from a file using the amovie source and play it
472back with @command{ffplay}:
473@example
474ffplay -f lavfi "amovie=test.wav"
475@end example
476
477@item
478Read an audio stream and a video stream and play it back with
479@command{ffplay}:
480@example
481ffplay -f lavfi "movie=test.avi[out0];amovie=test.wav[out1]"
482@end example
483
484@end itemize
485
486@section libcdio
487
488Audio-CD input device based on cdio.
489
490To enable this input device during configuration you need libcdio
491installed on your system.
492
493This device allows playing and grabbing from an Audio-CD.
494
495For example to copy with @command{ffmpeg} the entire Audio-CD in /dev/sr0,
496you may run the command:
497@example
498ffmpeg -f libcdio -i /dev/sr0 cd.wav
499@end example
500
501@section libdc1394
502
503IIDC1394 input device, based on libdc1394 and libraw1394.
504
505@section openal
506
507The OpenAL input device provides audio capture on all systems with a
508working OpenAL 1.1 implementation.
509
510To enable this input device during configuration, you need OpenAL
511headers and libraries installed on your system, and need to configure
512FFmpeg with @code{--enable-openal}.
513
514OpenAL headers and libraries should be provided as part of your OpenAL
515implementation, or as an additional download (an SDK). Depending on your
516installation you may need to specify additional flags via the
517@code{--extra-cflags} and @code{--extra-ldflags} for allowing the build
518system to locate the OpenAL headers and libraries.
519
520An incomplete list of OpenAL implementations follows:
521
522@table @strong
523@item Creative
524The official Windows implementation, providing hardware acceleration
525with supported devices and software fallback.
526See @url{http://openal.org/}.
527@item OpenAL Soft
528Portable, open source (LGPL) software implementation. Includes
529backends for the most common sound APIs on the Windows, Linux,
530Solaris, and BSD operating systems.
531See @url{http://kcat.strangesoft.net/openal.html}.
532@item Apple
533OpenAL is part of Core Audio, the official Mac OS X Audio interface.
534See @url{http://developer.apple.com/technologies/mac/audio-and-video.html}
535@end table
536
537This device allows one to capture from an audio input device handled
538through OpenAL.
539
540You need to specify the name of the device to capture in the provided
541filename. If the empty string is provided, the device will
542automatically select the default device. You can get the list of the
543supported devices by using the option @var{list_devices}.
544
545@subsection Options
546
547@table @option
548
549@item channels
550Set the number of channels in the captured audio. Only the values
551@option{1} (monaural) and @option{2} (stereo) are currently supported.
552Defaults to @option{2}.
553
554@item sample_size
555Set the sample size (in bits) of the captured audio. Only the values
556@option{8} and @option{16} are currently supported. Defaults to
557@option{16}.
558
559@item sample_rate
560Set the sample rate (in Hz) of the captured audio.
561Defaults to @option{44.1k}.
562
563@item list_devices
564If set to @option{true}, print a list of devices and exit.
565Defaults to @option{false}.
566
567@end table
568
569@subsection Examples
570
571Print the list of OpenAL supported devices and exit:
572@example
573$ ffmpeg -list_devices true -f openal -i dummy out.ogg
574@end example
575
576Capture from the OpenAL device @file{DR-BT101 via PulseAudio}:
577@example
578$ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out.ogg
579@end example
580
581Capture from the default device (note the empty string '' as filename):
582@example
583$ ffmpeg -f openal -i '' out.ogg
584@end example
585
586Capture from two devices simultaneously, writing to two different files,
587within the same @command{ffmpeg} command:
588@example
589$ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out1.ogg -f openal -i 'ALSA Default' out2.ogg
590@end example
591Note: not all OpenAL implementations support multiple simultaneous capture -
592try the latest OpenAL Soft if the above does not work.
593
594@section oss
595
596Open Sound System input device.
597
598The filename to provide to the input device is the device node
599representing the OSS input device, and is usually set to
600@file{/dev/dsp}.
601
602For example to grab from @file{/dev/dsp} using @command{ffmpeg} use the
603command:
604@example
605ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
606@end example
607
608For more information about OSS see:
609@url{http://manuals.opensound.com/usersguide/dsp.html}
610
611@section pulse
612
613PulseAudio input device.
614
615To enable this output device you need to configure FFmpeg with @code{--enable-libpulse}.
616
617The filename to provide to the input device is a source device or the
618string "default"
619
620To list the PulseAudio source devices and their properties you can invoke
621the command @command{pactl list sources}.
622
623More information about PulseAudio can be found on @url{http://www.pulseaudio.org}.
624
625@subsection Options
626@table @option
627@item server
628Connect to a specific PulseAudio server, specified by an IP address.
629Default server is used when not provided.
630
631@item name
632Specify the application name PulseAudio will use when showing active clients,
633by default it is the @code{LIBAVFORMAT_IDENT} string.
634
635@item stream_name
636Specify the stream name PulseAudio will use when showing active streams,
637by default it is "record".
638
639@item sample_rate
640Specify the samplerate in Hz, by default 48kHz is used.
641
642@item channels
643Specify the channels in use, by default 2 (stereo) is set.
644
645@item frame_size
646Specify the number of bytes per frame, by default it is set to 1024.
647
648@item fragment_size
649Specify the minimal buffering fragment in PulseAudio, it will affect the
650audio latency. By default it is unset.
651@end table
652
653@subsection Examples
654Record a stream from default device:
655@example
656ffmpeg -f pulse -i default /tmp/pulse.wav
657@end example
658
659@section qtkit
660
661QTKit input device.
662
663The filename passed as input is parsed to contain either a device name or index.
664The device index can also be given by using -video_device_index.
665A given device index will override any given device name.
666If the desired device consists of numbers only, use -video_device_index to identify it.
667The default device will be chosen if an empty string  or the device name "default" is given.
668The available devices can be enumerated by using -list_devices.
669
670@example
671ffmpeg -f qtkit -i "0" out.mpg
672@end example
673
674@example
675ffmpeg -f qtkit -video_device_index 0 -i "" out.mpg
676@end example
677
678@example
679ffmpeg -f qtkit -i "default" out.mpg
680@end example
681
682@example
683ffmpeg -f qtkit -list_devices true -i ""
684@end example
685
686@section sndio
687
688sndio input device.
689
690To enable this input device during configuration you need libsndio
691installed on your system.
692
693The filename to provide to the input device is the device node
694representing the sndio input device, and is usually set to
695@file{/dev/audio0}.
696
697For example to grab from @file{/dev/audio0} using @command{ffmpeg} use the
698command:
699@example
700ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
701@end example
702
703@section video4linux2, v4l2
704
705Video4Linux2 input video device.
706
707"v4l2" can be used as alias for "video4linux2".
708
709If FFmpeg is built with v4l-utils support (by using the
710@code{--enable-libv4l2} configure option), it is possible to use it with the
711@code{-use_libv4l2} input device option.
712
713The name of the device to grab is a file device node, usually Linux
714systems tend to automatically create such nodes when the device
715(e.g. an USB webcam) is plugged into the system, and has a name of the
716kind @file{/dev/video@var{N}}, where @var{N} is a number associated to
717the device.
718
719Video4Linux2 devices usually support a limited set of
720@var{width}x@var{height} sizes and frame rates. You can check which are
721supported using @command{-list_formats all} for Video4Linux2 devices.
722Some devices, like TV cards, support one or more standards. It is possible
723to list all the supported standards using @command{-list_standards all}.
724
725The time base for the timestamps is 1 microsecond. Depending on the kernel
726version and configuration, the timestamps may be derived from the real time
727clock (origin at the Unix Epoch) or the monotonic clock (origin usually at
728boot time, unaffected by NTP or manual changes to the clock). The
729@option{-timestamps abs} or @option{-ts abs} option can be used to force
730conversion into the real time clock.
731
732Some usage examples of the video4linux2 device with @command{ffmpeg}
733and @command{ffplay}:
734@itemize
735@item
736Grab and show the input of a video4linux2 device:
737@example
738ffplay -f video4linux2 -framerate 30 -video_size hd720 /dev/video0
739@end example
740
741@item
742Grab and record the input of a video4linux2 device, leave the
743frame rate and size as previously set:
744@example
745ffmpeg -f video4linux2 -input_format mjpeg -i /dev/video0 out.mpeg
746@end example
747@end itemize
748
749For more information about Video4Linux, check @url{http://linuxtv.org/}.
750
751@subsection Options
752
753@table @option
754@item standard
755Set the standard. Must be the name of a supported standard. To get a
756list of the supported standards, use the @option{list_standards}
757option.
758
759@item channel
760Set the input channel number. Default to -1, which means using the
761previously selected channel.
762
763@item video_size
764Set the video frame size. The argument must be a string in the form
765@var{WIDTH}x@var{HEIGHT} or a valid size abbreviation.
766
767@item pixel_format
768Select the pixel format (only valid for raw video input).
769
770@item input_format
771Set the preferred pixel format (for raw video) or a codec name.
772This option allows one to select the input format, when several are
773available.
774
775@item framerate
776Set the preferred video frame rate.
777
778@item list_formats
779List available formats (supported pixel formats, codecs, and frame
780sizes) and exit.
781
782Available values are:
783@table @samp
784@item all
785Show all available (compressed and non-compressed) formats.
786
787@item raw
788Show only raw video (non-compressed) formats.
789
790@item compressed
791Show only compressed formats.
792@end table
793
794@item list_standards
795List supported standards and exit.
796
797Available values are:
798@table @samp
799@item all
800Show all supported standards.
801@end table
802
803@item timestamps, ts
804Set type of timestamps for grabbed frames.
805
806Available values are:
807@table @samp
808@item default
809Use timestamps from the kernel.
810
811@item abs
812Use absolute timestamps (wall clock).
813
814@item mono2abs
815Force conversion from monotonic to absolute timestamps.
816@end table
817
818Default value is @code{default}.
819@end table
820
821@section vfwcap
822
823VfW (Video for Windows) capture input device.
824
825The filename passed as input is the capture driver number, ranging from
8260 to 9. You may use "list" as filename to print a list of drivers. Any
827other filename will be interpreted as device number 0.
828
829@section x11grab
830
831X11 video input device.
832
833This device allows one to capture a region of an X11 display.
834
835The filename passed as input has the syntax:
836@example
837[@var{hostname}]:@var{display_number}.@var{screen_number}[+@var{x_offset},@var{y_offset}]
838@end example
839
840@var{hostname}:@var{display_number}.@var{screen_number} specifies the
841X11 display name of the screen to grab from. @var{hostname} can be
842omitted, and defaults to "localhost". The environment variable
843@env{DISPLAY} contains the default display name.
844
845@var{x_offset} and @var{y_offset} specify the offsets of the grabbed
846area with respect to the top-left border of the X11 screen. They
847default to 0.
848
849Check the X11 documentation (e.g. man X) for more detailed information.
850
851Use the @command{dpyinfo} program for getting basic information about the
852properties of your X11 display (e.g. grep for "name" or "dimensions").
853
854For example to grab from @file{:0.0} using @command{ffmpeg}:
855@example
856ffmpeg -f x11grab -framerate 25 -video_size cif -i :0.0 out.mpg
857@end example
858
859Grab at position @code{10,20}:
860@example
861ffmpeg -f x11grab -framerate 25 -video_size cif -i :0.0+10,20 out.mpg
862@end example
863
864@subsection Options
865
866@table @option
867@item draw_mouse
868Specify whether to draw the mouse pointer. A value of @code{0} specify
869not to draw the pointer. Default value is @code{1}.
870
871@item follow_mouse
872Make the grabbed area follow the mouse. The argument can be
873@code{centered} or a number of pixels @var{PIXELS}.
874
875When it is specified with "centered", the grabbing region follows the mouse
876pointer and keeps the pointer at the center of region; otherwise, the region
877follows only when the mouse pointer reaches within @var{PIXELS} (greater than
878zero) to the edge of region.
879
880For example:
881@example
882ffmpeg -f x11grab -follow_mouse centered -framerate 25 -video_size cif -i :0.0 out.mpg
883@end example
884
885To follow only when the mouse pointer reaches within 100 pixels to edge:
886@example
887ffmpeg -f x11grab -follow_mouse 100 -framerate 25 -video_size cif -i :0.0 out.mpg
888@end example
889
890@item framerate
891Set the grabbing frame rate. Default value is @code{ntsc},
892corresponding to a frame rate of @code{30000/1001}.
893
894@item show_region
895Show grabbed region on screen.
896
897If @var{show_region} is specified with @code{1}, then the grabbing
898region will be indicated on screen. With this option, it is easy to
899know what is being grabbed if only a portion of the screen is grabbed.
900
901For example:
902@example
903ffmpeg -f x11grab -show_region 1 -framerate 25 -video_size cif -i :0.0+10,20 out.mpg
904@end example
905
906With @var{follow_mouse}:
907@example
908ffmpeg -f x11grab -follow_mouse centered -show_region 1 -framerate 25 -video_size cif -i :0.0 out.mpg
909@end example
910
911@item video_size
912Set the video frame size. Default value is @code{vga}.
913@end table
914
915@c man end INPUT DEVICES
916