Need some help with ffmpeg & a shell script which cannot find files

I’m encoding a set of video files with ffmpeg, to do so I wrote this script which I then call on in the folder containing the files.

for i in *.* ; do
	ffmpeg -i $i -c:v libx265 -crf 20 -preset fast -c:a aac -b:a 192k "$i.mkv"
	sleep 3

This worked for the first season/subdirectory of files, but now it cannot seem to find the files in the second subdirectory. There should be no difference, it follows the same structure e.g. /nameofshow/season 02/filename.ext

Instead it returns nameofshow: no such file or directory, despite being called on from the directory it supposedly cannot find, but was able to do so earlier. I have not unmounted the disk or modified the structure at all.

Permissions are identical to Season 01 (which encoded without problems), and running the script with sudo does not make a difference.

This encoded fine:

/mnt/D1/TM/completed/RWBY/SEASON 01/RWBY-S01E01.mp4

This returns an error

/mnt/D1/TM/completed/RWBY/SEASON 02/RWBY-S02E01.mp4

RWBY: No such file or directory

This is the first time I’m working with ffmpeg, so I could use some advice on how to proceed. Any ideas?

Try replacing $i with ${i} or "$i" so the spaces are handled properly.


Thanks, this resolved it!


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.