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

Unable to run the sample code! Getting errors. Plase Help #401

Closed
batmanrising opened this issue Feb 8, 2017 · 16 comments
Closed

Unable to run the sample code! Getting errors. Plase Help #401

batmanrising opened this issue Feb 8, 2017 · 16 comments
Labels
question Questions regarding functionality, usage

Comments

@batmanrising
Copy link

batmanrising commented Feb 8, 2017

Hi there, I tried to run the sample/example code for the moviePy but I'm getting this error. I don't know how to resolve. I'm an novice in the field so don't have an experience like you guys.

from moviepy.editor import *
clip = VideoFileClip("myHolidays.mp4").subclip(5,15)
clip = clip.volumex(0.8)
txt_clip = TextClip("My Holidays 2013",fontsize=70,color='white')
txt_clip = txt_clip.set_pos('center').set_duration(10)
video = CompositeVideoClip([clip, txt_clip])
video.write_videofile("myHolidays_edited.avi")

Error message:

[MoviePy] This command returned an error !
Traceback (most recent call last):
  File "/home/pi/clip_example.py", line 11, in <module>
    txt_clip = TextClip("My Holidays 2013",fontsize=70,color='white')
  File "/usr/local/lib/python2.7/dist-packages/moviepy/video/VideoClip.py", line 1173, in __init__
    raise IOError(error)
IOError: MoviePy Error: creation of None failed because of the following error:

convert: not authorized `@/tmp/tmpIJUQvL.txt' @ error/property.c/InterpretImageProperties/3405.
convert: no images defined `PNG32:/tmp/tmpt9CCfR.png' @ error/convert.c/ConvertImageCommand/3210.
.

.This error can be due to the fact that ImageMagick is not installed on your computer, or (for Windows users) that you didn't specify the path to the ImageMagick binary in file conf.py, or.that the path you specified is incorrect
@mbeacom mbeacom added the question Questions regarding functionality, usage label Feb 8, 2017
@batmanrising batmanrising changed the title Unable to run the sample code !Getting errors Unable to run the sample code! Getting errors. Plase Help Feb 8, 2017
@mbeacom
Copy link
Collaborator

mbeacom commented Feb 8, 2017

@bhavin20feb You'll need to install imagemagick. If you're on OSX, you can install it via macports or brew. Also, the code you're referencing is merely an example. You will need to modify the myHolidays.mp4 filename reference to an existing MP4 file for this example to work.
Let me know if that resolves your issue!

@batmanrising
Copy link
Author

batmanrising commented Feb 8, 2017

Let me know if that resolves your issue!
Hi, @mbeacom thanks a lot for responding on my post. I'm on Raspbian Jessie.
I have already installed FFmpeg, imagemagic, as well as moviepy. But I'm still getting this error.
Also, before executing the code I renamed one mp4 video to myHolidays.mp4

I also tried executing this code,

from moviepy.editor import *
video = VideoFileClip("vidnew.mpg").subclip(5,15)
video.write_videofile("vidnew_edited.mpg",fps=24, codec='mpeg4')

Still getting the errors.

My goal is to take the subclips (ex. clip1, clip2, etc.) from different videos and then concatenate them.

I read on zulko.github.io that for composite video clips one can use the following code,

video = concatenate([clip1,clip2,clip3])
video = CompositeVideoClip([clip1,clip2,clip3])

but I'm unable to extract a simple 10 second clip from a single video.

@ghost
Copy link

ghost commented Feb 9, 2017

I just figured this out.. imagemagick (ie, convert) has a policy.xml file that stops you from accessing any resource that starts with '@'.

type identify -list policy
the first line should tell you where your policy.xml file is located. My policy.xml file is lcoated at /etc/ImageMagick-6/policy.xml

open that file, and goto to the end and comment out (or remove the line that reads)

<policy domain="path" rights="none" pattern="@*" />

since this is xml, you can comment out this line by appending the line with <!-- and ending it with -->

Hope this helps!

@batmanrising
Copy link
Author

Hi, @Earney, I tried again by making the changes you've suggested, but I'm still getting an error.

TypeError: Type str doesn't support the buffer API

@ghost
Copy link

ghost commented Feb 9, 2017

Hi.. I don't get this exact error, so can you copy and paste the output that is on your screen?

@batmanrising
Copy link
Author

batmanrising commented Feb 9, 2017

This is my code to extract 10 seconds clip from a video

