Closed mike592 closed 4 years ago
this may be time mirror bug
File "site-packages\moviepy\Clip.py", line 212, in fx
File "<decorator-gen-81>", line 2, in time_mirror
File "site-packages\moviepy\decorators.py", line 54, in requires_duration
File "<decorator-gen-80>", line 2, in time_mirror
File "site-packages\moviepy\decorators.py", line 29, in apply_to_mask
File "<decorator-gen-79>", line 2, in time_mirror
File "site-packages\moviepy\decorators.py", line 41, in apply_to_audio
File "site-packages\moviepy\video\fx\time_mirror.py", line 13, in time_mirror
File "site-packages\moviepy\Clip.py", line 187, in fl_time
File "site-packages\moviepy\Clip.py", line 136, in fl
File "<decorator-gen-61>", line 2, in set_make_frame
File "site-packages\moviepy\decorators.py", line 14, in outplace
File "site-packages\moviepy\video\VideoClip.py", line 646, in set_make_frame
File "<decorator-gen-11>", line 2, in get_frame
File "site-packages\moviepy\decorators.py", line 89, in wrapper
File "site-packages\moviepy\Clip.py", line 93, in get_frame
File "site-packages\moviepy\Clip.py", line 136, in <lambda>
File "site-packages\moviepy\Clip.py", line 187, in <lambda>
File "<decorator-gen-11>", line 2, in get_frame
File "site-packages\moviepy\decorators.py", line 89, in wrapper
File "site-packages\moviepy\Clip.py", line 93, in get_frame
File "site-packages\moviepy\Clip.py", line 136, in <lambda>
File "site-packages\moviepy\Clip.py", line 187, in <lambda>
File "<decorator-gen-11>", line 2, in get_frame
File "site-packages\moviepy\decorators.py", line 89, in wrapper
File "site-packages\moviepy\Clip.py", line 93, in get_frame
File "site-packages\moviepy\video\compositing\concatenate.py", line 83, in make_frame
IndexError: list index out of range
Sorry, I cannot replicate this with the file that you sent me in #1233. Are you using the code in #1222?
As with all bug reports, please provide the exact code that you are running and the media file that you are using it on (or use one of examples from moviepy/media).
Hi, this issue still exists on latest version of moviepy. Here is what I tried to reproduce:
(opt) ubuntu@merlin:VideoToGIF $ python
Python 3.9.0+ (default, Oct 20 2020, 08:43:38)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from moviepy.editor import VideoFileClip
>>> clip = VideoFileClip("/opt/cogs/VideoToGIF/kittens_of_world_20200905_223850_0.mp4", audio=False)
>>> clip = clip.resize(0.3)
>>> clip.write_gif("/opt/cogs/VideoToGIF/final.gif", program='ffmpeg', opt='optimizeplus')
MoviePy - Building file /opt/cogs/VideoToGIF/final.gif
MoviePy - - Generating GIF frames.
t: 99%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉ | 202/205 [00:01<00:00, 94.65it/s, now=None]
/opt/lib/python3.9/site-packages/moviepy/video/io/ffmpeg_reader.py:154: UserWarning:
In file /opt/cogs/VideoToGIF/kittens_of_world_20200905_223850_0.mp4, 864000 bytes wanted but 0 bytes read,at frame index 204 (out of a total 205 frames), at time 6.80/6.85 sec. Using the last valid frame instead.
warnings.warn(
MoviePy - - File ready: /opt/cogs/VideoToGIF/final.gif.
>>> exit()
(opt) ubuntu@merlin:VideoToGIF $ la
total 3.0M
drwxr-xr-x 2 ubuntu ubuntu 4.0K Feb 17 12:13 .
drwxr-xr-x 73 ubuntu ubuntu 4.0K Feb 16 10:19 ..
-rw-r--r-- 1 ubuntu ubuntu 2.5M Feb 17 12:25 final.gif
-rw-r--r-- 1 ubuntu ubuntu 566K Feb 17 12:12 kittens_of_world_20200905_223850_0.mp4
ffmpeg_reader.py shows the warning which is mentioned in issue title. Is it safe to ignore?
Yes you can ignore that warning. It just means that moviepy was expecting one extra frame at the end of the video that wasn't there, so it duplicated the last frame instead. There's been quite a few changes in this bit of moviepy's code since 1.0.3 so it might be fixed in 2.0 anyway.
Your video file may be corrupted, you can check it with ffmpeg.
Still crash. But this crash occured when do time_mirror:
crash test code:
clip.fx(vfx.time_mirror)
crash result: