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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with preview + missing explanation of crop + resize not working #15

Closed
keikoro opened this issue Feb 17, 2014 · 6 comments
Closed

Comments

@keikoro
Copy link
Collaborator

keikoro commented Feb 17, 2014

Hey, I came here via your GIF tutorial and though I've meanwhile managed to output my first few GIFs 馃帀 your documentation doesn't cover a few things I'm having problems with or questions about.

  • I can't seem to preview clips - I've tried both preview and show, and always get attribute errors:
    AttributeError: VideoFileClip instance has no attribute 'preview'
    AttributeError: VideoFileClip instance has no attribute 'show'
  • I have no idea how crops work. What are x1 and x2? I thought they stood for start and stop of the crop horizontally, but that can't be it.
  • I can't get resize to work, I always get an import error for that:
    ImportError: fx resize needs OpenCV or Scipy or PIL

I'm running MoviePy with virtualenv, could that be why my OpenCV install isn't recognised? (Currently trying to find out how to install Scipy on Mavericks.)

(Btw. if you'd prefer me to split these up into separate GitHub issues, I'll happily do so.)

@keikoro
Copy link
Collaborator Author

keikoro commented Feb 17, 2014

Update - managed to install Scipy (it's pip'ed into my virtual environment) but am still getting the same import error. /:

@Zulko
Copy link
Owner

Zulko commented Feb 17, 2014

Thanks for the feedback !

  • You need to install Pygame to have "preview" and "show". It is written in the docs (README and HTML) but I agree that it's not easy to find so I modified the code: now it will leave a message askiing to install pygame if tyou try to preview a clip without Pygame installed.
  • Just added crop documentation. Yes x1 and x2 are the x-coordinates delimiting the horizontal crop, why ?
  • The resize was indeed buggy. I just corrected this bug, but it will only work with a recent version (0.13), didn't test it completely. In any way the resizing is not really good with scipy (and I suspect with Sciki-image either) so I recommend you install PIL, it is easier to install than OpenCV and gives good results.

Tell me if you meet any other bug !

@keikoro
Copy link
Collaborator Author

keikoro commented Feb 17, 2014

Thanks for getting back to me so quickly!

  • True! I was totally sure I'd installed PyGame but noticed now I hadn't, actually. Currently in the process of doing so.
  • Where can I find the crop docu? (: (Is it on GitHub pages? Searched for it, but didn't find any new results.) I got weird results using x1 and x2 this way - the crops I got were also cropped vertically, but not in a predictable way, IIRC. I'll experiment some more with this once I get everything working again (I rm'd my env, now have to reinstall everything, ha). What I was mostly confused about: Is x2 measured from 0 or from x1? Can I also use y1 and y2? (If so: how would I combine x1 and y1 if I didn't want to use x2 and y2?)
  • I've meanwhile discovered there's quite a bit of weirdness going on on my end with OpenCV and the virtual environment. Looks like I initially accidentally brewed it from within the virtualenv, which appeared to work, but didn't actually result in a real working OpenCV within that env or outside of it. When I tried to brew it outside of the virtualenv, I couldn't because of missing dependencies. Then I installed those, managed to brew it, but it's still not recognised. I've meanwhile managed to install PIL, though I wasn't sure if I can really use it as it says "The Python Imaging Library is not used yet (I don鈥檛 like the copyright) but it is coming." in your Download & Installation instructions! I thought you might only added it to the error message in preparation for future use.

A suggestion I have for the GitHub pages documentation: maybe add fixed links to the Installation instructions as well as the Referene Manual to the menu on the left-hand side? (Or maybe to all four topics that are part of the User's Guide?) I think this'd be helpful. (:

@keikoro
Copy link
Collaborator Author

keikoro commented Feb 17, 2014

I think I found the info on cropping! Will test it now. (My new virtual env is finally set up again for GIF-making. (; )

@keikoro
Copy link
Collaborator Author

keikoro commented Feb 18, 2014

Ok, an update! I figured out how cropping works and can also resize with PIL now, yay!

I cannot, however, get PyGame to work with my virtualenv. I managed to install it system-wide, but it does not work within the virtualenv and I can't install it there either. Found a few seemingly related bug reports in the PyGame BitBucket repo but none of them helped me solve my problem. Too bad. /:

Some other things:

  • You mention crossfading in the User Reference but don't explain how it works (I found the info on crossfadein and -out by looking through the fx files in the repo).
  • I think it'd also make sense to mention how (easy it is) to get an existing clip's data like size, fps or duration etc. in the manual. Had to hunt around in the files for the info. (:
  • I'm having troubles introducing my own variables, though this could be related to me being a Python beginner, not sure. I thought that a statement like this:
if thisvariable:
    do something

would get executed if thisvariable existed but would simply get ignored if it didn't. However, I always get error messages when thisvariable wasn't previously defined. (I wanted to resize a clip depending on if variables newheight and/or newwidth exist(s).)

@Zulko
Copy link
Owner

Zulko commented Feb 18, 2014

Le 18/02/2014 15:06, Kay a 茅crit :

Ok, an update! I figured out how cropping works and can also resize
with PIL now, yay!

Urgeil ! Let me know if there is any other feature you want / have
problems with.

I cannot, however, get PyGame to work with my virtualenv. Too bad. /:

Too bad indeed, previewing makes the editing much more agreable.

Some other things:

I get lots of complaints about the docs :) . Do you know about the
IPython Notebook ? It's an awesome code editor which does autocompletion
and autodoc. For instance if you have a clip object myclip and you
type myclip. and then hit tab, it will show you all the attributes and
methods of myclip. If you type clip.resize( and you hit tab it will
display the documentation of resize.

  • I'm having troubles introducing my own variables

All variables must receive a value before they are used. The pythonic
way to say "this variable doesn't have any value" is to write x = None. For istance if a clip has no sound you will have
clip.audio=None. Since the logical value of None is False you can
test if a clip has some audio with

 if clip.audio:

Now if you want to test if a clip has some attribute author but you
are not sure that this attribute exists at all, you will write

 if hasattr( myclip, 'author' )

If you want you can paste your code somewhere and I'll tell you how I
would have written it.

Thanks for the feedback, it's really appreciated !

@Zulko Zulko closed this as completed Feb 20, 2014
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