from moviepy.editor import *
video = VideoFileClip("vidnew.mpg").subclip(5,15)
video.write_videofile("vidnew_edited.mpg",fps=24, codec='mpeg4')

And this is the output error

> 

> >>> ================================ RESTART ================================
> >>> 
> [MoviePy] >>>> Building video vidnew_edited.mpg
> [MoviePy] Writing video vidnew_edited.mpg
> 
>   0%|          | 0/241 [00:00<?, ?it/s]
> Traceback (most recent call last):
>   File "/usr/local/lib/python3.4/dist-packages/moviepy/video/io/ffmpeg_writer.py", line 137, in write_frame
>     self.proc.stdin.write(img_array.tostring())
> BrokenPipeError: [Errno 32] Broken pipe
> 
> During handling of the above exception, another exception occurred:
> 
> Traceback (most recent call last):
>   File "/home/pi/clip_example1.py", line 5, in <module>
>     video.write_videofile("vidnew_edited.mpg",fps=24, codec='mpeg4')
>   File "<decorator-gen-51>", line 2, in write_videofile
>   File "/usr/local/lib/python3.4/dist-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.4/dist-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.4/dist-packages/moviepy/decorators.py", line 22, in convert_masks_to_RGB
>     return f(clip, *a, **k)
>   File "/usr/local/lib/python3.4/dist-packages/moviepy/video/VideoClip.py", line 338, in write_videofile
>     ffmpeg_params=ffmpeg_params)
>   File "/usr/local/lib/python3.4/dist-packages/moviepy/video/io/ffmpeg_writer.py", line 216, in ffmpeg_write_video
>     writer.write_frame(frame)
>   File "/usr/local/lib/python3.4/dist-packages/moviepy/video/io/ffmpeg_writer.py", line 144, in write_frame
>     if "Unknown encoder" in ffmpeg_error:
> TypeError: Type str doesn't support the buffer API
> >>> 
> 

@ghost
Copy link

ghost commented Feb 10, 2017 via email

@ghost
Copy link

ghost commented Feb 10, 2017

goto line 144 of file "/usr/local/lib/python3.4/dist-packages/moviepy/video/io/ffmpeg_writer.py"

and modify the line so that there is a b before the double quote.

If b"Unknown error"

it seems some of these files do not work with python 3.4 or python 3.5

@ghost
Copy link

ghost commented Feb 10, 2017

if you continue having issues, try the enclosed version of the file. I had to make a few additional adjustments to get this working for your example. You will need to remove the .txt extension of the file. github will not allow me to upload a file with an extension of .py.

ffmpeg_writer.py.txt

This was referenced Feb 10, 2017
mbeacom pushed a commit that referenced this issue Feb 15, 2017
@ghost
Copy link

ghost commented Feb 15, 2017

we believe the newest version should fix this issue. Please reopen if you see that the issue has not been resolved.

@ghost ghost closed this as completed Feb 15, 2017
tburrows13 pushed a commit to tburrows13/moviepy that referenced this issue Feb 27, 2017
* Fixed copy-paste typo

Changed documentation for the color parameter to distinguish from bg_color

* Fixed missing list

(using python 3)

* fixed module hierarchy for Trajectory

* fixed addy

* small recipe

* on_color function docstring has wrong parameter

The docstring for the on_color method has a parameter of bg_color but
the function uses color as the parameter.

* Update README.rst

Changed Code Block to use Python Syntax Highlighting

* fix deprecation message

currently, the docstring is nonsense. 

```
The function ``concatenate_videoclips`` is deprecated and is kept temporarily for backwards compatibility.
Please use the new name, ``concatenate_videoclips``, instead.
```

* ImageSequenceClip: Check for fps and durations rather than fps and duration

* Add a test case.

* Add another test

* ensures int arguments to np.reshape; closes Zulko#383

* fix issue Zulko#401

*  fix issue Zulko#335

* Update maintainer section in README

* make concatenate_videoclips Python 3 compatible..  fix issue Zulko#313

* Increment release version

* CompositeVideoClip doesn't accept an argument of transparent

* move PY3 variable to compat.py

* fix movie => moviepy typo

* fix issue Zulko#341

* Fixed typo Zulko#375

Zulko#375 fixed

* fix issue Zulko#357, which makes real problem more obvious (media file does not exist

* Revert "small recipe (mirroring a video)"

* Fixed indentation

