2

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.

Jack000
  • 157
  • 1
  • 10

1 Answers1

3

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

Community
  • 1
  • 1
Zombo
  • 1
  • 62
  • 391
  • 407
  • magic, that fixed it. I'm still not sure I understand what's going on, but I'll do some reading – Jack000 Oct 19 '15 at 01:53