• Taking Webcam Frames on Windows

    A dim evening home office with a clip-on webcam on top of a blank monitor, a desk lamp, an empty chair, and a single small printed photo lying on the desk

    First we need VLC. After installing it, we can send it commands from the console, including transparently for the user. For example, this file will take one frame from the webcam and put it into the specified directory.

    cmd
    "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" --dshow-vdev="iLook 310" --dshow-size=640x480 --video-filter=scene --no-audio --scene-path=C:\Users\Ast\Pictures\Snaps\ --scene-format=jpeg --scene-prefix=snap --run-time=1 --intf=dummy -V dummy --scene-replace --dummy-quiet "dshow://" vlc://quit
    
    set datetimef=%date:~-4%_%date:~3,2%_%date:~0,2%__%time:~0,2%_%time:~3,2%_%time:~6,2%
    copy "C:\Users\Ast\Pictures\Snaps\snap.jpeg" "C:\Users\Ast\Pictures\Snaps\%datetimef%.jpeg"

    In this example, iLook 310 is the name of the source; you can look it up through the VLC GUI.

    This is a 2013 recipe with my camera name and my paths hard-coded, so adjust both. One more thing for VLC 3.x: people report that -V dummy combined with the scene filter produces no frames at all unless hardware decoding is turned off with --avcodec-hw=none. If you get an empty folder, try adding that flag.

    The command is adapted from a recipe on the VideoLAN forum. The options are documented on the VideoLAN wiki pages for the scene filter and the DirectShow input.