<pre><code>for i in *.mp4; do ffmpeg -i &quot;$i&quot; -f mp3 -ab 192k -vn -ar 44100 -ac 2 aud/&quot;${i%.*}.mp3&quot;; done
</code></pre>
<ul>
<li>vn: disable video recording during the conversion.</li>
<li>ar: set audio sampling rate in Hz.</li>
<li>ab: set the audio bitrate.</li>
<li>ac: set the number of audio channels.</li>
<li>-f: format.</li>
<li>aud: name of the audio folder</li>
</ul>

CC BY-SA 4.0
2022-01-23T16:05:51.317Z
2022-01-23T16:05:51.317Z
Mahdi Saheb
<p>I want to convert all my mp4 files in a folder into mp3 in a new folder
I've tried something like:</p>
<pre><code>$ffmpeg -i \*.mp4 -vn mp3/\*.mp3
</code></pre>
<p>but it didn't work. It involved an infinite loop and my computer didn't respond anymore. Any solution ? Thanks.</p>

<ffmpeg>
ffmpeg : Convert all mp4 files in a folder into mp3 in a new folder
As Josvah
# ffmpeg : Convert all mp4 files in a folder into mp3 in a new folder

(Asked by: username_0 on 2022-01-23)

I want to convert all my mp4 files in a folder into mp3 in a new folder
I've tried something like:
$ffmpeg -i \*.mp4 -vn mp3/\*.mp3

but it didn't work. It involved an infinite loop and my computer didn't respond anymore. Any solution ? Thanks.

**Tags:** ffmpeg


---

## 1 answers

### Answer by username_1 on 2022-01-23. Score: 1

for i in *.mp4; do ffmpeg -i "$i" -f mp3 -ab 192k -vn -ar 44100 -ac 2 aud/"${i%.*}.mp3"; done


vn: disable video recording during the conversion.
ar: set audio sampling rate in Hz.
ab: set the audio bitrate.
ac: set the number of audio channels.
-f: format.
aud: name of the audio folder


---

