30 lines
No EOL
870 B
Python
30 lines
No EOL
870 B
Python
#/Users/jabrown/0/Audio
|
|
|
|
import os
|
|
import subprocess
|
|
|
|
def convert_folder(folder_path):
|
|
for file in os.listdir(folder_path):
|
|
if file.lower().endswith(".ogg"):
|
|
input_path = os.path.join(folder_path, file)
|
|
output_path = os.path.join(
|
|
folder_path,
|
|
os.path.splitext(file)[0] + ".mp3"
|
|
)
|
|
|
|
print(f"Converting: {file} -> {os.path.basename(output_path)}")
|
|
|
|
subprocess.run([
|
|
"ffmpeg",
|
|
"-y", # overwrite if exists
|
|
"-i", input_path,
|
|
"-vn",
|
|
"-acodec", "libmp3lame",
|
|
"-ab", "192k",
|
|
output_path
|
|
], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
|
|
print("Done.")
|
|
|
|
# 👉 Set your folder here
|
|
convert_folder(r"/Users/jabrown/0/Audio") |