1

I call ffmpeg like this from Mac's terminal:

$ find . -type f -name *.webm | while IFS= read -r f; do echo "$f"; ffmpeg -i "$f" "${f%.webm}".mp4 2> ~/Desktop/err; done

Only the first file returned by find gets processed:

./artist/Moody Blues/_vid/Nights in white satin_lyrics.webm

Excerpt from err:

Enter command: |all |-1 [ ]

Parse error, at least 3 arguments were expected, only 1 given in string 's [360p].webm'

Enter command: |all |-1 [ ] Parse error, at least 3 arguments were expected, only 1 given in string 'hannel/Ash Wainman/_Inbox/BOHEMIAN RHAPSODY - ASH WAINMAN[HD,1280x720].webm'

We should have 'channel' rather than 'hannel'.

  • My guess is that although you are correctly quoting "$f" to prevent filename expansion by the shell, ffmpeg itself is treating part of the filename as a pattern for expansion. You may find something relevant here FFmpeg formats – steeldriver Feb 5 '18 at 20:06
  • There is not dash before channel: ./channel – Erwann Feb 5 '18 at 21:05
  • It looks like ffmpeg is entering interactive mode. – wurtel Feb 6 '18 at 14:57
  • 2
    Try $ find . -type f -name "*.webm" | while IFS= read -r f; do echo "$f"; ffmpeg -nostdin -i "$f" "${f%.webm}".mp4 2> ~/Desktop/err; done – llogan Feb 8 '18 at 19:57
  • How do I mark this questn 'solved'? – Erwann Feb 11 '18 at 18:34
0

As LordNeckBeard suggests, adding -nostdin stops ffmpeg from attempting interaction (or, apparently, reading its inherited stdin.)

This is touched on in the man page:

-stdin
       Enable interaction on standard input. On by default unless standard input is used as an input. To explicitly disable interaction you need to specify "-nostdin".

       Disabling interaction on standard input is useful, for example, if ffmpeg is in the background process group. Roughly the same result can be achieved with "ffmpeg ... <
       /dev/null" but it requires a shell.
0

You're improperly using find and needlessly creating a shell loop (it hurts to read!), because you can (should) run ffmpeg directly from inside find:

find . -type f -name *.webm \
-exec sh -c 'echo "$1"; ffmpeg -nostdin -i "$1" "${1%.webm}".mp4 2>> ~/Desktop/err' sh {} ';'

With deference to LordNeckBeard (though mine is assuredly hairier).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.