Skip to main content
added 357 characters in body
Source Link
Stéphane Chazelas
  • 585.1k
  • 96
  • 1.1k
  • 1.7k

One possible explanation is that one command in the loop is reading from stdin (which in this case is the same stream that read is meant to read from). As you found out, that would be ffmpeg which does allow the user to control the encoding over the keyboard (unless you pass the -nostdin option), hence the reading from stdin to get user input.

That's one of the several issues with looping over find's output that way.

Use the:

find ... -exec sh -c '
  for mp4file do
    ...
  done' sh {} +

standard syntax (where the stdin of sh and ffmpeg is left unaffected), or one of the other approaches described at Why is looping over find's output bad practice? which would also remove the problems with file names that contain newline characters (or $IFS contains 4 with your approach).

One possible explanation is that one command in the loop is reading from stdin (which in this case is the same stream that read is meant to read from). That's one of the several issues with looping over find's output that way.

Use the:

find ... -exec sh -c '
  for mp4file do
    ...
  done' sh {} +

standard syntax (where the stdin of sh is left unaffected), or one of the other approaches described at Why is looping over find's output bad practice?

One possible explanation is that one command in the loop is reading from stdin (which in this case is the same stream that read is meant to read from). As you found out, that would be ffmpeg which does allow the user to control the encoding over the keyboard (unless you pass the -nostdin option), hence the reading from stdin to get user input.

That's one of the several issues with looping over find's output that way.

Use the:

find ... -exec sh -c '
  for mp4file do
    ...
  done' sh {} +

standard syntax (where the stdin of sh and ffmpeg is left unaffected), or one of the other approaches described at Why is looping over find's output bad practice? which would also remove the problems with file names that contain newline characters (or $IFS contains 4 with your approach).

added 32 characters in body
Source Link
Stéphane Chazelas
  • 585.1k
  • 96
  • 1.1k
  • 1.7k

Most probably,One possible explanation is that one command in the loop is reading from stdin (so fromwhich in this case is the same stream that read is meant to read from), that's. That's one of the several issues with looping over find's output that way.

Use the:

find ... -exec sh -c '
  for mp4file do
    ...
  done' sh {} +

standard syntax (where the stdin of sh is left unaffected), or one of the other approaches described at Why is looping over find's output bad practice?

Most probably, one command in the loop is reading from stdin (so from the same stream that read is meant to read from), that's one of the several issues with looping over find's output that way.

Use the:

find ... -exec sh -c '
  for mp4file do
    ...
  done' sh {} +

standard syntax (where the stdin of sh is left unaffected), or one of the other approaches described at Why is looping over find's output bad practice?

One possible explanation is that one command in the loop is reading from stdin (which in this case is the same stream that read is meant to read from). That's one of the several issues with looping over find's output that way.

Use the:

find ... -exec sh -c '
  for mp4file do
    ...
  done' sh {} +

standard syntax (where the stdin of sh is left unaffected), or one of the other approaches described at Why is looping over find's output bad practice?

added 3 characters in body
Source Link
Stéphane Chazelas
  • 585.1k
  • 96
  • 1.1k
  • 1.7k

Most probably, one command in the loop is reading from stdin (so from the same stream that read is meant to read from), that's one of the manyseveral issues with looping over find's output that way.

Use the:

find ... -exec sh -c '
  for mp4file do
    ...
  done' sh {} +

standard syntax (where the stdin of sh is left unaffected), or one of the other approaches described at Why is looping over find's output bad practice?

Most probably, one command in the loop is reading from stdin (so from the same stream that read is meant to read from), that's one of the many issues with looping over find's output that way.

Use the:

find ... -exec sh -c '
  for mp4file do
    ...
  done' sh {} +

standard syntax, or one of the other approaches described at Why is looping over find's output bad practice?

Most probably, one command in the loop is reading from stdin (so from the same stream that read is meant to read from), that's one of the several issues with looping over find's output that way.

Use the:

find ... -exec sh -c '
  for mp4file do
    ...
  done' sh {} +

standard syntax (where the stdin of sh is left unaffected), or one of the other approaches described at Why is looping over find's output bad practice?

Source Link
Stéphane Chazelas
  • 585.1k
  • 96
  • 1.1k
  • 1.7k
Loading