SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2010-04-22 19:37:19

olembe
#! Junkie
From: Salisbury, England
Registered: 2009-04-29
Posts: 263

Analogue video capture in Linux, recording and echoing video to screen

I recently needed to capture analogue video from an astronomical camera (which is basically a modified low-light surveillance camera). Of course, it's easy in Windows, but I was determined I wasn't going to boot into the Partition of Doom if I could possibly help it. So I thought I'd post the fruits of many hours of web-searching here in case it's useful to anybody.

First, you need a video capture device. This is a nightmare for Linux, as you'll find if you start to search the web, but luckily it turns out there's one hardware company that genuinely does offer Linux support - AverMedia. Their Hybrid HX USB capture device (http://www.linuxtv.org/wiki/index.php/A … _HX_(A827)) works on Linux with a driver you can download from their site. It creates several new devices in /dev/ when plugged in, including /dev/video1 on my computer (/dev/video0 is my inbuilt webcam). It also acts as a fully-functioning DVB-T digital television receiver.

For my astronomical purposes, I needed to be able to (a) capture full-speed video (for recording planets) and (b) slow-motion video (for deep-space objects). So I created two short scripts calling mencoder and mplayer. Each of these records to disk and, at the same time, echoes the video to the screen.

Full speed video script, which I saved as ~/bin/astrograb:

#!/bin/bash

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

Slow-motion capture, which I saved as ~/bin/slastrograb:

#!/bin/bash

if [ $# -lt 2 ]; then
    echo "Usage: slastrograb outputfilename fps [seconds_to_record (default 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)

These scripts, which I assembled from various online tips, are useful for other video grabbing applications too, such as grabbing from your webcam if you want to see the results live - the key is the tee command at the end of the mencoder line.

If you're not using the same AverMedia capture card then you probably won't need the "input=2" part of the mplayer command. This part is just to tell mplayer to read the dongle's s-video input.

Offline

Help fund CrunchBang, donate to the project!

#2 2011-07-29 19:52:01

industrialphreak
Member
From: K
Registered: 2009-06-30
Posts: 20
Website

Re: Analogue video capture in Linux, recording and echoing video to screen

Any idea chief concerning the BT878 chipset analog capture cards?

I want to be able to eventually use this, it show up under gnome-device-manager but is "unknown" its a standard pci card.  found this guid for sarge at http://forums.debian.net/viewtopic.php?t=1567

but when i do this command in terminal it give me the following printup


industrialphreak@crunchbang-AMD64:~$ rmmod bt878
ERROR: Module bt878 does not exist in /proc/modules

any idea folks and i did the following command should i be worried about the additional line in their?

industrialphreak@crunchbang-AMD64:~$ modconf->
bash: syntax error near unexpected token `newline'


Any intelligent fool can make things bigger and more complex... It takes a touch of genius and a lot of courage to move in the opposite direction.
-Albert Einstein.

View my blog http://www.industrialphreak.blogspot.com/

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo