I run the following bash script to rotate my mobile phone vids
while read filename ; do
nf=$(echo $filename |rev | cut -f1 -d '/'|cut -f2- -d '.' |rev)
echo $nf
rm -f ffmpeg2pass-0.log
rm -f rotate/tmp.avi
ffmpeg -i $filename -c:v libxvid -pass 1 -c:a libmp3lame -qscale:a 4 -vf "transpose=2,transpose=2" "rotate/tmp.avi"
ffmpeg -i $filename -c:v libxvid -pass 2 -c:a libmp3lame -qscale:a 4 -vf "transpose=2,transpose=2" "rotate/$nf.avi"
done <rotatelist_2
I know there are better ways to do this; I budged this together but I'm figuring out how to do the videos right so the rest don't need to look nice ;-))
However after the first run, the loop unexpectedly ends with no error message. I run similar loops for other things which work pretty well.
The echo is not called again so I guess there's something wrong with the loop itself. The linebreak in the list is a 0x0A, so it should be ok.
rotatelist_2?rotatelist_2. It looks like it would have to beffmpegthat does that, so I don't rate it highly as a possibility. You could usewhile read -u 3 filename; do ...; done 3<rotatelist_2and see if that solves the problem.basename. This assumes the filename extension is always the same, if it isn't, something like${x%.*}will do (details under Remove matching suffix pattern. in the bash man page)"$filename"will deal with spaces, glob characters, etc. within names correctly; bare$filenamewon't. shellcheck.net will do the work of finding bugs of this variety for you.