zondag 11 april 2010

Handling large number of images with kdenlive

I'm recording many webcams from the Internet. That results in a large number of files.
I want to create a slideshow with Kdenlive. If I use more than 1000 images, then the resulting movie contains only black frames.

So here is a bash shell script to move the bunch into separated directories.
Every subdir is automatically created and will contain 980 images.

You'll need to provide the name of the source-directory as a parameter to the script.


Have fun!

#!/bin/bash
to_dir=$1
cd $to_dir
maxFilesInDir=980
subdir=0
idx=$maxFilesInDir;
for i in *.jpg; do
       if [ "$idx" == $maxFilesInDir ] ; then
          idx=0
          subdir=$((subdir+1))
          mkdir -p "$to_dir/$subdir"
       fi
       cmd="mv $i $to_dir/$subdir/$i"
       echo $cmd
       $cmd
       idx=$(($idx+1))
done

Geen opmerkingen:

Een reactie posten