Last active
June 25, 2022 00:17
-
-
Save insideClaw/2950da89c66625ef9260c49d64c65aca to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python3 | |
import subprocess | |
import os, shutil | |
directory = '.' | |
dir_trash = "processed_DELETEME" | |
if not os.path.isdir(dir_trash): | |
os.mkdir(dir_trash) | |
for filename in os.listdir(directory): | |
f = os.path.join(directory, filename) | |
# checking if it is a file | |
if os.path.isfile(f): | |
cmd = 'ffmpeg -ss 00:00:04 -i "' + filename + '" -map 0 -c copy "temp-' + filename + '"' | |
print(cmd) | |
conversion = subprocess.Popen(cmd,shell=True) | |
conversion.wait() | |
print("Conversion for " + filename + " finished") | |
shutil.move(filename, dir_trash + "/" + filename) | |
shutil.move("temp-" + filename, filename) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment