You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

866 lines
25KB

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