0

I'm trying to execute a ffmpeg command on a list of video files, stored in an ascii file.

I simply tried to combine the reading of filenames with a while loop but it seems not to work. For some reason every video filename gets cropped

while read p; do 
    ffmpeg -i "$p" [some options] ;
done < filelist.txt

Any idea why this is happening?

filelist.txt looks like this:

video1.mp4
video2.mp4
video3.mp4
[...]
mcExchange
  • 6,154
  • 12
  • 57
  • 103
  • Could you provide an example of `filelist.txt` ? – 0stone0 May 20 '20 at 12:36
  • weirdly the same command is working fine when I use `for f in $(find .); do ...` instead. I used both commands frequently and interchangeably, it's weird that `while` fails in this situation – mcExchange May 20 '20 at 12:41
  • 3
    I have seen this problem before: `ffmpeg` reads the same stdin `while` is reading. Use `ffmpeg ... < /dev/null` or `-nostdin`. There should be a duplicate somewhere out there. If you find it, please link it. – Socowi May 20 '20 at 12:46
  • 4
    Found the duplicate: [bash script stops execution in while loop - why?](https://stackoverflow.com/questions/12543628/bash-script-stops-execution-in-while-loop-why) and [execute ffmpeg command in a loop](https://stackoverflow.com/q/21634088/6770384) – Socowi May 20 '20 at 12:49

0 Answers0