| | 30 | |
| | 31 | You can also pass the device certain parameters that it needs, for instance a webcam might allow you to capture it in "1024x768" at up to max 5 fps, or allow you to capture at "640x480" at 30 fps. You can enumerate the options like this: |
| | 32 | |
| | 33 | {{{c:\> ffmpeg -f dshow -list_options true -i video=<video device>}}} |
| | 34 | ex: |
| | 35 | |
| | 36 | {{{ |
| | 37 | ffmpeg -f dshow -list_options true -i video="Integrated Camera" |
| | 38 | ffmpeg version N-45279-g6b86dd5 Copyright (c) 2000-2012 the FFmpeg developers |
| | 39 | built on Oct 10 2012 17:30:47 with gcc 4.7.1 (GCC) |
| | 40 | configuration:... |
| | 41 | libavutil 51. 74.100 / 51. 74.100 |
| | 42 | libavcodec 54. 65.100 / 54. 65.100 |
| | 43 | libavformat 54. 31.100 / 54. 31.100 |
| | 44 | libavdevice 54. 3.100 / 54. 3.100 |
| | 45 | libavfilter 3. 19.102 / 3. 19.102 |
| | 46 | libswscale 2. 1.101 / 2. 1.101 |
| | 47 | libswresample 0. 16.100 / 0. 16.100 |
| | 48 | [dshow @ 01D4F3E0] DirectShow video device options |
| | 49 | [dshow @ 01D4F3E0] Pin "Capture" |
| | 50 | [dshow @ 01D4F3E0] pixel_format=yuyv422 min s=640x480 fps=15 max s=640x480 fps=30 |
| | 51 | [dshow @ 01D4F3E0] pixel_format=yuyv422 min s=1280x720 fps=7.5 max s=1280x720 fps=7.5 |
| | 52 | [dshow @ 01D4F3E0] vcodec=mjpeg min s=640x480 fps=15 max s=640x480 fps=30 |
| | 53 | [dshow @ 01D4F3E0] vcodec=mjpeg min s=1280x720 fps=15 max s=1280x720 fps=30 |
| | 54 | video=Integrated Camera: Immediate exit requested |
| | 55 | }}} |
| | 56 | |
| | 57 | You can see in this particular instance that it can either stream it to you in a "raw pixel_format" (yuyv422 in this case), or as an mjpeg stream. |
| | 58 | |
| | 59 | You can specify the type (mjpeg) and size (1280x720) and frame rate to tell the device to give you (15 fps), like this: |
| | 60 | |
| | 61 | {{{ ffmpeg -f dshow -s 1280x720 -r 15 -vcodec mjpeg -i video="Integrated Camera" out.avi }}} |
| | 62 | |
| | 63 | Sometimes it helps to specify "-vcodec copy" to save on cpu to re-encode, if you can receive the data in some type of pre-encoded format, like mjpeg in this instance. |
| | 64 | |
| | 65 | Also this note that "The input string is in the format video=<video device name>:audio=<audio device name>. It is possible to have two separate inputs (like -f dshow -i audio=foo -f dshow -i video=bar) but my limited tests had shown a better synchronism when both were used in the same input." |
| | 66 | |
| | 67 | == !AviSynth == |
| | 68 | |
| | 69 | FFmpeg can also take !DirectShow input by creating an avisynth file (.avs file) that itself gets input from a graphedit file, which graphedit file exposes a pin of your capture source or any filter really, ex ("yo.avs"): |
| | 70 | |
| | 71 | {{{DirectShowSource?("push2.GRF", fps=35, audio=False, framecount=1000000)}}} |