In a while
loop ffmpeg
reads from std input
, consuming all the arguments at once. To prevent this behavior a common workaround is redirecting ffmpeg
's std input
to /dev/null
, as shown below:
tail -F /var/log/mylog.log | while read line
do
log "$line"
ffmpeg -i "from.wav" "to.mp3" < /dev/null
done
There are also other commands, such as ssh, mplayer, HandBrakeCLI
..., that display the same behavior in a while loop.