I am trying to extract parameters from video files with ffprobe and process depding on these results. However i am not able to pass the files properly to ffprobe if they contain whitespaces.
echo $1
inputfile=$(printf '%q' "$1")
#inputfile=${1@Q}
echo $inputfile
ffprobeout= ffprobe -v error -select_streams v:0 -show_entries stream=width,height,bit_rate -of csv=s=x:p=0 $inputfile
when i now call a smaple file with
files2reenc.sh "test file with spaces.mp4"
it results
test file with spaces.mp4
test\ file\ with\ spaces.mp4
Argument 'file' provided as input filename, but 'test' was already specified.
So ffprobe sees every part of the name as seperate file and does not recognize it as one parameter. I'm not sure how to pass/escape my input so it would work as expected. I'm not sure if the problem is already when invoking my bash script or with the way i try to handle input paramter. I also tried using
echo $inputfile | xargs -0 ffprobe ...
with no success.