Jack000
Jack000

Reputation: 157

mysterious error with ffmpeg on OSX

There seems to be a bug in my bash script, and after a long time I managed to reduce it to this test case:

find . -maxdepth 1 | while read blah
do
    echo "$blah"
    ffmpeg -loglevel error -i ./test.jpg -f null /dev/null

done

the output from this is

/test.jpg
/test.mp4
/test.sh

if I remove the ffmpeg invocation, the output becomes this (what I expected):

./test.jpg
./test.mp4
./test.sh

this seems to occur only when the ffmpeg decoder is activated, as ffmpeg -version doesn't produce the error. Why would ffmpeg affect an unrelated string in this way?

I'm at my wit's end, any help would be appreciated.

Upvotes: 2

Views: 426

Answers (1)

Zombo
Zombo

Reputation: 1

FFmpeg is eating your standard input. Do like this instead:

find | while read
do
  ffmpeg -nostdin
done

Creating forks of `ffmpeg` in loop inside a shell script "loses" some iterations

Upvotes: 3

Related Questions