Initial commit - working on Windows and OSX
This commit is contained in:
10
README.md
Normal file
10
README.md
Normal 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
1
convert-windows.bat
Normal file
@@ -0,0 +1 @@
|
|||||||
|
python\python-3.5.3rc1-embed-amd64\python.exe ffmpeg-files.py
|
||||||
97
ffmpeg-files.py
Normal file
97
ffmpeg-files.py
Normal 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
BIN
ffmpeg/.DS_Store
vendored
Normal file
Binary file not shown.
BIN
ffmpeg/._.DS_Store
Normal file
BIN
ffmpeg/._.DS_Store
Normal file
Binary file not shown.
BIN
ffmpeg/osx/._ffmpeg
Normal file
BIN
ffmpeg/osx/._ffmpeg
Normal file
Binary file not shown.
BIN
ffmpeg/osx/ffmpeg
Normal file
BIN
ffmpeg/osx/ffmpeg
Normal file
Binary file not shown.
BIN
ffmpeg/windows/ffmpeg.exe
Normal file
BIN
ffmpeg/windows/ffmpeg.exe
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/_bz2.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/_bz2.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/_ctypes.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/_ctypes.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/_decimal.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/_decimal.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/_elementtree.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/_elementtree.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/_hashlib.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/_hashlib.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/_lzma.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/_lzma.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/_msi.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/_msi.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/_multiprocessing.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/_multiprocessing.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/_overlapped.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/_overlapped.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/_socket.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/_socket.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/_sqlite3.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/_sqlite3.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/_ssl.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/_ssl.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/pyexpat.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/pyexpat.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/pyshellext.dll
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/pyshellext.dll
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/python.exe
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/python.exe
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/python3.dll
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/python3.dll
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/python35.dll
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/python35.dll
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/python35.zip
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/python35.zip
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/pythonw.exe
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/pythonw.exe
Normal file
Binary file not shown.
1
python/python-3.5.3rc1-embed-amd64/pyvenv.cfg
Normal file
1
python/python-3.5.3rc1-embed-amd64/pyvenv.cfg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
applocal = true
|
||||||
BIN
python/python-3.5.3rc1-embed-amd64/select.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/select.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/sqlite3.dll
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/sqlite3.dll
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/unicodedata.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/unicodedata.pyd
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/vcruntime140.dll
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/vcruntime140.dll
Normal file
Binary file not shown.
BIN
python/python-3.5.3rc1-embed-amd64/winsound.pyd
Normal file
BIN
python/python-3.5.3rc1-embed-amd64/winsound.pyd
Normal file
Binary file not shown.
Reference in New Issue
Block a user