Page 1 of 1

VLC macro for imageJ doesn't work; VirtualDub macro does

Posted: 12 May 2009 10:19
by Hibou
ImageJ http://rsb.info.nih.gov/ij/ is NIH's powerful free scientific image treatment Java application, with a large number of plugins and macros written by users. VLC and VirtualDub can be used with imageJ, and indeed there is a VirtualDub macro. You can open Plugins/New/Macro and define virtualDub, aviFile and captureTime add something like:
status=exec(virtualDub+" /capture /capfile "+aviFile+" /capstart "+captureTime+"s /x");
and imageJ launches VirtualDub, captures aviFile for captureTime seconds, then closes VirtualDub - very neat.

But when I try a similar thing with VLC, the following works fine in a WinXP shell (opening the "USB 2861 Device" PAL camera in VLC), but doesn't work if I put it inside status=exec(...) as an imageJ macro.
C:\Program Files\VideoLAN\VLC>vlc --dshow-vdev="USB 2861 Device" --dshow-size=720x576 --open "dshow://"

I would eventually like to use imageJ with several simultaneous cameras to stitch together a composite mosaic image, for which there is of course an ImageJ plugin called MosaicJ - see: http://www.neutronoptics.com/software.html#vlc

Comments on the feasibility of that would also be welcome.

Re: VLC macro for imageJ doesn't work; VirtualDub macro does

Posted: 12 May 2009 13:47
by Jean-Baptiste Kempf
vlc -Idummy and don't use --open but directly dshow://

Re: VLC macro for imageJ doesn't work; VirtualDub macro does

Posted: 31 Jul 2009 17:12
by Hibou
vlc -Idummy and don't use --open but directly dshow://
I'm coming back to this after having given up a while after much frustration :-) The -Idummy switch was useful, but I also want to hide the video window (by omitting dshow:// ?)

And I need a switch to take the actual snapshot. The following hides the interface and opens the video display, but then I still have to press keys shift-s to take the snapshot. I want to programme taking a snapshot from the command line with nothing popping up.

C:\Program Files\VideoLAN\VLC>vlc -Idummy --dshow-vdev="Philips SPC 900NC PC Camera" --dshow-size=640x480 --snapshotpath=D:\ImageFolder --snapshot-format=jpg "dshow://"

There seems to be a huge amount of VLC information in wikis and forums, but it would also be good to have a complete list of command line switches, and a few examples for us non-experts. Searching the forum, I found that others also wanted to automate snapshots or video capture, and apparently didn't manage to do it.

Re: VLC macro for imageJ doesn't work; VirtualDub macro does

Posted: 01 Aug 2009 17:45
by VLC_help
complete list of command line switches
http://wiki.videolan.org/VLC_command-line_help

Use scene filter if you want to automate capture.
viewtopic.php?f=14&t=62311&p=209953&hilit=scene#p209953

Re: VLC macro for imageJ doesn't work; VirtualDub macro does

Posted: 01 Aug 2009 19:50
by Hibou
complete list of command line switches
http://wiki.videolan.org/VLC_command-line_help

Use scene filter if you want to automate capture.
viewtopic.php?f=14&t=62311&p=209953&hilit=scene#p209953
Excuse me, but I am an old man and I can't understand these cryptic answers even with a PhD in physics and 50 years of amateur programming experience. I did say I am old :-)

All I want is a 1-line command to capture a jpg snapshot or an n second video from one of several cameras, without popping up the VLC interface or anything else if that is at all possible.

I have seen http://wiki.videolan.org/VLC_command-line_help which is very "exhaustive" and I do find examples in the forum, but often they no longer work because VLC keeps changing. For example, the following:
vlc -V image --start-time 0 --stop-time 1 --imag out-format jpg --image-out-ratio 24 --image-out-prefix snap test.avi vlc:quit

now produces the rather unhelpful error message:
"The command line options couldn't be loaded, check that they are valid".

Re: VLC macro for imageJ doesn't work; VirtualDub macro does

Posted: 02 Aug 2009 10:39
by Hibou
All I want is a 1-line command to capture a jpg snapshot or an n second video from one of several cameras, without popping up the VLC interface or anything else if that is at all possible.
After searching the recent forum and making many trials, I found my 1-line command to silently take a snapshot from a webcam. The most useful information was provided by Lorni on viewtopic.php?f=13&t=60904&p=205470#p205470.

vlc --dshow-vdev="Monitor Webcam" --dshow-size=640x480 -V dummy --intf=dummy --dummy-quiet --video-filter=scene --no-audio --scene-path=D:\temp --scene-format=jpeg --scene-prefix=snap --scene-replace --run-time=1 --scene-ratio=24 "dshow://" vlc://quit

Explanation of the less obvious switches (see http://wiki.videolan.org/VLC_command-line_help )
--dshow-vdev="Monitor Webcam" : this defines the input as the direct show device "Monitor Webcam" (how do I list these?)
-V dummy : this suppresses the actual video window
--intf=dummy : this also suppresses the VLC interface window
--dummy-quiet : this suppresses the progress log window, so nothing at all pops up
--video-filter=scene : scene apparently replaces the earlier "image", which no longer works
--scene-replace : is supposed to replace an existing snapshot snap.jpeg, but instead it creates snap.jpeg.swp
--run-time=1 : inputs for 1 second
--scene-ratio=24 : outputs every 24th frame (ie 1 frame for 25 fps PAL)
"dshow://" : outputs with direct show
vlc://quit : quits silently after finishing; the user sees nothing but snap.jpeg appearing in D:\temp

Some of these switches are not really needed, and removing --scene-replace and setting --scene-ratio=3 will give a series of snapshots of every 3rd frame.