Created
February 14, 2021 08:46
-
-
Save 97997/b170e8dc282788f59a945d22ad21ee14 to your computer and use it in GitHub Desktop.
ffmpeg tool.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Makes a trim of video using fmmpeg | |
import os | |
import tkinter as tk | |
from tkinter import filedialog | |
def filePick(): | |
root = tk.Tk() | |
root.withdraw() | |
file_path = filedialog.askopenfilename() | |
return file_path | |
#Unused function | |
def fileSave(): | |
root = tk.Tk() | |
root.withdraw() | |
file_path = filedialog.asksaveasfilename() | |
return file_path | |
input("Press enter to select file to trim") | |
filepath = filePick() | |
startTime = input("Write start time, in format hh:mm:ss (00:00:00 for example): ") | |
endTime = input("Write end time, in format hh:mm:ss (00:00:00 for example): ") | |
#editedName = os.path.basename(filepath) | |
editedName = os.path.splitext(filepath)[0] + "_trim" + os.path.splitext(filepath)[1] | |
shortVid = input("Is the trimmed section less than 10 seconds? [y/n]") | |
if shortVid == "y": | |
wizardry = 'ffmpeg -i \"' + filepath + '\" -ss ' + startTime + ' -to ' + endTime + ' \"' + editedName + '\"' | |
if shortVid == "n": | |
wizardry = 'ffmpeg -i \"' + filepath + '\" -ss ' + startTime + ' -to ' + endTime + ' -c copy \"' + editedName + '\"' | |
#print(wizardry) | |
os.system(wizardry) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment