Giter VIP home page Giter VIP logo

Comments (9)

Zulko avatar Zulko commented on August 28, 2024

Thanks for that! It is fixed now. The strange thing is that I have never had any problem in Python3 with these tabs, what is your version exactly?

from moviepy.

dmopalmer avatar dmopalmer commented on August 28, 2024

I am using python3.3.5 under Mac OSX, installing using Macports.

(I don't know whether MacPorts uses pip, easy_install or something else under the hood. I don't know if it uses six or other packages to mutate Python2 code into Python3 as it does it.)

from moviepy.

Zulko avatar Zulko commented on August 28, 2024

Ok thanks for the info. Could you try to reinstall and see it it works now? So that I can safely close the issue.

from moviepy.

dmopalmer avatar dmopalmer commented on August 28, 2024

Quick correction, I originally installed it using pip .

More trouble: old-style print statements in
File "build/bdist.macosx-10.9-x86_64/egg/moviepy/video/tools/segmenting.py", line 47
print "found %d objects"%(num_features)
File "build/bdist.macosx-10.9-x86_64/egg/moviepy/video/tools/tracking.py", line 20
print "WARNING: OpenCV not found: automated tracking not possible"

After fixing that, it installs and imports correctly.

Unfortunately, for my particular movie file, ffmpeg can't determine the duration, and so it chokes at
video/io/ffmpeg_reader.py:215 (where it is trying to find an HH:MM:SS pattern, and ffmpeg puts up
"Duration: N/A, bitrate: N/A") This is from a Raspberry Pi reading off its camera in an h264 raw stream, so some of the encoding may be a bit skanky. Any suggestions?

from moviepy.

Zulko avatar Zulko commented on August 28, 2024

This sounds like an interesting project. Just to be sure, are you reading from a finite video, or from a video that is still being recorded ? In the first case, what you could try is to rewrite the video with ffmpeg and see if the result has the good metadata (but this might take some time):

ffmpeg -i myvideo.flv mycopy.flv

Otherwise I can also make the duration search optional (and send a warning when a video has no duration). Could you try this and see if it works? That is, replace that line 215 by duration=None, then do things like

myvideo = VideoFileClip("my_rpi_video.avi").set_duration(arbitrary_duration)

Not ideal, but that would be a start.

Does ffmpeg at least find the fps of the video ?

The "print" statements are fixed, thanks for the report.

from moviepy.

dmopalmer avatar dmopalmer commented on August 28, 2024

I am reading from a file which was previously piped from the raspivid application (over the network).
This permits seeking (so ffmpeg can probe the file and then back up to the start and read.)

Since the compression is not too extreme, it requests a larger -probesize to get enough information to do what it can, but even with an arbitrarily large probesize, it doesn't get the duration.

It returns an FPS of 25. However, this is wrong (actual FPS is 10 in my case).

If I put the duration section in a try/except block, I can use FFMPEG_VideoReader() directly to get sequential frames from the beginning.

However, when I use moviepy.editor.VideoFileClip(), I always get the same frame from fullclip.get_frame(t) independent of how I change t.

Another Python3 change I found (which I needed for the coolTextEffects demo) was

diff --git a/moviepy/video/VideoClip.py b/moviepy/video/VideoClip.py
index 2e4fd03..e6be144 100644
--- a/moviepy/video/VideoClip.py
+++ b/moviepy/video/VideoClip.py
@@ -1036,7 +1036,7 @@ class TextClip(ImageClip):
         if not txt.startswith('@'):
             if temptxt is None:
                 temptxt_fd, temptxt = tempfile.mkstemp(suffix='.txt')
-                os.write(temptxt_fd, txt)
+                os.write(temptxt_fd, bytes(txt,'UTF8'))
                 os.close(temptxt_fd)
             txt = '@'+temptxt
         else:

from moviepy.

Zulko avatar Zulko commented on August 28, 2024

Hi there, sorry to bother you with this old issue, but have you given it a try with the recent version ? There are chances that it may work properly.

from moviepy.

dmopalmer avatar dmopalmer commented on August 28, 2024

It's back to not working with Python 3.3

% python
Python 3.3.5 (default, Sep 20 2014, 19:48:21)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import moviepy.editor as med
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "./moviepy/editor.py", line 22, in <module>
    from .video.io.VideoFileClip import VideoFileClip
  File "./moviepy/video/io/VideoFileClip.py", line 3, in <module>
    from moviepy.video.VideoClip import VideoClip
  File "./moviepy/video/VideoClip.py", line 18, in <module>
    from .io.ffmpeg_writer import ffmpeg_write_image, ffmpeg_write_video
  File "./moviepy/video/io/ffmpeg_writer.py", line 15, in <module>
    from moviepy.config import get_setting
  File "./moviepy/config.py", line 8, in <module>
    from config_defaults import (FFMPEG_BINARY, IMAGEMAGICK_BINARY)
ImportError: No module named 'config_defaults'
>>>

No such problem with python2.7.

from moviepy.

Zulko avatar Zulko commented on August 28, 2024

Thanks for catching that, I corrected it. Now working with Python3 too.

from moviepy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.