Skip to content

Instantly share code, notes, and snippets.

@lightsongjs
Created January 20, 2021 07:05
Show Gist options
  • Save lightsongjs/849d84c757e168822b1e81d61c65a01e to your computer and use it in GitHub Desktop.
Save lightsongjs/849d84c757e168822b1e81d61c65a01e to your computer and use it in GitHub Desktop.
import os
import subprocess
def removeSpacesandRenameFileFromFileName (oldFile):
newFileName = oldFile.replace(' ','_')
os.rename(oldFile,newFileName)
return newFileName
fileList = os.listdir(os.getcwd())
for file in fileList:
if file.endswith('.mp4'):
newFilename = removeSpacesandRenameFileFromFileName(file)
# print(f'ffmpeg -i {newFilename} {newFilename}.wav')
subprocess.call(f'ffmpeg -i {newFilename} {newFilename}.wav')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment