python-video-silence-cutter
python-video-silence-cutter copied to clipboard
Pad cutoff time by 0.025s
Great script, thanks for publishing this. I had a small issue where the cutoff times were a bit too accurate leading to the audio sounding like it was a "skipping cd track", so I just made a small tweak:
for line in lines:
if ("silencedetect" in line):
words = line.split(" ")
for i in range (len(words)):
if ("silence_start" in words[i]):
time_list.append (float(words[i+1]) + 0.025) # changed here
if "silence_end" in words[i]:
time_list.append (float (words[i+1]) - 0.025) # changed here
silence_section_list = list (zip(*[iter(time_list)]*2))
It lead to an overall smoother listening experience. I think it could become a proper feature with an argument if you find this kind of feature interesting.
In my code I do not handle an edge case where the silence cut is less than 0.05s.
I'm using this to cut silence out while reading from a teleprompter (taking a break to breathe, drink water, etc).
Thank you very much for looking into this!
What I understand If I understand your intention correctly, you needed a minimum amount of length to not be cut away between two different points - in your specific case: 0.05s.
Good idea, unusable code
I really like the idea, but I can't use the code you posted because - as you already figured I do not handle an edge case where the silence cut is less than 0.05s..
Could you generalize the code?
- Could you generalize the code, so
1.1 your 0.05s become a parameter 1.2 the edge case is covered - Can you provide a sample file for testing? (can be a simple artificial noise file created in audacity)
Background: I would love to do it myself, but I won't find the time in the near future. I could, however, review a pull request with a test file.
If I understand your intention correctly, you needed a minimum amount of length to not be cut away between two different points - in your specific case: 0.05s.
Basically the situation is that if speaking begins at 1s the track will cut 0s-1s, but those few milliseconds before the cut are needed to have a pleasant listening experience.
Good idea, unusable code
This is clear, I just wanted to know if you saw this as a useful change or not. Not all projects accept changes or it might be decided as "not something we want".
I am playing a bit with some editing techniques, if I use this more frequently I will submit a MR.
Not all projects accept changes or it might be decided as "not something we want". Indeed. Very familiar with that, too. Your idea is very welcome here!
I am playing a bit with some editing techniques, if I use this more frequently I will submit a MR. I'm looking forward to receiving a MR! :+1: