Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index is out of bounds - AudioFileClip #521

Closed
pchheda opened this issue Apr 3, 2017 · 6 comments
Closed

Index is out of bounds - AudioFileClip #521

pchheda opened this issue Apr 3, 2017 · 6 comments
Labels
bug Issues that report (apparent) bugs.

Comments

@pchheda
Copy link

pchheda commented Apr 3, 2017

Hello,

I am trying to create a VideoClip using:

initial_clip.write_videofile('initial.mp4', codec='mpeg4', fps=24, audio_codec='libmp3lame')

where initial_clip is my VideoClip. I am getting the following error:

File "/usr/local/lib/python3.6/site-packages/moviepy/audio/io/readers.py", line 187, in get_frame
    result[in_time] = self.buffer[indices]
IndexError: index 100197 is out of bounds for axis 0 with size 100197

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/pankit/Documents/python-workspace/ttv_v1/imageprocessing/make_video.py", line 272, in <module>
    sys.exit(make_video_from_file())
  File "/Users/pankit/Documents/python-workspace/ttv_v1/imageprocessing/make_video.py", line 249, in make_video_from_file
    create_animated_clip(sentence)
  File "/Users/pankit/Documents/python-workspace/ttv_v1/imageprocessing/make_video.py", line 152, in create_animated_clip
    initial_clip.write_videofile('initial.mp4', codec='mpeg4', fps=24, audio_codec='libmp3lame')
  File "<decorator-gen-51>", line 2, in write_videofile
  File "/usr/local/lib/python3.6/site-packages/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "<decorator-gen-50>", line 2, in write_videofile
  File "/usr/local/lib/python3.6/site-packages/moviepy/decorators.py", line 137, in use_clip_fps_by_default
    return f(clip, *new_a, **new_kw)
  File "<decorator-gen-49>", line 2, in write_videofile
  File "/usr/local/lib/python3.6/site-packages/moviepy/decorators.py", line 22, in convert_masks_to_RGB
    return f(clip, *a, **k)
  File "/usr/local/lib/python3.6/site-packages/moviepy/video/VideoClip.py", line 330, in write_videofile
    verbose=verbose)
  File "<decorator-gen-73>", line 2, in write_audiofile
  File "/usr/local/lib/python3.6/site-packages/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "/usr/local/lib/python3.6/site-packages/moviepy/audio/AudioClip.py", line 204, in write_audiofile
    verbose=verbose, ffmpeg_params=ffmpeg_params)
  File "<decorator-gen-70>", line 2, in ffmpeg_audiowrite
  File "/usr/local/lib/python3.6/site-packages/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "/usr/local/lib/python3.6/site-packages/moviepy/audio/io/ffmpeg_audiowriter.py", line 167, in ffmpeg_audiowrite
    nbytes= nbytes, fps=fps):
  File "/usr/local/lib/python3.6/site-packages/tqdm/_tqdm.py", line 833, in __iter__
    for obj in iterable:
  File "/usr/local/lib/python3.6/site-packages/moviepy/audio/AudioClip.py", line 81, in generator
    buffersize=chunksize)
  File "<decorator-gen-72>", line 2, in to_soundarray
  File "/usr/local/lib/python3.6/site-packages/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "/usr/local/lib/python3.6/site-packages/moviepy/audio/AudioClip.py", line 127, in to_soundarray
    snd_array = self.get_frame(tt)
  File "<decorator-gen-14>", line 2, in get_frame
  File "/usr/local/lib/python3.6/site-packages/moviepy/decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "/usr/local/lib/python3.6/site-packages/moviepy/Clip.py", line 95, in get_frame
    return self.make_frame(t)
  File "/usr/local/lib/python3.6/site-packages/moviepy/Clip.py", line 136, in <lambda>
    newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
  File "/usr/local/lib/python3.6/site-packages/moviepy/Clip.py", line 188, in <lambda>
    return self.fl(lambda gf, t: gf(t_func(t)), apply_to,
  File "<decorator-gen-14>", line 2, in get_frame
  File "/usr/local/lib/python3.6/site-packages/moviepy/decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "/usr/local/lib/python3.6/site-packages/moviepy/Clip.py", line 95, in get_frame
    return self.make_frame(t)
  File "/usr/local/lib/python3.6/site-packages/moviepy/audio/AudioClip.py", line 292, in make_frame
    for c,part in zip(self.clips, played_parts)
  File "/usr/local/lib/python3.6/site-packages/moviepy/audio/AudioClip.py", line 293, in <listcomp>
    if (part is not False) ]
  File "<decorator-gen-14>", line 2, in get_frame
  File "/usr/local/lib/python3.6/site-packages/moviepy/decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "/usr/local/lib/python3.6/site-packages/moviepy/Clip.py", line 95, in get_frame
    return self.make_frame(t)
  File "/usr/local/lib/python3.6/site-packages/moviepy/Clip.py", line 136, in <lambda>
    newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
  File "/usr/local/lib/python3.6/site-packages/moviepy/Clip.py", line 188, in <lambda>
    return self.fl(lambda gf, t: gf(t_func(t)), apply_to,
  File "<decorator-gen-14>", line 2, in get_frame
  File "/usr/local/lib/python3.6/site-packages/moviepy/decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "/usr/local/lib/python3.6/site-packages/moviepy/Clip.py", line 95, in get_frame
    return self.make_frame(t)
  File "/usr/local/lib/python3.6/site-packages/moviepy/audio/io/AudioFileClip.py", line 71, in <lambda>
    self.make_frame =  lambda t: reader.get_frame(t)
  File "/usr/local/lib/python3.6/site-packages/moviepy/audio/io/readers.py", line 193, in get_frame
    "but len(buffer)=%d\n"%(len(self.buffer))+ str(error))
OSError: Error in file initial1.mp4, At time t=13.61-13.61 seconds, indices wanted: 100000-100200, but len(buffer)=100197
index 100197 is out of bounds for axis 0 with size 100197

I looked at a bunch of issues in the past which say this has been resolved, but I am still encountering the same.

@Zulko your help will be appreciated. Thanks in advance.

@tburrows13
Copy link
Collaborator

tburrows13 commented Apr 3, 2017

Can you try using the version in the repo? I think this has been fixed. EDIT: Actually, #377 is a fix for this, and will be merged shortly. Wait until then, or locally use the repo from https://github.com/gyglim/moviepy (with the fixes in)

@ghost
Copy link

ghost commented Apr 4, 2017

@pchheda can you try the version in the repo? if you don't know how, ask, and we can help you.

@pchheda
Copy link
Author

pchheda commented Apr 5, 2017

@Earney Yup. It would be great if you can help me with that? What would be the best way to use this version?

@mbeacom
Copy link
Collaborator

mbeacom commented Apr 5, 2017

@pchheda You can now install the equivalent of master via pip install --upgrade moviepy as all of the fixes to date have been rolled into Release v0.2.3.1

Can try out the latest release and report back on whether or not that resolved your issue?

Thanks!

@mbeacom
Copy link
Collaborator

mbeacom commented Apr 12, 2017

@pchheda Has the latest build resolved your issue?

Thanks.

@mbeacom mbeacom added the bug Issues that report (apparent) bugs. label Apr 12, 2017
@pchheda
Copy link
Author

pchheda commented Apr 13, 2017

It worked well. I was giving it some time to ensure it doesn't pop up again. I tried it on a bunch of videos of different types and sizes. It seems fixed to me. Thanks everyone for helping. Closing the issue. Cheers!

@pchheda pchheda closed this as completed Apr 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that report (apparent) bugs.
Projects
None yet
Development

No branches or pull requests

3 participants