Your webcam will not only come with a Windows driver, but also with a Windows application to record movies or images. In addition, a number of third party software items for astronomical use of webcams are available. For me only the data acquisition is relevant, as I do the data reduction on Linux with the Starlink software of UK professional astronomers.
To transfer the data into Starlink software they have to be e.g. in FITS format, which is readily written by AstroVideo and Vega. However, this format is bloated compared to AVI. Meaning that it may be too slow to write to disc to keep up with the data coming in from the webcam, and that it may take too much disc space to take data all night.
I therefore tend to capture data on Windows to AVI and on Linux to PGM (grey) or PPM (colour, cf. Netpbm home page). Conversion to FITS and then to the Starlink NDF format (cf. documentation for NDF access routines) happens after the observing session is over.
On Windows I use VRecord (with either webcam) to record AVI, or I use AstroVideo to record AVI or FITS. On Linux I use qastrocam with either webcam to record PGM from the QuickCam VC or PPM from the ToUcam Pro VGA. This is often preceded by a run of CamStream or gqcam.
The Logitech QuickCam VC comes with an application to display the real-time video from the webcam, and to record movies and still images. Ironically this application does not show the driver's graphical user interface, but presents its own version of it.
All the controls are sliders only; the number you have set pops up after you have clicked or released the slider thumb. The rather vital exposure control must be accessed in a separate dialogue, which also gives access to the sensitivity control and the video quality control. (The sensitivity control is not shown in the image here, which was captured from my old laptop, which had a number of odd problems with the webcam.)
It is feasible to use QuickCam to acquire your astronomical images. You have a choice of formats for still sequences, of which I would recommend PNG for its loss-free compression. A 320x240 TIFF takes 225 kByte of disc space, as does Microsoft's own BMP format. The PNG's I got tended to be about 50 or 60 kByte in size.
When you want to capture as a movie - say a pan across the Moon or the progress of a lunar eclipse - then QuickCam is perhaps as good as any application. The format is AVI.
QuickCam can be set up to write a sequence of lapsed images. However, the sequence is without end and has to be terminated with a mouse click. Also, the granularity of the image lapse is one second, so for 1.83 s frame exposure we would probably have to set the lapse to 2 s and loose almost 10 per cent of time.
The Philips ToUcam Pro comes with an interesting application to capture data from any webcam into a movie in AVI format. This application makes a good impression, being basic and functional.
|VRecord video preview and menu.|
- Select the webcam to be used in Devices.
- Use Options to set up the webcam with its driver dialogues. For the ToUcam Pro watch out for the two frame rate settings, one in each dialogue.
- Check Capture : Set Frame Rate. For the ToUcam Pro deselect the use of a separate frame rate for the output file. For the QuickCam VC set a suitable frame rate and select to use it. The longest frame exposure for that webcam is 1.83 s, so a frame rate of 0.54 Hz is sensible.
- Use Capture : Set Time Limit to set the length of AVI movie to record. Also select to use this limit.
- Use File : Set Capture File to open a new AVI file in a suitable directory for AVIs. When asked for the capture file size confirm the default of 1 MByte. The file will grow as necessary. Given a sufficiently fast CPU and disc this will not cause frames to be dropped. The act of setting a file is important, otherwise you are liable to overwrite a previous recording.
- Use Capture : Start Capture, check that the file name to be used is correct, confirm.
- Wait for the recording to complete according to the time limit, or use Capture : Stop Capture to stop the recording prematurely.
The AVI file always seems to contain 24 bit colours, even if the webcam generates grey or even 8-bit grey data. The size of the AVI file amounts to 1.1 or 1.2 Byte/pixel. Do not record more than 2500 frames (500 s at 5 Hz) at 640x480 or 10000 frames (18500 s at 0.54 Hz) at 320x240 in a single AVI file. Otherwise software further down the line may have problems as the memory requirement exceeds 2 GByte. Translated into AVI file size this limit is about 650 MByte.
Windows Media Player shows black frames if the data are grey. xamin (on Linux) plays the AVIs written by VRecord in corrupted form and possibly with crackling sound. avi2bmp reads these AVI files fine.
AstroVideo is among the best software I have come across. It comes from COAA, an amateur astronomy society in Portugal. This is a 21-day trial copy and costs $ 29 plus VAT to register for permanent use. It makes a very good job of things, working in 32-bit FITS or AVI. It deals with colour - when required - by keeping three 32-bit FITS files. Besides acquisition of data, this can guide your telescope and perform data reduction tasks, including weeding your frames to pick the best ones and stacking them into a reduced-noise image.
|AstroVideo 2.5.8 main window. The user is just about to ask for the sharpest AVI frames to be found and converted to FITS. These can then be stacked into a single FITS image.|
The principal window shows two images. On the left is the last image obtained from the webcam. On the right is the last image written to disc, or an image read back for processing. The disc images have the three colours added up into a grey image (or stored separately in three FITS files).
AstroVideo distinguishes frames, frame groups and captures. A capture is obtained - after setting up its parameters - by clicking a button. A capture consists of a certain number of frame groups, each being written to disc in one 32 bit FITS format image. Each such frame group in turn is a stack of a certain number of frames obtained from the webcam. The frames of a group are stacked blindly in real time.
While the frames are obtained as fast as possible (QuickCam VC) or at the agreed frame rate (ToUcam Pro), there is optionally a lapse time between successive images. This is expressed as an integer in milliseconds, but values as large as 30000 ms have been used without problem. The number of frames in an image is limited to 9000.
Due to the long per frame exposure time, for the QuickCam VC AstroVideo is liable to use each frame several times. This is not AstroVideo's fault, qastrocam does the same. This causes confusion in the data reduction, although it does not do any actual harm.
Apparently, the QuickCam VC generates more noisy frames when AstroVideo grabs frames at the highest rate it can. This is significant at 40 per cent more noise, requiring a doubling of the number of frames to reach the same stacked noise level. My workaround is to write each frame as an image to disc and to set an inter-image (and hence inter-frame) time lapse of at least the greater of 500 ms and the frame exposure time. This of course causes disc space problems, and I have devised a programme that will check newly created FITS files whether they can be converted from 32 bit to 16 or 8 bit.
Alternatively, AstroVideo can now also write all frames to an AVI file. Unlike VRecord's AVI this is more compatible, in that xanim on Linux shows it fine. AVI is an attractive recording format, as it is fast and small on disc. Conversion to FITS can happen at a later time, either with AstroVideo or with avi2bmp.
An important feature of avi2bmp is that it allows visual inspection and selection of frames before converting them to FITS. Similarly, AstroVideo can select so many sharpest frames from a range of frames in an AVI. It does this by itself not by the user inspecting frames. Manual weeding is also possible. Finding the best frames automatically is potentially a huge time saver. I found it worked very badly on a recording of sunspots with passing transparent cloud, but it seemed very good on a recording of Saturn in very good seeing.
If you don't want to buy AstroVideo, don't have a good AVI recorder from your webcam manufacturer, or want FITS files straight away, then Vega is for you. This was written by Colin Bownes and the website is at http://www.ncare.co.uk/qc/. Vega also has a number of bells and whistles that can be useful when trying out things.
|Vega 1.2.2 main window with oscillograph display below the image display.|
|Vega 1.2.2 main window with capture setup below the image display.|
The main element of the interface is the real-time colour display from the webcam. Top right are three gauges showing the minimum and maximum image values. The third gauge shows the efficiency of frame grabbing: Reduce the frame rate until this shows 100. Below the image display can be several different sets of widgets. One I use quite often is the oscilloscope, which is turned on and off by clicking the Scope button. The other set is the default and allows to set the capture parameters. All these are pop-down menus, you cannot choose arbitrary values. Their order is a bit odd too, not sorted by numeric value. The labels always confuse me, Frames BMP and F/BMP in particular.
- AVI FPS:
- The frame grabbing frequency in Hertz. If I increase this beyond 3 or 4 the efficiency gauge goes below 100, indicating that the rate is too high. In spite of the name this affects not only AVI output, but also the stacking and writing of still images.
- The length of an AVI, if an AVI movie is captured.
- Frames BMP:
- The number of frames to stack for each writing of a frame group image to disc. In spite of its name this also affects FITS output.
- F/BMP To Save:
- The number of frame groups to write to disc as part of a single capture.
While most settings are remembered for the future, I have to click a few buttons each time I run Vega. By default Vega writes 24-bit BMP images and stacks frames by averaging them. This is not the best choice. Stacks should be sums of frames (controlled with the Avg button) and in order to store them we need more than 8 bit per colour, i.e. we need FITS output (Fit button). It will write three FITS files one for each of RGB, plus an average grey file. One can de-select colours with the Red, Green, and Blue buttons so as not to waste disc space on three additional FITS images.
Don't get me wrong, I'm all for averaging rather than taking sums, but since Vega (and AstroVideo) works with integers and not floating point numbers, averaging is the wrong choice. If on top of that your integers can only grow up to 255 (i.e. BMP output) then, however, you have to average to avoid saturation. So you see, I'm all for using floating point numbers.
For the QuickCam VC the main advantage of Vega over AstroVideo is the possibility to choose a frame grabbing rate.
Apparently, Vega cannot work at 640x480: It shows and writes only the top left quadrant of the image.
This is a conversion utility that reads AVI movies and writes BMP or FITS frames. For FITS it can average RGB to grey or it can write each colour in its own FITS file. avi2bmp is available from http://avi2bmp.free.fr/.
avi2bmp does not simply convert the whole movie. We can browse through the frames and select and deselect individual frames. Unfortunately the only shortcut is to de-select all frames; it would be nice if one could select a range of frames, say with a single shift-click.
A limitation appears to be that only about 2 GByte of memory can be used on the decompressed 24 bit data. This is a magic number in computing, so this is not an arbitrary limit that the programmer could have avoided.
|avi2bmp 0.50a after loading an AVI.|
|The avi2bmp application's Options : Paramètres : Sauvegarde dialogue.|
|The avi2bmp application's Options : Paramètres : Sauvegarde : Paramètres FITS dialogue.|
First time you run avi2bmp, take the time to fill in the default parameters for saving FITS files.
- Open the dialogue Options : Paramètres : Sauvegarde.
- Set Répertoire to e.g.
D:\webcam\avi1, a directory in which you create subdirectories to contain image sequences for further processing.
- Tick Numérotation complétée avec des 0 so that the file names in the image sequence have zero-padded sequence numbers.
- Select Format FITS (dédié Astronomie).
- Click the Paramètres FITS button to open up another dialogue.
- Choose Format 8 bits, as this should be sufficient for one frame or colour channel per FITS image.
- Choose Moyenne RVB if you work in grey, Séparation des couches RVB if you work in colour.
In normal operation, these are the steps to take:
- Use Fichier : Ouvrir to open an AVI file. This will always return to the last directory read from. Once the AVI has been read, the list of frames is shown on the left, the first frame selected and shown on the right.
- If some frames are bad, due to wind buffeting, turbulence, cloud passing, etc., inspect all frames visually and tick the good ones on the list. You can use the cursor up/down keys to navigate and the space bar to toggle the tick.
- Use Fichier : Enregistrement par lot to open up the dialogue prior to saving frames to a sequence of FITS image files.
- Select Toutes les images if all images are good, Images marquées if the good images are ticked.
- Optionally amend the output directory, which by default is as set in the default parameters above. You may want to use a separate subdirectory for each AVI, each object, etc.
- Optionally amend the FITS parameters, say, if you want to write separate colour channels instead of a grey channel only, or if you think 16-bit FITS is better this once.
This application was written by Alexander Milukov and is available from http://www.am-soft.ru/aviedit.html. You are free to evaluate for 30 days, thereafter you have to register your use for $ 25. I don't think this is written with astronomy in mind, just a utility to mess around with movies and movie frames. You could use it to find a sequence of frames with good seeing, write them to a separate AVI or a set of BMP files and then use AstroStack to stack them together.
I don't have AVIedit installed, as it is not free and avi2bmp can do what I really need.
This was written by Robert J. Stekelenburg and is available from http://www.astrostack.com. It is freeware. The idea is to stack a number of frames into a single better image. It works from AVI or BMP.
I don't have AstroStack installed, as this is data reduction, which I do under Linux.
Red Hat Linux 8.0 comes with an application called xawtv. This is intended for those with a TV tuner in their computer, but it can also use a webcam instead of the data from a video grabber.
xawtv will show the real-time display from the webcam and it can take snapshots into JPEG or PPM format when the user hits a key on the keyboard. It can also record movies.
xawtv has only very generic camera controls, which makes it unsuitable for our purpose.
From Nemosoft Unv. - the makers of the
pwcx-i386.o drivers for Philips and other webcams - comes this
application. Source code can be found at
and it builds without problems. Its strong point is full access to the Philips
webcam configuration, combined with a real-time display. It can also take
snapshots in JPEG, PNG, PPM or BMP.
Snapshots can be scheduled, which gets us closer to the concept of a capture composed of a pre-determined number of frames. However, the shortest time span between snapshots is 1 s. Although this might be ok for some purposes, it loses us a lot of the data we could potentially extract from the webcam.
This was written by Cory Lueninghoener's and can be obtained from http://csce.unl.edu/~cluening/gqcam/. This should work for all webcams with a Video For Linux (V4L) driver. All the Linux drivers discussed here are such drivers. gqcam can take sequences of PPM snapshots and uses the Unix time (the number of seconds since 1970/01/01-00:00:00) in the file names. So with the QuickCam VC it would be feasible to schedule such snapshots every 2 s, just like one can do in qastrocam, or indeed CamStream. But captures at higher frame rates and periodic captures are not possible. This was not written for astronomy, after all.
To build gqcam you need the Gimp Tool Kit (GTK) installed for development.
For my Red Hat 8.0 system that meant I had to add the gtk+-devel and glib-devel
packages, gtk+ already being there. gqcam defaults to using
/dev/video as the video device special file, but that does not
work on a Red Hat system. Invoke instead as
gqcam -v /dev/video0
With the QuickCam VC gqcam works quite well, although what the interface calls "white balance" appears actually to be the exposure time. gqcam does not appear to work with the ToUcam Pro.
This was written by Franck Sicard and can be downloaded as source from
Building is not so straighforward, as the instructions have not been updated
for a couple of software versions. But more to the point, the build recipe
assumes that the Qt graphics library is in
Red Hat 8.0 it is in fact in
/usr/lib/qt-3.0.5. So you have to
run make with this setting:
Even then the build does not complete. That's not an actual problem, but
adds to the confusion. The build process stumbles on building a second
application, but qastrocam itself has been built and placed in the
./bin sub-directory. If you follow instructions and look for it
./src/qastrocam you will again be confused. Don't be tempted
to move the executable, it looks for icons in a directory specified relative to
its own location. Final confusion: just running the command only gives us a
pile of help messages. To get display from and control of the webcam we have
to invoke this as
But apart from that it seems to be a good choice. Since it was written for the pwc/pwcx driver it provides complete control of the ToUcam Pro.
qastrocam works with the QuickCam VC as well, but then shows only the brightness and contrast controls. So one has to use CamStream beforehand to adjust the exposure time (called "Gamma" in the dialogue) to maximum, and also to change the colour saturation to zero.
|qastrocam main window after opening the webcam as source.|
|qastrocam dialogue to set brightness, contrast, etc.|
There is a choice of output formats. Attractive would be PNG because of its compression, but it costs too much time and the data recording can then not keep up with the webcam frame rate. PPM is a 3 Byte/pixel colour format while PGM is a 1 Byte/pix grey format; both are part of Netpbm.
To take a capture, adjust the number of frames in the upper text field and hit the capture button. You can also set up taking such captures at regular intervals. Apart from the none setting there are two, to take regular snapshots (single frame after each interval) or to take regular captures (a set of frames after each interval). If you use this, return to none to stop the schedule.
A snapshot is saved to the present working directory with the date and time included in the name of the file. A capture is saved into a sub-directory inside the present working directory. The sub-directory is named after the date and time and contains numbered graphics files. The time is well-ordered, year followed by month followed by day, hour, minute and second.
With the ToUcam Pro everything is aware of the frame rate of 5 Hz, but with the QuickCam VC qastrocam there is no agreed frame rate. The system gets very busy, presumably this is qastrocam grabbing frames as fast as possible. At maximum exposure time (1.83 s) the webcam delivers a different frame only every 1.83 s, but qastrocam will write a frame into a PGM file very 0.6 s. So each distinct frame will be recorded three or four times, which is a waste of disc space and is liable to confuse our calculation of total exposure time.
Such duplicate frames can be eliminated later (cf. Reduction / Grey / Renaming). Alternatively one can take scheduled snapshots every 2 s instead of a capture. This wastes 10 per cent of time because the interval is that much longer than the webcam frame rate.
The table below tries to list the best settings for bright object imaging with the ToUcam Pro VGA and for faint imaging with the QuickCam VC. For completeness faint imaging with the ToUcam Pro SIF is also included.
|Frame rate||5||0.55 / 1.67||5|
|Colour balance||33 / 19||Outdoor|
- Contrast seems to have no effect for QuickCam VC.
- For QuickCam VC the frame exposure is set as Gamma in CamStream or as White blance in gqcam. Those interfaces seem to give access to the exposure time under these false names.
- For QuickCam VC and maximum exposure time the webcam frame rate is 0.55 Hz and qastrocam's recording frame rate is 1.67 Hz.
- For ToUcam Pro VGA the colour balance is the result of an automatic balance on the Moon.
- The saturation cannot be selected from qastrocam, this is set in CamStream once and left alone.
- The image size cannot be selected from qastrocam and is not inherited from a previous CamStream run. Rather it has to be selected by removing and re-inserting the pwc.o module with the appropriate size option (cf. Driver / ToUcam Pro / Linux).
- Where CamStream or gqcam are needed to make settings, these are run before qastrocam.
Astro BV from http://www.ra-dec.de is supposed to have a "driver" for v4l (Video for Linux) that should pick up the Philips webcam and has a separate application to acquire images from the driver. Due to this distinction and due to the way they communicate, the driver can be on a different networked computer than the application.
On top of that the application is written in Java and can therefore run on any operating system with a Java Virtual Machine installed. The driver is also written in Java, but necessarily depends on the operating system. It appears that the Linux driver is not ready yet and not included. Its source code can apparently be obtained from the author.
I'm trying the test/free version here. The base version can be purchased for € 98.
Copyright © 2003 Horst Meyerdierks
$Id: acquire.shtml,v 3.3 2004/02/21 18:13:39 hme Exp $