indevs.texi 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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 @file{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 dv1394
  41. Linux DV 1394 input device.
  42. @section jack
  43. JACK input device.
  44. To enable this input device during configuration you need libjack
  45. installed on your system.
  46. A JACK input device creates one or more JACK writable clients, one for
  47. each audio channel, with name @var{client_name}:input_@var{N}, where
  48. @var{client_name} is the name provided by the application, and @var{N}
  49. is a number which identifies the channel.
  50. Each writable client will send the acquired data to the FFmpeg input
  51. device.
  52. Once you have created one or more JACK readable clients, you need to
  53. connect them to one or more JACK writable clients.
  54. To connect or disconnect JACK clients you can use the
  55. @file{jack_connect} and @file{jack_disconnect} programs, or do it
  56. through a graphical interface, for example with @file{qjackctl}.
  57. To list the JACK clients and their properties you can invoke the command
  58. @file{jack_lsp}.
  59. Follows an example which shows how to capture a JACK readable client
  60. with @file{ffmpeg}.
  61. @example
  62. # Create a JACK writable client with name "ffmpeg".
  63. $ ffmpeg -f jack -i ffmpeg -y out.wav
  64. # Start the sample jack_metro readable client.
  65. $ jack_metro -b 120 -d 0.2 -f 4000
  66. # List the current JACK clients.
  67. $ jack_lsp -c
  68. system:capture_1
  69. system:capture_2
  70. system:playback_1
  71. system:playback_2
  72. ffmpeg:input_1
  73. metro:120_bpm
  74. # Connect metro to the ffmpeg writable client.
  75. $ jack_connect metro:120_bpm ffmpeg:input_1
  76. @end example
  77. For more information read:
  78. @url{http://jackaudio.org/}
  79. @section libdc1394
  80. IIDC1394 input device, based on libdc1394 and libraw1394.
  81. @section oss
  82. Open Sound System input device.
  83. The filename to provide to the input device is the device node
  84. representing the OSS input device, and is usually set to
  85. @file{/dev/dsp}.
  86. For example to grab from @file{/dev/dsp} using @file{ffmpeg} use the
  87. command:
  88. @example
  89. ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
  90. @end example
  91. For more information about OSS see:
  92. @url{http://manuals.opensound.com/usersguide/dsp.html}
  93. @section video4linux and video4linux2
  94. Video4Linux and Video4Linux2 input video devices.
  95. The name of the device to grab is a file device node, usually Linux
  96. systems tend to automatically create such nodes when the device
  97. (e.g. an USB webcam) is plugged into the system, and has a name of the
  98. kind @file{/dev/video@var{N}}, where @var{N} is a number associated to
  99. the device.
  100. Video4Linux and Video4Linux2 devices only support a limited set of
  101. @var{width}x@var{height} sizes and framerates. You can check which are
  102. supported for example with the command @file{dov4l} for Video4Linux
  103. devices and the command @file{v4l-info} for Video4Linux2 devices.
  104. If the size for the device is set to 0x0, the input device will
  105. try to autodetect the size to use.
  106. Only for the video4linux2 device, if the frame rate is set to 0/0 the
  107. input device will use the frame rate value already set in the driver.
  108. Video4Linux support is deprecated since Linux 2.6.30, and will be
  109. dropped in later versions.
  110. Follow some usage examples of the video4linux devices with the ff*
  111. tools.
  112. @example
  113. # Grab and show the input of a video4linux device, frame rate is set
  114. # to the default of 25/1.
  115. ffplay -s 320x240 -f video4linux /dev/video0
  116. # Grab and show the input of a video4linux2 device, autoadjust size.
  117. ffplay -f video4linux2 /dev/video0
  118. # Grab and record the input of a video4linux2 device, autoadjust size,
  119. # frame rate value defaults to 0/0 so it is read from the video4linux2
  120. # driver.
  121. ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
  122. @end example
  123. @section vfwcap
  124. VfW (Video for Windows) capture input device.
  125. The filename passed as input is the capture driver number, ranging from
  126. 0 to 9. You may use "list" as filename to print a list of drivers. Any
  127. other filename will be interpreted as device number 0.
  128. @section x11grab
  129. X11 video input device.
  130. This device allows to capture a region of an X11 display.
  131. The filename passed as input has the syntax:
  132. @example
  133. [@var{hostname}]:@var{display_number}.@var{screen_number}[+@var{x_offset},@var{y_offset}]
  134. @end example
  135. @var{hostname}:@var{display_number}.@var{screen_number} specifies the
  136. X11 display name of the screen to grab from. @var{hostname} can be
  137. ommitted, and defaults to "localhost". The environment variable
  138. @env{DISPLAY} contains the default display name.
  139. @var{x_offset} and @var{y_offset} specify the offsets of the grabbed
  140. area with respect to the top-left border of the X11 screen. They
  141. default to 0.
  142. Check the X11 documentation (e.g. man X) for more detailed information.
  143. Use the @file{dpyinfo} program for getting basic information about the
  144. properties of your X11 display (e.g. grep for "name" or "dimensions").
  145. For example to grab from @file{:0.0} using @file{ffmpeg}:
  146. @example
  147. ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg
  148. # Grab at position 10,20.
  149. ffmpeg -f x11grab -25 -s cif -i :0.0+10,20 out.mpg
  150. @end example
  151. @c man end INPUT DEVICES