#!/bin/bash

source ./fonctions.sh

PASS=666
DELAY=1 
DDIR="capture"
COUNT=1200

GVS=${HOME}/Devel/FloatImg/v4l2/grabvidseq
OPTIONS=" -v -g -c cos01 "
DEV=/dev/video0
SZ=720x576
NBRE=90
PERIOD=0.0

cat compteur

for pass in $(seq 0 $PASS)
do
	echo
	idx=$(cat WS/compteur)

	next=$(( idx  % COUNT ))
	printf "# ------- pass %3d/%3d   idx %5d   next %5d\n" 	\
			$pass $PASS $idx $next

	outfile=$(printf "%s/%05d.fimg" $DDIR $next)

	$GVS $OPTIONS -d $DEV -n $NBRE -p $PERIOD	\
			-s $SZ -o $outfile
	next=$(( $next + 1 ))
	echo $next > WS/compteur

done
