i'd like to run this command
for /R %f IN (/*.mp4) DO ffmpeg -i "%f" -f wav -bitexact -acodec pcm_s16le -ar 22050 -ac 1 %~nf.wav
inside this script, like this:
import os
from datetime import date
today = date.today()
today = today.strftime('%m-%d-%Y')
dir_name = f"C:/Users/lucan/Automatically/{today}/"
def extract(user):
test = os.listdir(dir_name)
command = "for /R %f IN (/*.mp4) DO ffmpeg -i "%f" -f wav -bitexact -acodec pcm_s16le -ar 22050 -ac 1 %~nf.wav"
os.system(command)
for item in test:
if item.endswith(".wav"):
os.remove(os.path.join(dir_name, item))
extract("businessbarista")
when i do so this is the error message I get:
command = "for /R %f IN (/*.mp4) DO ffmpeg -i "%f" -f wav -bitexact -acodec pcm_s16le -ar 22050 -ac 1 %~nf.wav" TypeError: must be real number, not str
the command runs fine in command prompt, but not in powershell. can you help me figure out what went wrong?