* .gitignore ignore Mac-specific files, Jetbrains settings dir

* README.rst make mention of Gitter, add PyPI and Gitter badge

* README.rst wording, formatting

* README.rst structure link targets, add co-maintainers (with @username)

* README.rst move maintainers, contributing sections; change docs x-reference name

* README.rst fix grammar

* fix issue 145.  raise Exception when concatenate method != chain or compose

* make PEP8 compatible

* fix PR Zulko#413 . (issue Zulko#357)

* create test for issue Zulko#145

* add tests/media to .gitignore

* fix Issue Zulko#385 ,  no DirectoryClip class (Zulko#434)

* fix issue Zulko#385 , no DirectoryClip class

* replace DirectoryClip with ImageSequenceClip

* fix issue 417, unicode has no attribute 'shape' error.

* add test for issue 417

* add test for issue 417

* Fixed resize documentation issue Zulko#319 (Zulko#346)

* Handle bytes when listing fonts in VideoClip.py (Zulko#306)

Handle bytes when listing fonts in VideoClip.py

* add test for PR306

* add test for PR306 (Zulko#440)

* create test file for pull requests (Zulko#433)

* Test issue 407 (video has a valid fps after concatenate function) (Zulko#443)

* Move PR test to test_PR.py file (Zulko#444)

* move PR test from test_issues.py to test_PR.py

* add code to download python_logo.png

* remove duplicate test_issue_417 function

* add testing with travis-ci (Zulko#447)

added testing via travis-ci

* put DEVNULL into compat.py (Zulko#432)

* add travis-ci badge to readme file

* pick highest fps when concatenating (Zulko#416)

* readers.py cast chunksize from float to int

* choose highest fps of clips when concatenating

* pick highest fps when concatenating

* pick highest fps when concatenating

* fps either max or none

* remove resolve markers

removed resolve markers such as HEAD, etc so that the file will compile correctly.
Remove some double blank lines, etc

* update concatenate.py; add c.fps is not None

* add test for issue 416

* fix test_issue_416
tburrows13 pushed a commit to tburrows13/moviepy that referenced this issue Feb 27, 2017
* Fixed copy-paste typo

Changed documentation for the color parameter to distinguish from bg_color

* Fixed missing list

(using python 3)

* fixed module hierarchy for Trajectory

* fixed addy

* small recipe

* on_color function docstring has wrong parameter

The docstring for the on_color method has a parameter of bg_color but
the function uses color as the parameter.

* Update README.rst

Changed Code Block to use Python Syntax Highlighting

* fix deprecation message

currently, the docstring is nonsense. 

```
The function ``concatenate_videoclips`` is deprecated and is kept temporarily for backwards compatibility.
Please use the new name, ``concatenate_videoclips``, instead.
```

* ImageSequenceClip: Check for fps and durations rather than fps and duration

* Add a test case.

* Add another test

* ensures int arguments to np.reshape; closes Zulko#383

* fix issue Zulko#401

*  fix issue Zulko#335

* Update maintainer section in README

* make concatenate_videoclips Python 3 compatible..  fix issue Zulko#313

* Increment release version

* CompositeVideoClip doesn't accept an argument of transparent

* move PY3 variable to compat.py

* fix movie => moviepy typo

* fix issue Zulko#341

* Fixed typo Zulko#375

Zulko#375 fixed

* fix issue Zulko#357, which makes real problem more obvious (media file does not exist

* Revert "small recipe (mirroring a video)"

* Fixed indentation

* .gitignore ignore Mac-specific files, Jetbrains settings dir

* README.rst make mention of Gitter, add PyPI and Gitter badge

* README.rst wording, formatting

* README.rst structure link targets, add co-maintainers (with @username)

* README.rst move maintainers, contributing sections; change docs x-reference name

* README.rst fix grammar

* fix issue 145.  raise Exception when concatenate method != chain or compose

* make PEP8 compatible

* fix PR Zulko#413 . (issue Zulko#357)

* create test for issue Zulko#145

* add tests/media to .gitignore

* fix Issue Zulko#385 ,  no DirectoryClip class (Zulko#434)

* fix issue Zulko#385 , no DirectoryClip class

* replace DirectoryClip with ImageSequenceClip

* fix issue 417, unicode has no attribute 'shape' error.

* add test for issue 417

* add test for issue 417

* Fixed resize documentation issue Zulko#319 (Zulko#346)

* Handle bytes when listing fonts in VideoClip.py (Zulko#306)

Handle bytes when listing fonts in VideoClip.py

* add test for PR306

* add test for PR306 (Zulko#440)

* create test file for pull requests (Zulko#433)

* Test issue 407 (video has a valid fps after concatenate function) (Zulko#443)

* Move PR test to test_PR.py file (Zulko#444)

* move PR test from test_issues.py to test_PR.py

* add code to download python_logo.png

* remove duplicate test_issue_417 function

* add testing with travis-ci (Zulko#447)

added testing via travis-ci

* put DEVNULL into compat.py (Zulko#432)

* add travis-ci badge to readme file

* pick highest fps when concatenating (Zulko#416)

* readers.py cast chunksize from float to int

* choose highest fps of clips when concatenating

* pick highest fps when concatenating

* pick highest fps when concatenating

* fps either max or none

* remove resolve markers

removed resolve markers such as HEAD, etc so that the file will compile correctly.
Remove some double blank lines, etc

* update concatenate.py; add c.fps is not None

* add test for issue 416

* fix test_issue_416
tburrows13 pushed a commit that referenced this issue Mar 2, 2017
* Changed the `col` paramater of `ColorClip` to `color` and added a DeprecationWarning if the users tries to use `col`

* Update VideoFileClip.py

* Added warnings

* Update (#3)

* Fixed copy-paste typo

Changed documentation for the color parameter to distinguish from bg_color

* Fixed missing list

(using python 3)

* fixed module hierarchy for Trajectory

* fixed addy

* small recipe

* on_color function docstring has wrong parameter

The docstring for the on_color method has a parameter of bg_color but
the function uses color as the parameter.

* Update README.rst

Changed Code Block to use Python Syntax Highlighting

* fix deprecation message

currently, the docstring is nonsense. 

```
The function ``concatenate_videoclips`` is deprecated and is kept temporarily for backwards compatibility.
Please use the new name, ``concatenate_videoclips``, instead.
```

* ImageSequenceClip: Check for fps and durations rather than fps and duration

* Add a test case.

* Add another test

* ensures int arguments to np.reshape; closes #383

* fix issue #401

*  fix issue #335

* Update maintainer section in README

* make concatenate_videoclips Python 3 compatible..  fix issue #313

* Increment release version

* CompositeVideoClip doesn't accept an argument of transparent

* move PY3 variable to compat.py

* fix movie => moviepy typo

* fix issue #341

* Fixed typo #375

#375 fixed

* fix issue #357, which makes real problem more obvious (media file does not exist

* Revert "small recipe (mirroring a video)"

* Fixed indentation

* .gitignore ignore Mac-specific files, Jetbrains settings dir

* README.rst make mention of Gitter, add PyPI and Gitter badge

* README.rst wording, formatting

* README.rst structure link targets, add co-maintainers (with @username)

* README.rst move maintainers, contributing sections; change docs x-reference name

* README.rst fix grammar

* fix issue 145.  raise Exception when concatenate method != chain or compose

* make PEP8 compatible

* fix PR #413 . (issue #357)

* create test for issue #145

* add tests/media to .gitignore

* fix Issue #385 ,  no DirectoryClip class (#434)

* fix issue #385 , no DirectoryClip class

* replace DirectoryClip with ImageSequenceClip

* fix issue 417, unicode has no attribute 'shape' error.

* add test for issue 417

* add test for issue 417

* Fixed resize documentation issue #319 (#346)

* Handle bytes when listing fonts in VideoClip.py (#306)

Handle bytes when listing fonts in VideoClip.py

* add test for PR306

* add test for PR306 (#440)

* create test file for pull requests (#433)

* Test issue 407 (video has a valid fps after concatenate function) (#443)

* Move PR test to test_PR.py file (#444)

* move PR test from test_issues.py to test_PR.py

* add code to download python_logo.png

* remove duplicate test_issue_417 function

* add testing with travis-ci (#447)

added testing via travis-ci

* put DEVNULL into compat.py (#432)

* add travis-ci badge to readme file

* pick highest fps when concatenating (#416)

* readers.py cast chunksize from float to int

* choose highest fps of clips when concatenating

* pick highest fps when concatenating

* pick highest fps when concatenating

* fps either max or none

* remove resolve markers

removed resolve markers such as HEAD, etc so that the file will compile correctly.
Remove some double blank lines, etc

* update concatenate.py; add c.fps is not None

* add test for issue 416

* fix test_issue_416

* Update Gloin (#4)

* Fixed copy-paste typo

Changed documentation for the color parameter to distinguish from bg_color

* Fixed missing list

(using python 3)

* fixed module hierarchy for Trajectory

* fixed addy

* small recipe

* on_color function docstring has wrong parameter

The docstring for the on_color method has a parameter of bg_color but
the function uses color as the parameter.

* Update README.rst

Changed Code Block to use Python Syntax Highlighting

* fix deprecation message

currently, the docstring is nonsense. 

```
The function ``concatenate_videoclips`` is deprecated and is kept temporarily for backwards compatibility.
Please use the new name, ``concatenate_videoclips``, instead.
```

* ImageSequenceClip: Check for fps and durations rather than fps and duration

* Add a test case.

* Add another test

* ensures int arguments to np.reshape; closes #383

* fix issue #401

*  fix issue #335

* Update maintainer section in README

* make concatenate_videoclips Python 3 compatible..  fix issue #313

* Increment release version

* CompositeVideoClip doesn't accept an argument of transparent

* move PY3 variable to compat.py

* fix movie => moviepy typo

* fix issue #341

* Fixed typo #375

#375 fixed

* fix issue #357, which makes real problem more obvious (media file does not exist

* Revert "small recipe (mirroring a video)"

* Fixed indentation

* .gitignore ignore Mac-specific files, Jetbrains settings dir

* README.rst make mention of Gitter, add PyPI and Gitter badge

* README.rst wording, formatting

* README.rst structure link targets, add co-maintainers (with @username)

* README.rst move maintainers, contributing sections; change docs x-reference name

* README.rst fix grammar

* fix issue 145.  raise Exception when concatenate method != chain or compose

* make PEP8 compatible

* fix PR #413 . (issue #357)

* create test for issue #145

* add tests/media to .gitignore

* fix Issue #385 ,  no DirectoryClip class (#434)

* fix issue #385 , no DirectoryClip class

* replace DirectoryClip with ImageSequenceClip

* fix issue 417, unicode has no attribute 'shape' error.

* add test for issue 417

* add test for issue 417

* Fixed resize documentation issue #319 (#346)

* Handle bytes when listing fonts in VideoClip.py (#306)

Handle bytes when listing fonts in VideoClip.py

* add test for PR306

* add test for PR306 (#440)

* create test file for pull requests (#433)

* Test issue 407 (video has a valid fps after concatenate function) (#443)

* Move PR test to test_PR.py file (#444)

* move PR test from test_issues.py to test_PR.py

* add code to download python_logo.png

* remove duplicate test_issue_417 function

* add testing with travis-ci (#447)

added testing via travis-ci

* put DEVNULL into compat.py (#432)

* add travis-ci badge to readme file

* pick highest fps when concatenating (#416)

* readers.py cast chunksize from float to int

* choose highest fps of clips when concatenating

* pick highest fps when concatenating

* pick highest fps when concatenating

* fps either max or none

* remove resolve markers

removed resolve markers such as HEAD, etc so that the file will compile correctly.
Remove some double blank lines, etc

* update concatenate.py; add c.fps is not None

* add test for issue 416

* fix test_issue_416

* Update VideoFileClip.py

* Added test

* Added return for PEP 8 compliance

* Change
@dirtyfish
Copy link

dirtyfish commented Sep 11, 2017

What does "creation of none failed" mean?

@dirtyfish
Copy link

It is looking for convert.exe in wrong location?

@dirtyfish
Copy link

dirtyfish commented Sep 11, 2017

I need an older version of imagemagic or something?

@dirtyfish
Copy link

Or you can just copy magick.exe to convert.exe. :) Problem solved in my case.

@ishandutta2007
Copy link
Contributor

ishandutta2007 commented Sep 17, 2018

What @Earney mentioned works perfectly,
Just to add some details for mac Sierra users the policy.xml will be at somewhere like this /usr/local/Cellar/imagemagick/7.0.8-11_1/etc/ImageMagick-7/policy.xml
and if you dont find imagemagic in /usr/local/Cellar/ try #347

@gr8nishan
Copy link

gr8nishan commented Dec 19, 2019

any one able to solve this issue in window

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Questions regarding functionality, usage
Projects
None yet
Development

No branches or pull requests

5 participants