Hello,
I have a question regarding while loop and existence of files.
I am running under ubuntu 18.04 bionic, have around fifty video files inside the directory.
What I wish to do is to prevent receiving "srt file not found" error in case there is no searched srt files inside the directory. If I don't do that, process fails.
For example,
File1.mp4 -> I have only File1.bs.srt and File1.da.srt
File2.mp4 -> I have only File2.slo.srt and File2.sv.srt
When File1.mp4 is in use, it will just take File1.bs.srt and File1.da.srt, and will skip File1.slo.srt and File1.sv.srt
Hmmm - not that simple. Would ffmpeg accept reading from /dev/null (to substitute a non-existing .srt file)?
And, you don't need the basename for files in your working directory.
And, you could use "brace expansion" to have the shell create the include file list:
Dear Rudic,
If you have any recommendations I would try at my end.
I thought that if I can store each mp4 file and related srt files in the same directory (I mean fifty different directories, for file1 only file1.mp4 and related srt files, for file2 a new directory with related srt files etc.. ), I may list all files and store in a new file and then echo what I need. A bit complicated I think.
ls -a > file_list
for file in *.srt
do
echo "ffmpeg ..."
done > edit.sh
chmod 755 edit.sh
./edit.sh
By the way, Scrutinizer gave a reply but I can not see his post under the same thread..
The only problem regarding your first solution is that we can not grab the "language" field. I will test the second one when I show up to my house. On my way to home...
As per your question, I have to edit the script as follows, that was my fault.
I should have mentioned that language field has relation with srt field.
tag of srt extension refers to language. If it finds *.bos.srt, it will put language=bos , bosnian language etc.
if it finds slo.srt, language should be language=slo etc.. Metadata nr increases as more srt file is found as it goes.
No, not much... Language names are variable and connected to found srt files but not a big problem Rudic. Thank you so much for your support. I will find a way to sort the last part.