Changes between Version 16 and Version 17 of DirectShow


Ignore:
Timestamp:
Mar 8, 2014, 2:38:12 AM (6 years ago)
Author:
llogan
Comment:

nits, cleanups, notes, and formatting

Legend:

Unmodified
Added
Removed
Modified
  • DirectShow

    v16 v17  
    22[[PageOutline(2, Contents)]]
    33
    4 FFmpeg can take input from "directshow" devices on your windows computer.  These are typically video or audio devices that are attached.
     4FFmpeg can take input from "directshow" devices on your Windows computer. See the [http://ffmpeg.org/ffmpeg-devices.html#dshow FFmpeg dshow input device documentation] for more information.
    55
    66==
     7
     8Example to list dshow input devices:
    79
    810{{{
     
    2527}}}
    2628
    27 Then use the listed devices like
     29Example to use a dshow device as an input:
     30
    2831{{{
    2932c:\> ffmpeg -f dshow -i video="Integrated Camera" out.mp4
    3033}}}
    3134
    32 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:
     35You 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.
    3336
    34 {{{c:\> ffmpeg -f dshow -list_options true -i video=<video device>}}}
    35 ex:
     37Example to print a list of options from a selected device:
    3638
    3739{{{
    38 ffmpeg -f dshow -list_options true -i video="Integrated Camera"
     40$ ffmpeg -f dshow -list_options true -i video="Integrated Camera"
    3941ffmpeg version N-45279-g6b86dd5 Copyright (c) 2000-2012 the FFmpeg developers
    4042  built on Oct 10 2012 17:30:47 with gcc 4.7.1 (GCC)
     
    5860You 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.
    5961
    60 You can specify the type (mjpeg) and size (1280x720) and frame rate to tell the device to give you (15 fps), like this:
     62You can specify the type (mjpeg) and size (1280x720) and frame rate to tell the device to give you (15 fps):
    6163
    62 {{{ ffmpeg -f dshow -s 1280x720 -r 15 -vcodec mjpeg -i video="Integrated Camera" out.avi }}}
     64{{{ ffmpeg -f dshow -video_size 1280x720 -framerate 15 -vcodec mjpeg -i video="Integrated Camera" out.avi }}}
    6365
    64 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.
     66You can specify "-vcodec copy" to [http://ffmpeg.org/ffmpeg.html#Stream-copy stream copy] the video instead of re-encoding, if you can receive the data in some type of pre-encoded format, like mjpeg in this instance.
    6567
    6668Also 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."
    6769
    68 See [http://ffmpeg.org/ffmpeg.html#dshow here] for a list of more dshow options you can specify, for instance you can decrease latency on audio devices, specify a video by "index" if 2 have the same name displayed, etc.
     70{{{#!comment
     71Note from llogan: Where is the above note from? Why is it in quotes?
     72}}}
     73
     74See the [http://ffmpeg.org/ffmpeg-devices.html#dshow FFmpeg dshow input device documentation] for a list of more dshow options you can specify. For instance you can decrease latency on audio devices, or specify a video by "index" if two have the same name displayed, etc.
    6975
    7076== Buffering ==
    7177
    72 By default FFmpeg captures frames from the input, and then (does whatever you told it to do, for instance, re-encoding them and saving them to an output file).  By default if it receives a frame "too early" (while the previous frame isn't finished yet), it will discard that frame, so that it can keep up the the real time input.  You can adjust this by setting the "-rtbufsize" parameter, though note that if your encoding process can't keep up, eventually you'll still start losing frames just the same (and using it at all can introduce a bit of latency).  It may be helpful to still specify some buffer, however, otherwise frames may be needlessly dropped.
     78By default FFmpeg captures frames from the input, and then does whatever you told it to do, for instance, re-encoding them and saving them to an output file.  By default if it receives a frame "too early" (while the previous frame isn't finished yet), it will discard that frame, so that it can keep up the the real time input.  You can adjust this by setting the `-rtbufsize` parameter, though note that if your encoding process can't keep up, eventually you'll still start losing frames just the same (and using it at all can introduce a bit of latency).  It may be helpful to still specify some buffer, however, otherwise frames may be needlessly dropped.
    7379
    7480See [[StreamingGuide]] for some tips on tweaking encoding (sections latency and cpu usage).  For instance, you could save it to a very fast codec, then re-encode it later.
     
    7682== !TroubleShooting ==
    7783
    78 If you have a video capture card (ex: !AverMedia, possibly some !BlackMagic, though it may be a separate unrelated problem, and also some !BlackMagic cards don't have the right inputs set up ask on the forum), it may not work (yet) out of the box with FFmpeg, as it lacks crossbar support presently.  The work around currently is to install the AmerecTV software, which presents the capture card as directshow devices, then input the AmerecTV directshow devices into your FFmpeg.  See [http://www.ffsplit.com/forums/showthread.php?422-Filter-How-to-use-a-capture-card-with-AmarecTV here].
     84If you have a video capture card (ex: !AverMedia, possibly some !BlackMagic, though it may be a separate unrelated problem, and also some !BlackMagic cards don't have the right inputs set up ask on the forum), it may not work (yet) out of the box with FFmpeg, as it lacks crossbar support presently.  The work around currently is to install the AmerecTV software, which presents the capture card as directshow devices, then input the AmerecTV directshow devices into your FFmpeg. See [http://www.ffsplit.com/forums/showthread.php?422-Filter-How-to-use-a-capture-card-with-AmarecTV here].
     85
     86{{{#!comment
     87"...ask on the forum"
     88Note from llogan: Which forum?
     89}}}
     90
     91{{{#!comment
     92"See [http://www.ffsplit.com/forums/showthread.php?422-Filter-How-to-use-a-capture-card-with-AmarecTV here]."
     93Note from llogan: This URL is broken. You should try to provide relevant information within the wiki article instead of simply providing links to outside resources.
     94}}}
     95
     96{{{#!comment
     97Note from llogan: This whole section makes no sense so I commented it out. Please use proper English. Feel free to restore it once it is written clearly.
    7998
    8099== Using !DirectShow with libav* ==
    81100
    82 Basically, you can accept input dshow input into you program that uses, see  [[Using libav*]] to know what libav does.  See http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=15&t=274&p=902&hilit=dictionary#p902
    83 
     101Basically, you can accept input dshow input into you program that uses, see [[Using libav*]] to know what libav does.  See http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=15&t=274&p=902&hilit=dictionary#p902
     102}}}
    84103
    85104== How to programmatically enumerate devices ==
    86105
    87 FFmpeg doesnt' provide a native way to do this yet, but you can lookup the devices yourself, or just parse ffmepg's standard out:
     106FFmpeg does not provide a native way to do this yet, but you can lookup the devices yourself or just parse standard out from ffmpeg:
    88107
    89108http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=15&t=651&p=2963&hilit=enumerate#p2963
     
    93112== !AviSynth Input ==
    94113
    95 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") with this content:
     114FFmpeg 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`) with this content:
    96115
    97116{{{DirectShowSource("push2.GRF", fps=35, audio=False, framecount=1000000)}}}
    98117
    99 == Running ffmpeg.exe without opening a console window ==
     118== Running `ffmpeg.exe` without opening a console window ==
    100119
    101120If you want to run your ffmpeg "from a gui" without having it popup a console window which spits out all of ffmpeg's input, a few things that may help:
    102121
    103 * If you can start your program like rubyw.exe or javaw.exe then all command line output (including child processes') is basically not attached to a console.
     122* If you can start your program like `rubyw.exe` or `javaw.exe` then all command line output (including child processes') is basically not attached to a console.
    104123* If your program has an option to run a child program "hidden" or the like, that might work.  If you redirect stderr and stdout to something you receive, that might work (but might be tricky because you may need to read from both pipes in different threads, etc.)
    105124
    106125= ffdshow tryouts =
    107126
    108 ffdshow tryouts is a separate project that basically wraps FFmpeg's core source (libavcodec, etc.) and then presents them as filter wrappers that your normal Windows applications can use for decoding video, etc.  It's not related to "ffmpeg.exe" directly, at all.
     127[http://ffdshow-tryout.sourceforge.net/ ffdshow tryouts] is a separate project that basically wraps FFmpeg's core source (libavcodec, etc.) and then presents them as filter wrappers that your normal Windows applications can use for decoding video, etc. It's not related to FFmpeg directly at all.
    109128
    110129= Support =
    111130
    112 You can ask questions/comments about DirectShow on the zeranoe forum.
     131You can ask questions/comments about DirectShow on the [http://ffmpeg.zeranoe.com/forum/ Zeranoe FFmpeg Forum].
    113132
    114 == Known Bugs/Feature Requests ==
     133== Known !Bugs/Feature Requests ==
    115134
    116 (ping rogerdpack@gmail.com if you want to discuss some of them).
     135{{{
     136#!div style="border: 1pt dotted; margin: 1em; background-color: #fffff9;"
     137Send a message to rogerdpack@gmail.com if you want to discuss these issues.
     138}}}
    117139
    118 * video property enumeration using -video_device_number appears to be broken (is using it broken too?)
     140* video property enumeration using `-video_device_number` appears to be broken (is using it broken too?)
    119141* unable to specify device by guid (but you can use name/index currently, sometimes this isn't enough for certain names not console friendly)
    120142* does not work with crossbar devices
    121 * may not work with devices that somehow share audio and video together http://stackoverflow.com/questions/16618686/directshow-capture-source-and-ffmpeg
    122 * if you have -i audio=x:video=x and video comes too frequently ("dropping packet") it might start dropping audio packets too, which may not be desired (ping me if you want this fixed).
     143* may not work with devices that somehow share audio and video together [http://stackoverflow.com/questions/16618686/directshow-capture-source-and-ffmpeg DirectShow Capture Source and FFmpeg]
     144* if you have `-i audio=x:video=x` and video comes too frequently ("dropping packet") it might start dropping audio packets too, which may not be desired (ping me if you want this fixed).
    123145* currently there is no ability to "push back" against upstream sources if ffmpeg is unable to encode fast enough, this might be nice to have.