Batch umwandeln .wav in mp3 und ogg?

14508

Ich habe ein paar hundert .wav-Dateien, die ich in das ogg- und mp3-Format konvertieren muss. Gibt es eine Möglichkeit, dass ich dies entweder von Audacity oder von einem anderen Befehlszeilenprogramm aus durchführen kann?

16
http://superuser.com/a/617414/84229 user vor 9 Jahren 0

5 Antworten auf die Frage

22
evilsoup

From a Unix-like (Linux, OSX, etc) commandline, ffmpeg can be used like this:

for f in *.wav; do ffmpeg -i "$f" -c:a libmp3lame -q:a 2 "$" -c:a libvorbis -q:a 4 "$"; done 

This will convert every WAV in a directory into one MP3 and one OGG; note that it's case-sensitive (the above command will convert every file ending in .wav, but not .WAV). If you want a case-insensitive version:

for f in *.; do ffmpeg -i "$f" -c:a libmp3lame -q:a 2 "$.mp3" -c:a libvorbis -q:a 4 "$.ogg"; done 

To convert every WAV in a directory recursively (that is: every WAV in the current directory, and all directories in the current directory), you could use find:

find . -type f -name '*.wav' -exec bash -c 'ffmpeg -i "$0" -c:a libmp3lame -q:a 2 "$" -c:a libvorbis -q:a 4 "$' '{}' \; 

(Max respect to Dennis for his response here for finding me a working implementation of find with ffmpeg)

For case-insensitive search with find, use -iname instead of -name.

A note on -q:a: for MP3, the quality range is 0-9, where 0 is best quality, and 2 is good enough for most people for converting CD audio; for OGG, it's 1-10, where 10 is the best and 5 is equivalent to CD quality for most people.

Sehr hilfreich. Ich habe das so geändert, dass .wav rekonstruiert wurde, weil ich ogg: `find nicht brauchte. -type f -name '* .wav' -exec bash -c 'ffmpeg -i "$ 0" -c: ein libmp3lame -q: a 2 "$ "' '{}' \; ` smg vor 6 Jahren 3
3
Nils Magne Lunde

Sie könnten foobar2000 mit Encodern für ogg und mp3 verwenden. Ich glaube, Sie können Encoder bei Raritäten finden .

2
Christian Mann

Sie können mit oggenc WAV in OGG konvertieren und mit lame WAV in MP3 konvertieren.

2
Sathya

Laden Sie ffmpeg von unten herunter und installieren Sie es: http://ffmpeg.zeranoe.com/builds/

Erstellen und starten Sie die Batchdatei mit den folgenden Befehlen:

echo converting *.wav to *.ogg  mkdir ..\Ogg for /r %%i in (*) do ffmpeg -i %%i -acodec libvorbis ..\Ogg\%%~ni.ogg 

Alle konvertierten * .ogg-Dateien werden in das Verzeichnis .. \ Ogg kopiert.

0
Tom

I did some change to a bat file I have found on SO, it now, deals with spaces in files names as it is often the case in songs name. this bat file convert .wav to .mp3, using the VLC command line tool. But you can change to the formats wma --> mp3 and so on...

@echo off chcp 65001 SETLOCAL ENABLEDELAYEDEXPANSION for /f "delims=" %%f IN ('dir /b /s "YOUR_DISK:\Path\To\Your Music\That May contain Spaces\*.wav"') do ( set file1=%%~nf.mp3 echo "file :" !file1! set fic1=%%f echo "file : " !fic1! CALL "C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" "!fic1!" --sout="#transcode:std,mux=mp3,dst="""!file1!"""}" vlc://quit ) echo . echo conversion finished pause 

chcp change the encoding (to deal with accentuated characters.) ab is the bit rate here 320