What I am trying todo is: I want to create a script on mac that monitors a folder and merge the videa and the audio. But if file01 exists (previous merge file) I want it to create file02 and if this one exists I want it to create file03,... I would be very happy if the older files could be deleted because of disk space. But this one is tricky because I monitor the folder through folder action setup on mac. This is what I get so far:
!/bin/bash
now=$(date +"%d_%m_%Y_%Hu%M")
cd "/Users/tomvanwinkel/Documents/Convert/Merge"
for filename in .mp4;
do
stub="${filename%.}"
/usr/local/bin/ffmpeg -i "${stub}.mp4" -i "${stub}.wav" -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 "${stub}_ok".mp4
FILE="${stub}_ok".mp4
if [ -f "$FILE" ];
then
cp "${stub}_ok".mp4 "${stub}_ok01".mp4
fi
done