I recently wanted to remove the audio from a bunch of B-Roll I was giving to someone else, because lets face it, I’m always talking about something ultra-nerdy in the background.
In my case they were the MOV files straight out of the camera, and I wanted them put into a directory called `no-audio`. On linux or mac, you can do this:
for i in *.MOV; do ffmpeg -i "$i" -vcodec copy -an "no-audio/${i%.*}.MOV"; done
We make use of the ability to write small shell scripts on one line, as well as bash Parameter Expansion to allow us to form the new name out of the old name.
Thanks to the following Stack Overflow posts:
https://stackoverflow.com/a/33766147/1255970
https://superuser.com/a/484860
Windows cmdline/batch-file equivalent
rem windows interactive command line
@for %i in (*.MOV) do @ffmpeg -i “%i” -vcodec copy -an “no-audio\%~ni.MOV”
rem windows batch-file
for %%i in (*.MOV) do ffmpeg -i “%%i” -vcodec copy -an “no-audio\%%~ni.MOV”
The code you created led me down an incredible learning path and learning curve. Whenever I copy the code into my Terminal on MAC and I press enter, the next results in a greater than symbol “>” and nothing I type within the shell resolves to anything but more “>” symbols on the next line. Might you be able to help resolve this? Thank you for your post!
This normally happens if you’ve pasted a ‘\’ at the end of a line, which is how you tell bash you want to do multi-line input
Thanks for your response Guy. Fortunately, I had not pasted in a ‘\’ symbol, but unfortunately I don’t know where else to learn. Might you have a suggestion for what to research in terms of this error? Maybe there’s a vocabulary term to narrow my search? Thanks again. Wishing you well!