Halloele,

Ich versuche verzweifelt DVB-Mitschnitte in ein anderes Format zu konvertieren. Das funktioniert soweit ganz gut, bis auf die Tatsache, dass nach einem erfolgreichen Aufruf von ffmpeg die while-Schleife nicht mehr weiterlaeuft.
Wo liegt da der Hase im Pfeffer?

Code:
#!/bin/bash

WORKING_DIR=$(pwd)
TARGET_DIR=$WORKING_DIR"/converted"
SOURCE_EXTENSION=".m2t"
TARGET_EXTENSION=".mpg"

# create target dir if not exists
if ! [ -d $TARGET_DIR ] ; then
    mkdir $TARGET_DIR 
fi

lenwork=`expr length "$WORKING_DIR/"`
lentarg=`expr length "$TARGET_DIR"`

# rename files
rename s/§/_/g         $WORKING_DIR/*.m2t
rename s/' '/_/g     $WORKING_DIR/*.m2t 
rename s/Ä/Ae/g     $WORKING_DIR/*.m2t 
rename s/ä/ae/g     $WORKING_DIR/*.m2t
rename s/Ö/Oe/g     $WORKING_DIR/*.m2t
rename s/ö/oe/g     $WORKING_DIR/*.m2t
rename s/Ü/Ue/g     $WORKING_DIR/*.m2t
rename s/ü/ue/g     $WORKING_DIR/*.m2t
rename s/ß/ss/g     $WORKING_DIR/*.m2t
rename s/,/_/g         $WORKING_DIR/*.m2t

# read all m2t-files in WORKING_DIR and ...
find -L $WORKING_DIR -name "*$SOURCE_EXTENSION" | while read name; do

    echo "=====>  $name  <====="

    lenwork=`expr length "$WORKING_DIR/"`
    lenname=`expr length "$name"`
    namefile="${name:lenwork:lenname}"

    # convert if target not exists or its size is 0
    if ! [ -s "$TARGET_DIR/$namefile$TARGET_EXTENSION" ] ; then

        ffmpeg -i "$name" -vn -ab 128k "$TARGET_DIR/$namefile$TARGET_EXTENSION" 
#        nice --adjustment=19 ffmpeg -i "$name" -vn -ab 128k "$TARGET_DIR/$namefile$TARGET_EXTENSION" 

        # delete src if target exists and > 0
        if [ -s "$TARGET_DIR/$namefile$TARGET_EXTENSION" ] ; then
            echo "==>     delete src file"
            rm $name
        else
            echo "==>     error: target after conversion not found "
        fi
    else
        echo "==>     target already exists"
    fi    
    echo "==>     file finished: $name"
done
Danke fuer die Muehen,
nimmernix