<p>I suspect you are having problems because you are trying to overwrite the input file with the output, ffmpeg just doesn't work that way. For a single file:</p>

<pre><code>ffmpeg -i input.avi -an -c:v copy output.mkv
</code></pre>

<p>To do every file in a directory, you can use a for loop. For every `file.avi``in the working directory, this command will create an output called file-v.mkv:</p>

<pre><code>for f in *avi; do ffmpeg -i "$f" -an -c:v copy "${f/%.avi/-v.mkv}"; done
</code></pre>

<p>To do the same thing recursively, you can indeed use find like so:</p>

<pre><code>find . -type f -name *.avi -exec bash -c 'ffmpeg -i "$0" -an -c:v copy "${0/%.avi/-v.mkv}"' {} \;
</code></pre>

CC BY-SA 3.0
2015-02-26T22:24:24.287Z
you might want to use `-map 0 -an` to copy all non-audio streams.  (Without `-map`, your output won't have any metadata or I think even subtitle streams.)  Or you could use `mkvmerge -A`, and that will default to copying everything untouched, except audio streams.
Peter Cordes
CC BY-SA 3.0
2015-02-26T22:33:09.490Z
Also, don't forget to quote `'*.avi'` for the argument to `find`.  And you could use `-iname` rather than `-name`.  I thought `$0` looked wrong at first, but apparently args after `bash -c` start at `$0`, so that is correct.  I was going to suggest an edit, but it had to be more than 6 chars long, and fixing quotes was all that needed changing.
Peter Cordes
CC BY-SA 3.0
2015-02-27T01:13:28.180Z
oops, just tried this, apparently ffmpeg does take one subtitle stream.  But if you have multiple sub streams, or other data streams, then you need `-map 0`.
Peter Cordes
CC BY-SA 3.0
2013-01-15T18:12:46.603Z
2013-01-15T18:12:46.603Z
evilsoup
<p>I'd suggest installing <a href="http://winff.org/html_new/" rel="nofollow">WinFF</a>, which is a GUI for ffmpeg, and comes with a job manager. </p>

<p>Basically, perform the task for one video and verify it's ok, then populate the job queue with the remaining files, and it will adopt the last used encode parameters and process the queue.</p>

CC BY-SA 3.0
2012-05-02T02:34:19.290Z
Thanks for the suggestion. However, the interface for WinFF, as far as I can see, does not have any particularly easier options than just using the command line. Put another way, they have fields where you enter in the command line options, so I'm not even sure what the advantage of it is. At the very least, I can't see any option for removing the audio from a video file.
Questioner
CC BY-SA 3.0
2012-05-02T07:35:15.347Z
My apologies. My original answer was [Avanti](http://avanti.arrozcru.com/), which would do the job very simply. Then I saw that you were running linux, and Avanti is Win-only. I had used WinFF a long time ago and is cross-platform and has a job queue. However, you have to form a preset by manually inputting the command line (not the case in Avanti). The reason for suggesting a frontend is that you don't need to worry about quirky syntax issues such as parameter sequencing or flag overrides or the like. If you can do this on Win, Avanti will do the job easy.
Gyan
CC BY-SA 3.0
2012-05-01T16:53:57.900Z
2012-05-01T16:53:57.900Z
Gyan
<p>I have a directory full of short video clips in .AVI format, and I want to remove the audio from all of them. I'm using Ubuntu 12.04.</p>

<p>I tried this command:</p>

<pre><code>find -name '*.avi' -exec ffmpeg -i {} -an -vcodec copy {} \;
</code></pre>

<p>But while it did remove the audio, it also reduced each clip down to just a few frames. They are originally about 1 to 2 minutes long each, and should stay that way.</p>

<p>This might just be because ffmpeg can be buggy sometimes. Or maybe there's a better way of formatting the syntax.</p>

<p>In any case, whether it's with ffmpeg or a different command, is there a way I can reliably remove the audio from a bunch of clips without changing the video in any way?</p>

CC BY-SA 4.0
2019-09-08T04:17:09.333Z
Related: https://superuser.com/questions/268985/remove-audio-from-video-file-with-ffmpeg
Ciro Santilli OurBigBook.com
<audio><ffmpeg>
How do I remove audio from all files in a directory with ffmpeg?
Questioner
# How do I remove audio from all files in a directory with ffmpeg?

(Asked by: username_0 on 2012-04-30)

I have a directory full of short video clips in .AVI format, and I want to remove the audio from all of them. I'm using Ubuntu 12.04.
I tried this command:
find -name '*.avi' -exec ffmpeg -i {} -an -vcodec copy {} \;

But while it did remove the audio, it also reduced each clip down to just a few frames. They are originally about 1 to 2 minutes long each, and should stay that way.
This might just be because ffmpeg can be buggy sometimes. Or maybe there's a better way of formatting the syntax.
In any case, whether it's with ffmpeg or a different command, is there a way I can reliably remove the audio from a bunch of clips without changing the video in any way?

**Tags:** audio, ffmpeg

> **Comments:**
> **username_1**: Related: https://superuser.com/questions/268985/remove-audio-from-video-file-with-ffmpeg  

---

## 2 answers

### Answer by username_2 on 2013-01-15. Score: 6

I suspect you are having problems because you are trying to overwrite the input file with the output, ffmpeg just doesn't work that way. For a single file:
ffmpeg -i input.avi -an -c:v copy output.mkv

To do every file in a directory, you can use a for loop. For every `file.avi``in the working directory, this command will create an output called file-v.mkv:
for f in *avi; do ffmpeg -i "$f" -an -c:v copy "${f/%.avi/-v.mkv}"; done

