Run FFmpeg from Shell Script
Posted
by Abs
on Stack Overflow
See other posts from Stack Overflow
or by Abs
Published on 2010-06-02T18:25:22Z
Indexed on
2010/06/02
18:44 UTC
Read the original article
Hit count: 195
Hello all,
I have found a useful shell script that shows all files in a directory recursively.
Where it prints the file name echo "$i"; #Display File name
.
I would instead like to run an ffmpeg command on non MP3 files, how can I do this? I have very limited knowledge of shell scripts so I appreciate if I was spoon fed! :)
//if file is NOT MP3
ffmpeg -i [the_file] -sameq [same_file_name_with_mp3_extension]
//delete old file
Here is the shell script for reference.
DIR="."
function list_files()
{
if !(test -d "$1")
then echo $1; return;
fi
cd "$1"
echo; echo `pwd`:; #Display Directory name
for i in *
do
if test -d "$i" #if dictionary
then
list_files "$i" #recursively list files
cd ..
else
echo "$i"; #Display File name
fi
done
}
if [ $# -eq 0 ]
then list_files .
exit 0
fi
for i in $*
do
DIR="$1"
list_files "$DIR"
shift 1 #To read next directory/file name
done
© Stack Overflow or respective owner