lundi 8 juin 2015

Script stopped working (not even an error output anymore), whats wrong?

I was wondering why my script suddently stopped working.

Here is what it does basically:

Check a directory for a specific file extension (.avi videos recorded trough motion), calling avconv to convert them to webms, removing the original file and moving the new WebM-file to another location. After all there shall be an echo with $video-file-name has been created.

I've changed the old ffmpeg to avconv today and retried, but from now on the script doesn't work anymore. Whats weird: if I change it back it also seem not to work anymore and I have no clue what I've done wrong. Hint: I'm a total beginner at bash.

Heres my script:

#!/bin/bash

DEST_PATH=/var/www/assets/webm/

for file in /var/www/motion/video/*; do
        if [ ${file: -4} == ".avi" ]
        then
                varvid=${file##*/}
                varvidr=${file%.*}
               #ffmpeg -i ${varvid}.avi -acodec libvorbis -ac 2 -ab 96k -ar 44100 -b 345k -s 640x360 ${varvidr}.webm
                avconv -i ${varvidr}.mp4 -acodec libvorbis -aq 5 -ac 2 -qmax 25 -threads 2 ${varvidr}.webm
                # Remove AVI and move WEBM to desired dir as clarified in $DEST_PATH
                rm ${varvidr}.avi
                mv ${varvidr}.webm ${DEST_PATH}
                printf "\n"
                printf "$varvidr.webm wurde erstellt.\n"
        fi
done

My now output is:

pi@raspberrypi ~ $ sudo ./video-compile.sh pi@raspberrypi ~ $

Can someone please help me with my beginner question? If you need further information, just ask.

Thanks in advance, Max

Aucun commentaire:

Enregistrer un commentaire