To do the same thing recursively, you can indeed use find like so:
find . -type f -name *.avi -exec bash -c 'ffmpeg -i "$0" -an -c:v copy "${0/%.avi/-v.mkv}"' {} \;

> **Comments:**
> **username_3**: you might want to use `-map 0 -an` to copy all non-audio streams.  (Without `-map`, your output won't have any metadata or I think even subtitle streams.)  Or you could use `mkvmerge -A`, and that will default to copying everything untouched, except audio streams.  
> **username_3**: Also, don't forget to quote `'*.avi'` for the argument to `find`.  And you could use `-iname` rather than `-name`.  I thought `$0` looked wrong at first, but apparently args after `bash -c` start at `$0`, so that is correct.  I was going to suggest an edit, but it had to be more than 6 chars long, and fixing quotes was all that needed changing.  
> **username_3**: oops, just tried this, apparently ffmpeg does take one subtitle stream.  But if you have multiple sub streams, or other data streams, then you need `-map 0`.  

---

### Answer by username_4 on 2012-05-01. Score: 3

I'd suggest installing [WinFF](http://winff.org/html_new/), which is a GUI for ffmpeg, and comes with a job manager.

Basically, perform the task for one video and verify it's ok, then populate the job queue with the remaining files, and it will adopt the last used encode parameters and process the queue.

> **Comments:**
> **username_0**: Thanks for the suggestion. However, the interface for WinFF, as far as I can see, does not have any particularly easier options than just using the command line. Put another way, they have fields where you enter in the command line options, so I'm not even sure what the advantage of it is. At the very least, I can't see any option for removing the audio from a video file.  
> **username_4**: My apologies. My original answer was [Avanti](http://avanti.arrozcru.com/), which would do the job very simply. Then I saw that you were running linux, and Avanti is Win-only. I had used WinFF a long time ago and is cross-platform and has a job queue. However, you have to form a preset by manually inputting the command line (not the case in Avanti). The reason for suggesting a frontend is that you don't need to worry about quirky syntax issues such as parameter sequencing or flag overrides or the like. If you can do this on Win, Avanti will do the job easy.  

---

