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

Can't write a movie with default codec #1

Closed
gvx opened this issue Aug 25, 2013 · 5 comments
Closed

Can't write a movie with default codec #1

gvx opened this issue Aug 25, 2013 · 5 comments
Assignees

Comments

@gvx
Copy link

gvx commented Aug 25, 2013

It seems I can only use the 'raw' encoding.

>>> video.to_movie("myHolidays_edited.avi",fps=24)
Making file myHolidays_edited.avi ...
Rendering video :
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "moviepy/VideoClip.py", line 323, in to_movie
    codec = 0 if (codec=='raw') else cv2.VideoWriter_fourcc(*codec)
AttributeError: 'module' object has no attribute 'VideoWriter_fourcc'
>>> video.to_movie("myHolidays_edited.avi",fps=24,codec='raw')
Making file myHolidays_edited.avi ...
Rendering video : 0%  10%  20%  30%  40%  50%  60%  70%  80%  90%  done !
>>> 

I have cv2 version 2.4.6.1, if that matters.

@Zulko
Copy link
Owner

Zulko commented Aug 25, 2013

Exactly ! I swear, this little "fourcc" function has had four different names in the last four releases of opencv, and they are the reason that I request recent versions... I think I will make a hack for the program try several syntaxes, so that everyone can use it, whatever the version.

Do you have cv2.cv.FOURCC ?

@gvx
Copy link
Author

gvx commented Aug 26, 2013

>>> cv2.cv.FOURCC
<built-in function FOURCC>

Yup.

@Zulko
Copy link
Owner

Zulko commented Aug 26, 2013

Ok, I just intalled 2.4.6.1 and from what I see the program should break also when you load a movie.
Have you tried something like this ?

from moviepy import *
MovieClip('foo.avi').subclip(0,1).preview()

@ghost ghost assigned Zulko Aug 26, 2013
@Zulko
Copy link
Owner

Zulko commented Aug 26, 2013

Ok, I may or may not have patched all that (added an horrible hack in the beginning of VideoClip.py that looks for the constant names, since they vary between versions). Now it seems to work fine with 2.4.6.1 on my computer.

@gvx
Copy link
Author

gvx commented Aug 26, 2013

You were right, when I tried to do MovieClip('something.avi'), it gave:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "moviepy/VideoClip.py", line 734, in __init__
    self.fps = self.cap.get(cv2.CAP_PROP_FPS)
AttributeError: 'module' object has no attribute 'CAP_PROP_FPS'

Redownloading solved both writing and reading non-raw clips for me, so this seems to be solved.

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