Initial commit - working on Windows and OSX

This commit is contained in:
2017-01-12 22:51:44 -05:00
commit ea1d421493
33 changed files with 109 additions and 0 deletions

10
README.md Normal file
View File

@@ -0,0 +1,10 @@
# README
This project is for compressing video files. I use this to compress wrestling footage.
How to use:
1. Put your files in the input folder
2. Double click convert-windows.bat
3. Select your resolution and output audio settings
4. Wait.....
5. Your converted files will be put in the output folder and your input files will remain in the input folder

1
convert-windows.bat Normal file
View File

@@ -0,0 +1 @@
python\python-3.5.3rc1-embed-amd64\python.exe ffmpeg-files.py

97
ffmpeg-files.py Normal file
View File

@@ -0,0 +1,97 @@
import os
import sys
def clearScreen():
os.system('cls' if os.name == 'nt' else 'clear')
def convertFilesInImport():
for filename in os.listdir('input'):
#os.path.splitext(filename)[0] gets ride of file extension
ffmpegcmd = getFfmpegPath() + " -i " + getInputPath() + filename + " -b " + getBitrateSetting() + " -minrate " + getBitrateSetting() + " -maxrate " + getBitrateSetting() + " -bufsize " + getBitrateSetting() + " -vcodec libx264" + getAudioSetting() + " -y " + getOutputPath() + os.path.splitext(filename)[0] + ".mp4"
os.system(ffmpegcmd)
def getFfmpegPath():
if(os.name == "nt"):
return "ffmpeg\\windows\\ffmpeg.exe"
elif(sys.platform == "darwin"):
return "ffmpeg/osx/ffmpeg"
else:
returnErrorAndExit("Your os is not supported. Try using Windows or OSX")
def getOutputPath():
if(os.name == "nt"):
return "output\\"
else:
return "output/"
def getInputPath():
if(os.name == "nt"):
return "input\\"
else:
return "input/"
def askForResolution():
inputresolution = "0"
while(inputresolution != "1" and inputresolution != "2" and inputresolution != "3" and inputresolution != "4" and inputresolution != "5" and inputresolution != "6" and inputresolution != "7" and inputresolution != "8"):
clearScreen()
print("Tell me about your source video.")
print("1. 4k at a slow frame rate (24, 25, 30)")
print("2. 1080p at a slow frame rate (24, 25, 30)")
print("3. 720p at a slow frame rate (24, 25, 30)")
print("4. 480p at a slow frame rate (24, 25, 30)")
print("5. 4k at a fast frame rate (48, 50, 60)")
print("6. 1080p at a fast frame rate (48, 50, 60)")
print("7. 720p at a fast frame rate (48, 50, 60)")
print("8. 480p at a fast frame rate (48, 50, 60)")
inputresolution = input("Please enter a number from above: ")
return inputresolution
def askForAudioOutput():
audioOutput = "0"
while(audioOutput != "1" and audioOutput != "2" and audioOutput != "3" and audioOutput != "4"):
clearScreen()
print("Tell me what you would like your audio to output as.")
print("1. For no audio")
print("2. For Mono audio")
print("3. For Stereo audio")
print("4. For 5.1 audio")
audioOutput = input("Please enter a number from above: ")
return audioOutput
def getBitrateSetting():
if(resolution == "1"):
return "44000k"
elif(resolution == "2"):
return "10000k"
elif(resolution == "3"):
return "6500k"
elif(resolution == "4"):
return "2500k"
elif(resolution == "5"):
return "66000k"
elif(resolution == "6"):
return "15000k"
elif(resolution == "7"):
return "9500k"
elif(resolution == "8"):
return "4000k"
def getAudioSetting():
if(audio == "1"):
return " -an"
elif(audio == "2"):
return " -ab 128k"
elif(audio == "3"):
return " -ab 384k"
elif(audio == "4"):
return " -ab 512k"
def returnErrorAndExit(message):
input(message)
sys.exit()
#Run Program
resolution = askForResolution()
audio = askForAudioOutput()
convertFilesInImport()

BIN
ffmpeg/.DS_Store vendored Normal file

Binary file not shown.

BIN
ffmpeg/._.DS_Store Normal file

Binary file not shown.

BIN
ffmpeg/osx/._ffmpeg Normal file

Binary file not shown.

BIN
ffmpeg/osx/ffmpeg Normal file

Binary file not shown.

BIN
ffmpeg/windows/ffmpeg.exe Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1 @@
applocal = true

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.