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

This is what exception.... #437

Closed
linzhi opened this issue Feb 22, 2017 · 7 comments
Closed

This is what exception.... #437

linzhi opened this issue Feb 22, 2017 · 7 comments

Comments

@linzhi
Copy link

linzhi commented Feb 22, 2017

Code is:

from moviepy.editor import *

clip = VideoFileClip("dog.mp4").subclip(1, 10)
Traceback (most recent call last):
  File "test.py", line 4, in <module>
    from moviepy.editor import *
  File "/usr/local/lib/python2.7/site-packages/moviepy/editor.py", line 22, in <module>
    from .video.io.VideoFileClip import VideoFileClip
  File "/usr/local/lib/python2.7/site-packages/moviepy/video/io/VideoFileClip.py", line 3, in <module>
    from moviepy.video.VideoClip import VideoClip
  File "/usr/local/lib/python2.7/site-packages/moviepy/video/VideoClip.py", line 11, in <module>
    import tempfile
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 32, in <module>
    import io as _io
  File "/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/io.py", line 51, in <module>
    import _io
ImportError: dlopen(/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so, 2): Symbol not found: __PyCodecInfo_GetIncrementalDecoder
  Referenced from: /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
  Expected in: flat namespace
 in /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_io.so
@ghost
Copy link

ghost commented Feb 22, 2017

Linzhi,
Are you getting this with other python apps? It looks like an issue with your python installation.

Maybe try something like the following to see if you get the same error:

import tempfile

@linzhi
Copy link
Author

linzhi commented Feb 22, 2017

This exception has resolved, But....A new exception happened

[MoviePy] Building file dog.gif with imageio
  0%|                                                                                                                                                 | 0/51 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "test.py", line 7, in <module>
    clip.write_gif("dog.gif")
  File "<decorator-gen-56>", line 2, in write_gif
  File "/usr/local/lib/python2.7/site-packages/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "<decorator-gen-55>", line 2, in write_gif
  File "/usr/local/lib/python2.7/site-packages/moviepy/decorators.py", line 22, in convert_masks_to_RGB
    return f(clip, *a, **k)
  File "/usr/local/lib/python2.7/site-packages/moviepy/video/VideoClip.py", line 461, in write_gif
    verbose=verbose, colors=colors)
  File "/usr/local/lib/python2.7/site-packages/moviepy/video/io/gif_writers.py", line 291, in write_gif_with_image_io
    writer.append_data(frame)
  File "/usr/local/lib/python2.7/site-packages/imageio/core/format.py", line 481, in append_data
    return self._append_data(im, total_meta)
  File "/usr/local/lib/python2.7/site-packages/imageio/plugins/pillowmulti.py", line 101, in _append_data
    self._writer.add_image(im, duration, dispose)
  File "/usr/local/lib/python2.7/site-packages/imageio/plugins/pillowmulti.py", line 146, in add_image
    self.opt_palette_size)
  File "/usr/local/lib/python2.7/site-packages/imageio/plugins/pillowmulti.py", line 348, in converToPIL
    raise ValueError('Invalid value for quantizer: %r' % quantizer)
ValueError: Invalid value for quantizer: 'wu'

=====================================
And my demo is:

#!/usr/bin/env python2

import moviepy.editor as mpy

clip = mpy.VideoFileClip("dog.mp4").subclip(2, 4)

clip.write_gif("dog.gif")

@ghost
Copy link

ghost commented Feb 22, 2017

issue #368 talks about this..

one person suggests changing write_gif to write_videofile .

@Zulko
Copy link
Owner

Zulko commented Feb 22, 2017

It's just a compatibility bug linked to a new version of imageio, i'll send a pr fixing this, but as soon as imageio ships more recent ffmpeg versions (2.6+) there will be yet another way to produce gifs.

Changing write_gif to write_videofile is a bad idea: first it would be more confusing for people wanting to make gifs, second the way gifs are created can be different from videos, there would be little code factoring to be gained, and most importantly the parameters you need to write gifs are very different from the parameters you need for videos, so we would end up with 20 parameters for the same method, half of which have one use case only, and the other half another use case.

@linzhi
Copy link
Author

linzhi commented Feb 23, 2017

Now the most appropriate solutions is to wait for fixing this problem...@Zulko

@linzhi
Copy link
Author

linzhi commented Feb 23, 2017

use

clip.write_gif("dog.gif", program='ffmpeg')

solved this problem by this way, thanks @Zulko

@linzhi linzhi closed this as completed Feb 23, 2017
@Zulko
Copy link
Owner

Zulko commented Feb 23, 2017

The thing is that if you just feed the gifs to ffmpeg like this, they will generally look less nice or be less optimized than with imagemagick. I'll try to push some improvements soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants