antiboredom / videogrep

automatic video supercuts with python
https://antiboredom.github.io/videogrep
Other
3.33k stars 257 forks source link

Feature that cut silent parts #107

Closed theRAGEhero closed 2 years ago

theRAGEhero commented 2 years ago

Hello and thank you for your awesome job,

would it be possible to add a feature to remove the silent parts and edit them in one file?

I mean that at the end you have a file with always someone that is talking. This would be awesome for vlogs!

Thank you, Alessandro


edit. Is this script making that? https://github.com/antiboredom/videogrep/blob/master/examples/parts_of_speech.py

antiboredom commented 2 years ago

hi @theRAGEhero - I'm not sure about adding it as a feature, but I have just made an example script that you can run to remove silences. You can find it here: https://github.com/antiboredom/videogrep/blob/master/examples/remove_silence.py

theRAGEhero commented 2 years ago

Wow, thank you!

Am I doing something wrong?

al@Ubuntu ~/D/serale [1]> python3 remove_silences.py serale.mp4
Traceback (most recent call last):
  File "remove_silences.py", line 23, in <module>
    words += sentence['words']
KeyError: 'words'
al@Ubuntu ~/D/serale [1]> 
antiboredom commented 2 years ago

hi! Sorry, I should have mentioned that will only work with videos that you transcribe with videogrep (so no .vtt files from youtube). It also might mean that it can't find silences for other reasons, although I'm not sure why that would be... What transcription are you using?

theRAGEhero commented 2 years ago

I'm using an .srt file generated by kdenlive (Volk).

The format is:

1
00:00:00,840 --> 00:00:03,030
hello hello hello

2
00:00:03,150 --> 00:00:05,606
hello hello hello
antiboredom commented 2 years ago

gotcha - give me a moment and I'll see if I can get it working with that...

antiboredom commented 2 years ago

@theRAGEhero can you re-download and try the script again?

theRAGEhero commented 2 years ago

It works very well! The only thing I need to fix is the output quality that right now is lower than the original video.

Thank you a lot.