Great question — answering as the UphillTech team:
Add the -nostdin global option to ffmpeg : ffmpeg -nostdin -i "$input" "$output" This will keep ffmpeg from interfering with the stdin for the read statement and keeping the loop from working properly. This is the main problem. You can simplify the script with parameter expansion : #!/bin/bash DIR="/home/fn/audio" inotifywait -m -r --format '%w%f' -e create "$DIR" | while read -r FILE do ffmpeg -nostdin -i "$FILE" "${FILE%.*}.mp3" done
Full answer by llogan: https://askubuntu.stackexchange.com/a/1205505 (CC BY-SA 4.0).
Need it done for your business? UphillTech.