OllyFunkster / bangingcuts

Blender VSE Addon to cut up strips based on audio peaks
GNU General Public License v3.0
9 stars 2 forks source link

IndexError: index 595968 is out of bounds for axis 0 with size 595968 (in line 129) #2

Closed tin2tin closed 1 year ago

tin2tin commented 1 year ago

I tried using this clip: https://www.youtube.com/watch?v=HgGKtGQbC0c

But I get this error: image

OllyFunkster commented 1 year ago

@tin2tin thanks for this, I'll try to recreate it. What service do you use to download the clip? youtube-dl isn't working for some reason.

tin2tin commented 1 year ago

Jdownloader. There are also a new thing in Blender where frames in the vse do not accept floats. I think I had to correct it two places in your add-on(add int).

I tried to figure out how to make it cut silence, but gave up. This stuff is too advanced ofr me. :-) https://twitter.com/Sarcastic_Hanna/status/1628816339572776963

OllyFunkster commented 1 year ago

ah, I see the problem - the audio in that clip is at 44100Hz, but I never found a way to find the sample rate of the strip via python - instead I just use the sample rate of the scene, which defaults to 48000. I'll see if I can find a workaround.

tin2tin commented 1 year ago

Recently the samplerate was exposed in the VSE > Time sidebar: image

OllyFunkster commented 1 year ago

interesting. I have it working here by calculating the strip samplerate manually, which is good enough, but if I can get to that samplerate property in the addon that would be better.

OllyFunkster commented 1 year ago

Since the samplerate property is new, I have committed the version that calculates it itself. Give it a go and see how you get on?

tin2tin commented 1 year ago

Yes, it runs without any errors and works as advertised here on a clip like this: https://www.youtube.com/shorts/qUqj-KxXHWQ

Trying to make it preserve everyting above the thresholdt(remove pauses) in a clip like this: https://www.youtube.com/watch?v=7l1Tom9q8Ic I'm a bit puzzled about what the "Auto holdoff" does, and why keeps chopping up the video when it keeps staying above the threshold?

OllyFunkster commented 1 year ago

The addon as currently designed, is meant to make identical-length pieces every time the level rises. The "auto holdoff" is meant to prevent re-triggering for long segments where the audio level remains above threshold.

Example: 4 loud hammer blows, 1 second apart == 4 short clips 1 loud foghorn blast, continuous, lasts 4 seconds = 1 short clip

I will look into adding a "remove silence" mode. It would be straightforward to modify the addon to only remove silence, and thus have 2 addons that each do 1 job, but I think it shouldn't be a huge job to have a second mode that re-uses most of the code as it stands.

OllyFunkster commented 1 year ago

Okay, v0.7 adds new remove silence mode and it seems to work. Not sure I'm a huge fan of having it as a drop-down box choice, but that was the simplest way.

Have a go and see what you think.

tin2tin commented 1 year ago

Thank you. It seems to be working. Trying to cut someone talking, it still gets cut up quite a bit, maybe it needs an exposed minimum silence duration value, which should determine when the silence is cut and when it is kept?

If I add a higher value pre-roll the resulting clips seems to spread out on more channels.

OllyFunkster commented 1 year ago

Ah, I guess I haven't quite got the time position right just yet. I'll do some more experimentation.

It'll always be a challenge getting it to automatically make the cuts exactly where they feel right, but maybe some tweaks to the way it handles pre/post roll and overlap will make it work better...

tin2tin commented 1 year ago

Btw. I did a little tweet on your add-on: https://twitter.com/tintwotin/status/1630490799791132672 I hope some more people will use it. :-)

tin2tin commented 1 year ago

For cutting silence, If I up the TRIGGER_DEBOUNCE_COUNT_FALLING = 40000 and set the threshold to -25 the chunks becomes bigger and more speech friendly.

OllyFunkster commented 1 year ago

Okay, one more go. I have made it so that you can use the pre- and post-roll values to set the smallest amount of silence to remove. e.g. if you never want to remove bits of silence shorter than 2 seconds, make sure pre and post roll add up to more than 48 (assuming 24fps).

tin2tin commented 1 year ago

https://twitter.com/tintwotin/status/1631584770885820418

It is working well. Thank you. I guess, it is okay to close this issue now?