To convert a wav to an mp3 file, just apply this code:
import os import sys command = f"ffmpeg -i {sys.argv[1]} -vn -ar 44100 -ac 2 -b:a 192k output.mp3" os.system(command)
I suggest you to go in the site-packages folder of the python installation and save a pth file into it, so that you can use your own module from every folder in the pc, from the command line.
Here is how:
Go into site-packages
- Open the terminal and digit py or python or python3… whatever you do to open python.
- import sys
- import os
- os.startfile(sys[3])
Once you’ve done this you will find a window opened in the folder where is the site-packages folder.
Go in the folder site-packages and save a file .pth with the path of the folder with your modules and you’re done.
Follow the video for more information.
The video that explains how to convert wav to mp3 with pyhton in every folder
The version with a GUI
Click here to see a version of this code with a GUI made with tkinter.