I have the following function in a bash script. When I execute it, I always get a returned string from the ffprobe command containing an error in the form:
Argument '-' provided as input filename, but '/media/Testing/Sorted/badfile.mp4' was already specified.
I have tried moving the arguments to ffprobe inside the quotes for the filename (doesn't solve the problem). I have tried moving the arguments into an array and passing "${array[@]}" (doesn't solve the problem). Obviously I am missing something blindingly obvious here. Where am I going wrong?
# ProcessVideo
#
# Takes an input file name (presumably for a video file, but the function doesn't
# actually attempt to verify that), and hands it off to ffprobe to do some basic
# processing of the video stream. We set a flag so that any error encountered will
# cause ffmpeg to exit with an error code set. If ffmpeg sets an error code, we
# log the file name to a file.
#
# ProcessVideo <path to video>
ProcessVideo()
{
local vfn=$1
local ec=0
local oput
echo "Checking video $vfn"
oput=$(ffprobe -loglevel warning "$vfn" - 2>&1)
ec=$?
# if (( ec > 0 ))
# then
# echo "Error exit $ec $vfn"
# LogErr "Error exit $ec $vfn"
# fi
# if [[ "$oput" == *"moov atom"* ]]
if [[ -n "$oput" ]]
then
echo "Error string $vfn"
LogErr "Error string $vfn"
LogErr "$oput"
fi
}
Note that LogErr in the script above is another function - all it does is take the passed string and write it to a specified log file. If someone thinks that is relevant to the problem, I will post it, but I don't think it is.