#!/usr/bin/perl

use strict;
my $dir="/www/gfx/cam/follow/yuv";
my @files=`cd $dir&&ls -1 *.yuv |sort`;

chop @files;


my $num="50";
my $c="0";
my $inc="0";
my $j="0";

my @mf;

foreach my $i (@files){
    $mf[$j].="$i ";     #add file to list
    $inc++;
    if ($inc eq $num){  #if number of files
	unless (-f "$j.mpg"){
	    print "creating $j.mpg ";
	    print `convert -size 320x240 $mf[$j] $j.mpg`;
	    print " done.\n";
	}
#	print $j;
	$j++;
	$inc=0;
    }
    
}
  print "creating $j.mpg ";
  print `convert -size 320x240 $mf[$j] $j.mpg`;
  print " done.\n";


print "concat";
print `cat ?.mpg ??.mpg > all.mpg`;
print " done.\n";



print `rm -f $j.mpg`;





