ffmpeg in a bash pipe

Caveat: I’ve never used ffmpeg, but in working with other questions concerning the program, it appears that, like ssh, ffmpeg reads from standard input without actually using it, so the first call to Convert is consuming the rest of the file list after read gets the first line. Try this

Convert() {
    ffmpeg -i "$1" -vcodec mpe4 -sameq -acodec aac \
           -strict experimental "$1.mp4" < /dev/null
}

This way, ffmpeg will not “hijack” data from standard input intended for read command.

Leave a Comment