GanerCodes / videoEditBot

Discord bot for video/photo editing
https://top.gg/bot/704169521509957703
The Unlicense
192 stars 63 forks source link

Is it possible to run videoEdit commands on a file directly? #4

Closed MrDemocracy closed 4 years ago

MrDemocracy commented 4 years ago

I've been trying to run videoEdit commands directly on a mp4 file using destroyer.py, but since I don't know much about coding in python I've only managed to make it run random arguments on the file, which it did by default without specifying any videoEdit commands. Is there a way to use videoEditBot as a command-line tool? Where you could do something like this: videoEditBot -i file.mp4 --datamosh 100 --glitch 50 --ricecake 100

GanerCodes commented 4 years ago

its like python destroyer.py file.mp4 "datamosh=100,glitch=50"

MrDemocracy commented 4 years ago

Thank you for the quick response :) However I get Error! Cannot find input file. when I run that command. I've also tried with the full path instead of just the filename. Running the command without any videoEdit arguments gives me this:

Traceback (most recent call last):
  File "destroyer.py", line 1139, in <module>
    if not path.isfile(properFileName):
NameError: name 'properFileName' is not defined
GanerCodes commented 4 years ago

actually i think the arguments go first, so python destroyer.py "datamosh=100,glitch=50" file.mp4

MrDemocracy commented 4 years ago

It found the file this time, but it also deleted it and I gave me this error:

Args: datamosh-0=100.0,glitch-1=50.0
Error getting size: too many values to unpack (expected 2)
Error! Args were: datamosh-0=100.0,glitch-1=50.0
Traceback (most recent call last):
  File "destroyer.py", line 1104, in videoEdit
    newExt = destroy(f"{newPath}/{newFileName}", group, par, newExt = newExt, groupNumber = i, SHOWTIMER = SHOWTIMER, HIDE_FFMPEG_OUT = HIDE_FFMPEG_OUT, HIDE_ALL_FFMPEG = HIDE_ALL_FFMPEG, disallowTimecodeBreak = disallowTimecodeBreak, parentPath = parentPath, fixPrint = fixPrint, **kwargs)
  File "destroyer.py", line 342, in destroy
    width, height = getSize(newName)
ValueError: too many values to unpack (expected 2)

Destroyer ran into an error.

Running it on a different computer with only datamosh gave me this:

Args: datamosh-0=100.0
Silent_run error:
 ['datamosh', '-o', 'C:\\Users\\=REDACTED=\\Downloads\\videoEditBot-master/active/file/2_0_file.avi', 'C:\\Users\\=REDACTED=\\Downloads\\videoEditBot-master/active/file/1_0_file.avi']
Traceback (most recent call last):
  File "C:\Users\=REDACTED=\Downloads\videoEditBot-master\subprocessHelper.py", line 10, in silent_run
    check_call(command, stdout = DEVNULL, stderr = STDOUT, **kawrgs)
  File "C:\Users\=REDACTED=\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['datamosh', '-o', 'C:\\Users\\=REDACTED=\\Downloads\\videoEditBot-master/active/file/2_0_file.avi', 'C:\\Users\\=REDACTED=\\Downloads\\videoEditBot-master/active/file/1_0_file.avi']' returned non-zero exit status 1.

Silent_run error:
 ['ffmpeg', '-hide_banner', '-loglevel', 'fatal', '-i', 'C:\\Users\\=REDACTED=\\Downloads\\videoEditBot-master/active/file/2_0_file.avi', 'C:\\Users\\=REDACTED=\\Downloads\\videoEditBot-master/active/file/3_0_file.mp4']
Traceback (most recent call last):
  File "C:\Users\=REDACTED=\Downloads\videoEditBot-master\subprocessHelper.py", line 10, in silent_run
    check_call(command, stdout = DEVNULL, stderr = STDOUT, **kawrgs)
  File "C:\Users\=REDACTED=\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['ffmpeg', '-hide_banner', '-loglevel', 'fatal', '-i', 'C:\\Users\\=REDACTED=\\Downloads\\videoEditBot-master/active/file/2_0_file.avi', 'C:\\Users\\=REDACTED=\\Downloads\\videoEditBot-master/active/file/3_0_file.mp4']' returned non-zero exit status 1.

Error! Args were: datamosh-0=100.0
Traceback (most recent call last):
  File "destroyer.py", line 1104, in videoEdit
    newExt = destroy(f"{newPath}/{newFileName}", group, par, newExt = newExt, groupNumber = i, SHOWTIMER = SHOWTIMER, HIDE_FFMPEG_OUT = HIDE_FFMPEG_OUT, HIDE_ALL_FFMPEG = HIDE_ALL_FFMPEG, disallowTimecodeBreak = disallowTimecodeBreak, parentPath = parentPath, fixPrint = fixPrint, **kwargs)
  File "destroyer.py", line 915, in destroy
    customFilterBind[i]()
  File "destroyer.py", line 891, in FXdatamosh
    remove(f"{pat}/2_{e0}.avi")
FileNotFoundError: [WinError 2] The system cannot find the file specified: 'C:\\Users\\=REDACTED=\\Downloads\\videoEditBot-master/active/file/2_0_file.avi'

Destroyer ran into an error.
GanerCodes commented 4 years ago

You need https://ucnv.github.io/aviglitch/ for datamosh.

MrDemocracy commented 4 years ago

Awesome! I was able to run the command on my windows machine now. Thank you 😄 Still no luck on my other machine, but that's not a big issue since I got it working. Is there a way to prevent the original file from getting deleted/replaced when I run videoEdit on it?

GanerCodes commented 4 years ago

uh i guess clone it beforehand or add an shutil.copyfile() call somewhere

MrDemocracy commented 4 years ago

That gives me:

Traceback (most recent call last):
  File "destroyer.py", line 1127, in <module>
    shutil.copyfile()
NameError: name 'shutil' is not defined

But my main problem has been solved so I will close the issue now. I think I'll just manually make a copy of the file each time I run the command, even though that gets very tedious. Thanks again for the help 😄

Spiral2839 commented 3 years ago

I don't know how to export a video file by using a "destroyer.py", like, I was trying a test!