I have a bash script to do AI video upscaling but I am having problems getting the framerate in the source file and then using it in the ffmpeg command for the encode of the upscaled frames. I'm a bash newb so not sure what syntax i'm using is wrong.
#!/bin/sh
PS4='$LINENO: '
set -x
for arg
do
mkdir "${arg%.*}"
mkdir "${arg%.*}US"
cd "${arg%.*}"
fps = $(/usr/bin/mediainfo "$arg" "--inform=Video;%FrameRate%")
nice -19 /bin/ffmpeg -i "$arg" -qscale:v 1 -qmin 1 -qmax 1 -vsync passthrough frame%04d.jpg
cd ..
/Programs/realesrgan-ncnn-vulkan -i "${arg%.*}" -o "${arg%.*}US" -n realesrgan-x4plus -s 4 -f jpg
cd "${arg%.*}US"
nice -19 /bin/ffmpeg -framerate $fps -i frame%04d.jpg -pix_fmt yuv420p -c:v libx265 -crf 20 "${arg%.*}US.mkv"
rm -rf "${arg%.*}"
rm -rf "${arg%.*}US"
done
when I debug it looks like it gets the frame rate but then say command not found for some reason, when the ffmpeg command is used the frame rate is missing even tho I specify the $fps variable .
99: /usr/bin/mediainfo '/media/M2/vid.mkv' '--inform=Video;%FrameRate%'
9: fps = 30.000
/scripts/batchVideoUpscale: line 9: fps: command not found
and at the end>
nice -19 /bin/ffmpeg -framerate -i frame%04d.jpg -pix_fmt yuv420p -c:v libx265 -crf 20 vidUS.mkv
note that the frame rate of 30.00 is missing even tho I include $fps in bash script after -framerate.