Moviepy: Could not find a format to read the specified file in mode 'i'

Created on 21 Oct 2015  路  12Comments  路  Source: Zulko/moviepy

I have created a script to add few images and text in a video. It works fine when I run it from command line.
But when I try to run it from a web-application, through apache (django 1.8 with mod_wsgi), It fails with following error at img = imread(img) (VideoClip.py)

Error : Could not find a format to read the specified file in mode 'i'

Please help

bug

Most helpful comment

So, I don't know about anybody else but I had a similar problem on my Mac. I was using a virtualenv and I was also passing the folder path to the function. Adding a few debug statements to the imageio installed in my virtualenv showed me that the file it kept hanging on was a hidden .DS_Store file. Once I deleted that file in the specified directory, everything ran as expected.

Hope that helps!

All 12 comments

I am having the same problem. Have you managed to find the solution?

Same problem here. Running from within a django virtual env.

I solved the problem by installing ffmpeg and making sure all my dependencies were satisfied. This is a problem with the environment. I was trying to execute this on aws lambda, so I had to package it correctly for deployment, subsequently I discovered ffmpeg was the problem.

Thanks. What ffmpeg version are you using? Were there other dependencies you think made a difference? I tried installing the latest version and followed the instructions at moviepy/config_defaults.py to change the binary used by moviepy but I'm still getting the same error.

Take a look at this thread - https://github.com/imageio/imageio/issues/126

I am also having the same problem. Had a moviepy script which was working well on my macbook running El Capitan, but now running into this error while trying to get the script running on ubuntu 14 on EC2.

Here is the exact error I get
File "/var/www/montage/montage_script/montage_beta.py", line 207, in _create_ken_burns_clip image_clip = ImageClip(photo_file_path) File "/var/www/montage/custom_moviepy/moviepy/video/VideoClip.py", line 923, in __init__ img = imread(img) File "/usr/local/lib/python2.7/dist-packages/imageio/core/functions.py", line 181, in imread reader = read(uri, format, 'i', **kwargs) File "/usr/local/lib/python2.7/dist-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'

Below are the relevant lines from my ansible script, which completely determined the configuration of the machine:

apt: name=python-pip update_cache=yes state=latest apt: name=python-dev update_cache=yes state=latest apt: name=python-setuptools update_cache=yes state=latest command: apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk pip: requirements=/var/www/montage/aws_requirements.txt

Below is my aws_requirements.txt file
boto3==1.2.3 moviepy==0.2.2.11 Flask==0.10.1 slackclient==0.18.0 awscli==1.10.7 Pillow==3.1.1 imageio==1.5

I will also read through the imageio thread you linked and will post my answer back here if I figure something out.

Any intuitions on what might be missing from the installation?

So, I don't know about anybody else but I had a similar problem on my Mac. I was using a virtualenv and I was also passing the folder path to the function. Adding a few debug statements to the imageio installed in my virtualenv showed me that the file it kept hanging on was a hidden .DS_Store file. Once I deleted that file in the specified directory, everything ran as expected.

Hope that helps!

@hgillh did you manage to solve the original problem with the input provided in this issue?

Everyone else: is this something that should be hinted at in the documentation? I'm also asking because the newest issue, #420, sounds like it might be similar to what some who commented in here experienced.

To clarifiy: the other issue is not about the same error message, my comment was meant more in regard to running into problems when using moviepy with Django/in different environments.

I'm closing this. Please reopen (or create a new issue) if this is something that should get added to the docs.

I didn't have a .DS_Store, my issue was the filename had spaces. Removing spaces from filenames solved the issue.

ValueError: Could not find a format to read the specified file in single-image mode

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PyB1l picture PyB1l  路  3Comments

LaoYuanPython picture LaoYuanPython  路  3Comments

xjcl picture xjcl  路  3Comments

Netherdrake picture Netherdrake  路  4Comments

bobozar picture bobozar  路  4Comments