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

Simple GIF from zipped #291

Open
enzyme69 opened this issue Apr 30, 2016 · 9 comments
Open

Simple GIF from zipped #291

enzyme69 opened this issue Apr 30, 2016 · 9 comments
Labels
good-first-issue Especially suitable for people new to moviepy and/or programming; beginner-friendly. images Related to ImageClip, or handling of images in general.

Comments

@enzyme69
Copy link

While looking for Python image sequence to GIF, I stumbled into your moviepy module:
http://zulko.github.io/blog/2014/01/23/making-animated-gifs-from-video-files-with-python/

I tested using MP4 and MOV seems to work perfectly.

However, rather than to create MOV using Quicktime or Blender each time, is there a simpler way to skip the video to GIF, but instead to work from ZIP or Folder Path, to get all the files in sequence and generate GIF?

Thanks!

@Zulko
Copy link
Owner

Zulko commented Apr 30, 2016

use

clip = ImageSequenceClip(my_path, fps=20)

where my_path contains the images in the right order.

@enzyme69
Copy link
Author

enzyme69 commented Aug 29, 2016

I keep getting this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jimmygunawan/anaconda/envs/py35/lib/python3.5/site-packages/moviepy/video/io/ImageSequenceClip.py", line 104, in **init**
    if with_mask and (make_frame(0).shape[2]==4):
  File "/Users/jimmygunawan/anaconda/envs/py35/lib/python3.5/site-packages/moviepy/video/io/ImageSequenceClip.py", line 99, in make_frame
    self.lastimage = imread(self.sequence[index])[:,:,:3] 
  File "/Users/jimmygunawan/anaconda/envs/py35/lib/python3.5/site-packages/imageio/core/functions.py", line 181, in imread
    reader = read(uri, format, 'i', **kwargs)
  File "/Users/jimmygunawan/anaconda/envs/py35/lib/python3.5/site-packages/imageio/core/functions.py", line 108, in get_reader
    'in mode %r' % mode)
ValueError: Could not find a format to read the specified file in mode 'i'

Wonder that's because the image sequences are PNGs output from Blender?

@keikoro
Copy link
Collaborator

keikoro commented Feb 18, 2017

Linking this to #219, which is about the same error.

@Nick-Zhang1996
Copy link

I'm having this problem too, and it's been more than one year since this issue is first addressed, is anyone maintaining moviepy?

@Zulko
Copy link
Owner

Zulko commented Jul 30, 2017

Can you explain what your problem is ? are you also using Blender ?

@Nick-Zhang1996
Copy link

My apologizes, after some debugging I realized the problem does not lie in moviepy.

I'm not sure whether this would help anybody, but here's the cause of my problem:
I was calling imread() on a file that is not a picture.

here's my stack:

 File "video.py", line 27, in <module>
    main()
  File "video.py", line 22, in main
    clip = ImageSequenceClip(args.image_folder, fps=args.fps)
  File "/root/miniconda3/envs/carnd/lib/python3.6/site-
packages/moviepy/video/io/ImageSequenceClip.py", line 106, in __init__
    if with_mask and (imread(self.sequence[0]).shape[2]==4):
  File "/root/miniconda3/envs/carnd/lib/python3.6/site-packages/imageio/core/functions.py", line 
185, in imread
    reader = read(uri, format, 'i', **kwargs)
  File "/root/miniconda3/envs/carnd/lib/python3.6/site-packages/imageio/core/functions.py", line 
108, in get_reader
    'in mode %r' % mode)
ValueError: Could not find a format to read the specified file in mode 'i'

which resembles this line from @enzyme69 's call stack
self.lastimage = imread(self.sequence[index])[:,:,:3]

So I guess there may be a connection.

I was trying to make a video from pictures in a folder. I forgot there's a .DS_Store file automatically generated in that folder along with all the picture. This file got picked up by moviepy and caused the problem.

@keikoro keikoro added the images Related to ImageClip, or handling of images in general. label Nov 25, 2017
@keikoro
Copy link
Collaborator

keikoro commented Nov 25, 2017

@enzyme69 Does the problem persist?

@tburrows13 tburrows13 added this to the Release v2.0.0 milestone May 10, 2020
@tburrows13
Copy link
Collaborator

I'd say that this should be fixed. I suggest putting more checks in ImageSequenceClip to ensure that (particularly when passing in a folder name) no non-images are loaded. This can catch people out because sometimes there are hidden files (such as .DS_Store on Mac) that cause it to crash.

@tburrows13 tburrows13 added the good-first-issue Especially suitable for people new to moviepy and/or programming; beginner-friendly. label Jun 16, 2020
@pioneerHitesh
Copy link

pioneerHitesh commented Oct 17, 2023

@tburrows13 can you assign this to me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue Especially suitable for people new to moviepy and/or programming; beginner-friendly. images Related to ImageClip, or handling of images in general.
Projects
None yet
Development

No branches or pull requests

6 participants