DarkTrick / python-video-silence-cutter

Python script, that uses ffmpeg and ffprobe to cut silences away from videos
Creative Commons Zero v1.0 Universal
49 stars 18 forks source link

Error in Windows #6

Open djfkc opened 1 year ago

djfkc commented 1 year ago

New to Python but have hacked many languages.
Tried code as copied from GitHub and received error:

detecting silences Traceback (most recent call last): File "C:\ProgramData\scripts\silence_cutter.py", line 165, in main() File "C:\ProgramData\scripts\silence_cutter.py", line 161, in main cut_silences (infile, outfile, dB) File "C:\ProgramData\scripts\silence_cutter.py", line 101, in cut_silences silences = findSilences (infile,dB) File "C:\ProgramData\scripts\silence_cutter.py", line 27, in findSilences time_list.append (float(words[i+1])) ValueError: could not convert string to float: '0\r'

Tried fix by simonflick Aug 3 fix: lines = re.split(r"(\r)?\n", s)

Gave error: detecting silences Traceback (most recent call last): File "C:\ProgramData\scripts\silence_cutter.py", line 172, in main() File "C:\ProgramData\scripts\silence_cutter.py", line 169, in main cut_silences (infile, outfile, dB) File "C:\ProgramData\scripts\silence_cutter.py", line 103, in cut_silences silences = findSilences (infile,dB) File "C:\ProgramData\scripts\silence_cutter.py", line 22, in findSilences lines = re.split(r"(\r)?\n", s) NameError: name 're' is not defined

Changed re. to s. to match variable and received error: detecting silences Traceback (most recent call last): File "C:\ProgramData\scripts\silence_cutter.py", line 174, in main() File "C:\ProgramData\scripts\silence_cutter.py", line 171, in main cut_silences (infile, outfile, dB) File "C:\ProgramData\scripts\silence_cutter.py", line 105, in cut_silences silences = findSilences (infile,dB) File "C:\ProgramData\scripts\silence_cutter.py", line 24, in findSilences lines = s.split(r"(\r)?\n", s) TypeError: 'str' object cannot be interpreted as an integer

Suggestions and guidance requested.

sbayrakli commented 1 year ago

silence_cutter.zip you can find fixed script in attachment. by the way, do not leave optional parameters blank when you start the script

DarkTrick commented 1 year ago

Can you please check if the script in branch fix/windows_cutting will fix your problem?

You can get the file via git clone -b fix/windows_cutting https://github.com/DarkTrick/python-video-silence-cutter.git