excitoon / video-remove-silence

Tool for removing silence from video files
MIT License
109 stars 23 forks source link

"RuntimeError: generator raised StopIteration" error message while processing #2

Closed DJTacki closed 5 years ago

DJTacki commented 5 years ago

Dear excitoon,

I also would like to thank for your effort. Your project offers me exactly what i need to do. However, i got the following error message running on Win x64 Python 3.7.1 (Spyder IDE):

runfile('D:/Home/Username/project/video-remove-silence/video-remove-silence', args='testvideo.mp4', wdir='D:/Home/Username/project/video-remove-silence')
Extracting audio...
Finding gaps...
Traceback (most recent call last):

  File "<ipython-input-1-24eb5c3ee5f6>", line 1, in <module>
    runfile('D:/Home/Username/project/video-remove-silence/video-remove-silence', args='testvideo.mp4', wdir='D:/Home/***/project/video-remove-silence')

  File "C:\Users\Username\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 704, in runfile
    execfile(filename, namespace)

  File "C:\Users\Username\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "D:/Home/Username/project/video-remove-silence/video-remove-silence", line 135, in <module>
    silences, including_end = find_silences(audio_file.name)

  File "D:/Home/Username/project/video-remove-silence/video-remove-silence", line 104, in find_silences
    silence_regions = [ (start, end) for start, end in silence_regions if end-start >= threshold_frames ]

  File "D:/Home/DJ Tacki/project/video-remove-silence/video-remove-silence", line 104, in <listcomp>
    silence_regions = [ (start, end) for start, end in silence_regions if end-start >= threshold_frames ]

  File "D:/Home/Username/project/video-remove-silence/video-remove-silence", line 103, in <genexpr>
    silence_regions = ( (start + (half_blend_frames if start > 0 else 0), end - (half_blend_frames if end < size else 0)) for start, end in silence_regions )

  File "D:/Home/Username/project/video-remove-silence/video-remove-silence", line 102, in <genexpr>
    silence_regions = ( (start, end) for start, end in to_regions(is_silence) if end-start >= blend_duration )

RuntimeError: generator raised StopIteration

Please let me know if i could provide additional information, and will thank you if you have the chance to look at my problem.

DJTacki commented 5 years ago

With further attempts to make it work, it seems that the issue is related with the Python3.7, as it is working just fine with Python3.6.

excitoon commented 5 years ago

Hi. It should work fine with Python 3.7. But this error looks strange for me. Is there any work to do for your file (at least one quiet region)? Can you give me a chance reproducing it providing your video file or fragment of it?

DJTacki commented 5 years ago

Sure, i was able to process the following video with 3.6.

excitoon commented 5 years ago

Fixed it. It was this thing: https://www.juandebravo.com/2018/11/09/python-37-stop-iteration/ . May I use your video for a public collection of tests?

DJTacki commented 5 years ago

Thanks for your work. It is not my video, i downloaded it from youtube as a sample, so i don't think it would be a wise step to use in publicly. Sorry for that.

excitoon commented 5 years ago

Okay, that's fine.