Jump to content

Banner.jpg.b83b14cd4142fe10848741bb2a14c66b.jpg

Video grabbing in Linux


Breakintheclouds

Recommended Posts

Seeing as I had to solve this problem last year, here are the results in case anybody finds them useful.

First, AverMedia seems to be the only company who make video capture dongles with Linux drivers. You can check on their website which models work with Linux.

I was using my computer with a Mintron frame-accumulating camera. The difficult bit was capturing only every n-th frame when in slow grabbing mode. I did this with the following script that I called 'slastrobgrab':

#!/bin/bash

# slow-speed (or, more strictly, variable speed) astrocamera grabber with

# live preview. Uses mencoder and mplayer. Assumes video capture device is

# at /dev/video1. Designed using AverMedia HX device, which specifies

# input=2 to get the s-video input. May need tweaking for other devices,

# but the mplayer manual has lots of detail.

if [ $# -lt 2 ]; then

echo "Usage: slastrograb outputfilename fps [seconds_to_record (default 20)]"

echo "Typical fps settings"

echo "x1 50"

echo "x2 25"

echo "x4 12.5"

echo "x8 6.25"

echo "x12 4.17"

echo "x16 3.13"

echo "x24 2.08"

echo "x32 1.56"

echo "x48 1.04"

echo "x64 0.78"

echo "x96 0.52"

echo "x128 0.39"

echo "x256 0.20"

exit

fi

REC_FPS=$2

if [ $# -gt 2 ]; then

ENDPOS=$3

else

ENDPOS=20

fi

mencoder tv:// -tv driver=v4l2:device=/dev/video1:input=2:fps=$REC_FPS:outfmt=yuy2 -ovc lavc -lavcopts gray:vcodec=mpeg4 -endpos $ENDPOS -nosound -o >( tee $1 | mplayer - -cache 64)

(NB: See the smiley? THat should be a colon followed by a lower-case letter o. Change it in your script! I can't see to stop the board making it into a smiley.)

And similarly, for full-speed video grabbing, a script I called 'astrograb':

#!/bin/bash

# full speed astrocam grabber with live preview

# Uses mencoder and mplayer. Assumes video capture device is at /dev/video1.

# Designed using AverMedia HX device, which specifies input=2 to get the

# s-video input. May need tweaking for other devices, but the mplayer manual

# has lots of detail

if [ $# -gt 0 ]; then

if [ $# -gt 1 ]; then

ENDPOS=$2

else

ENDPOS=20

fi

mencoder tv:// -tv driver=v4l2:device=/dev/video1:input=2:outfmt=yuy2 -ovc lavc -lavcopts gray:vcodec=mpeg4 -endpos $ENDPOS -nosound -o >( tee $1 | mplayer - -cache 256)

else

echo "Usage: astrograb outputfilename [seconds_to_record (default 20)]"

fi

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. By using this site, you agree to our Terms of Use.