I am a novice coder using Terminal on MAC that has installed FFMPEG and attempting to edit an entire directory.

My goal is to remove all of the audio from all of the videos and output or overwrite the existing files. I was successful in writing a line of code that inputted and outputted ONE file accurately, however, when I attempted to adapt the code others have posted across the web, the terminal would time-out or error. Attached are a couple of screenshots of what happens for two of the scenarios I thought was sure to work:

Screenshot one: enter image description here

Screenshot two: enter image description here

  • 1
    Next time posting code, please copy-paste the code into the editor. Screenshots are hard to read and copy from. Thanks!
    – slhck
    May 4, 2022 at 15:33

1 Answer 1


The problem is that the code you adapted was intended for .avi files, not .mp4, so you are trying to replace a string that does not exist.

The following would work:

for f in *.mp4; do
  ffmpeg -i "$f" -an -c:v copy "${f/%.mp4/-noaudio.mp4}"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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