[+] convert_gnome function
This commit is contained in:
@@ -4,7 +4,8 @@ from __future__ import annotations
|
|||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import re
|
import re
|
||||||
from subprocess import Popen
|
import shutil
|
||||||
|
from subprocess import Popen, check_call
|
||||||
import sys
|
import sys
|
||||||
import shlex
|
import shlex
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
@@ -107,23 +108,29 @@ def rename():
|
|||||||
os.rename(file, date)
|
os.rename(file, date)
|
||||||
|
|
||||||
|
|
||||||
|
def convert_gnome():
|
||||||
|
rec_dir = Path.home() / "Videos/Screencasts"
|
||||||
|
fs = [rec_dir / str(f) for f in os.listdir(rec_dir) if str(f).startswith("Screencast") and str(f).endswith(".webm")]
|
||||||
|
for inf in fs:
|
||||||
|
sp = inf.stem.split(" ")
|
||||||
|
ouf = rec_dir / f"Rec {sp[2]} {sp[3][:sp[3].rindex('-')]}.mp4"
|
||||||
|
if ouf.is_file():
|
||||||
|
print(f"Already converted: {inf}")
|
||||||
|
continue
|
||||||
|
print(f"Converting '{inf}' to '{ouf}'")
|
||||||
|
check_call(['ffmpeg', '-i', inf,
|
||||||
|
'-c:v', 'libx264',
|
||||||
|
'-vf', 'crop=trunc(iw/2)*2:trunc(ih/2)*2, fps=30',
|
||||||
|
'-y',
|
||||||
|
ouf])
|
||||||
|
|
||||||
|
if input("Remove files? [y/N]") == "y":
|
||||||
|
[os.remove(f) for f in fs]
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if not hasattr(sys, 'ps1'):
|
|
||||||
args = sys.argv[1:]
|
args = sys.argv[1:]
|
||||||
if len(args) < 1:
|
if args:
|
||||||
print('Usage: compress [rename/python code]')
|
v = eval(args[0])
|
||||||
|
if v:
|
||||||
# Command to rename all screen recordings
|
print(v)
|
||||||
if args[0] == 'rename':
|
|
||||||
rename()
|
|
||||||
exit()
|
|
||||||
|
|
||||||
# processor = args[0].lower().strip()
|
|
||||||
# i = args[1]
|
|
||||||
# crf = args[2] if len(args) > 2 else '24'
|
|
||||||
# cmd = 'cmd' in processor
|
|
||||||
# if cmd:
|
|
||||||
# processor = processor.replace('cmd', '')
|
|
||||||
|
|
||||||
# additional_args = ' '.join(args[3:] if len(args) > 3 else [])
|
|
||||||
print(eval(' '.join(args[0:])))
|
|
||||||
+2
-2
@@ -315,8 +315,8 @@ cut() {
|
|||||||
echo "$start"
|
echo "$start"
|
||||||
ffmpeg -i "$1" -codec copy -ss "$start" -t "$2" Cut\ "$1"
|
ffmpeg -i "$1" -codec copy -ss "$start" -t "$2" Cut\ "$1"
|
||||||
}
|
}
|
||||||
alias vcomp="$BASEDIR/scripts/helpers/video.py"
|
alias vcomp="$BASEDIR/scripts/bin/video.py"
|
||||||
alias vcompy="ipython -i $BASEDIR/scripts/helpers/video.py"
|
alias vcompy="ipython -i $BASEDIR/scripts/bin/video.py"
|
||||||
|
|
||||||
flac2mp3() {
|
flac2mp3() {
|
||||||
for file in *.flac; do
|
for file in *.flac; do
|
||||||
|
|||||||
Reference in New Issue
Block a user