Hi all, I wanted to share a solution to a problem I was having, in case someone else finds it useful.
There's a free program for Linux called "Stopmotion," which lets you capture and preview animation. Unfortunately, it's meant for webcams. So even if you can turn your DSLR camera into a webcam, it will just grab the latest frame from the live preview, instead of triggering a shuttered exposure.
Here is how you can fix that: First install gphoto2, which is a command-line tool for controlling cameras. Then in Stopmotion, go to Settings -> Configure Preferences -> Video Import tab. Then "Add" an option and give it a name. Next click Edit and add this command to the "Start daemon" field:
yes | gphoto2 --capture-image-and-download --keep --filename=$IMAGEFILE
Finally apply and close.
To capture a frame, press C or the "Toggle camera on/off" button. This should trigger an exposure on the DSLR. (Note you may have to "unmount" the camera from the computer's taskbar after plugging it in. Otherwise the Linux file browser and Stopmotion will be in competition for the USB port.)
Then to add that frame to the animation timeline, press Space or the "Capture frame" button. Finally you have to press C or the "Toggle camera on/off" button again. This will let you scrub through the captured frames and decide whether to keep the latest one. (You could also press C, then Space.) Note this solution doesn't give you a "live preview" with onion-skinning.
When you're done animating, you can get the images by making a copy of the Stopmotion project file and changing the file extension from .sto to .tar. Then uncompress it and find the image files inside that directory. Or, to export to a video, you can use the File -> Export -> Video option.
You may need to configure the Video Export options in the Preferences window. Some or all of the default options give you a video with lossy compression. Here is one way to get a lossless export: First make sure you have ffmpeg installed. Then add an option with this command in the "Start encoder" field:
ffmpeg -y -framerate $FRAMERATE -i "$IMAGEPATH/%06d.jpg" -codec:v copy "$VIDEOFILE"