guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: debug moviepy with jgart


From: jgart
Subject: Re: debug moviepy with jgart
Date: Sat, 28 Jan 2023 06:18:58 +0000

Thanks for the reply.

Interestingly, there is no hypothesis code in the moviepy tests so I'm not sure 
why we get that plugins output section mentioning hypothesis.

I wonder if there's a way to start pdb or pudb in the failed build environment 
so that I can step through the test? hmmm

Will try that next... for fun

Here's one test that fails:

# -*- coding: utf-8 -*-
"""Image sequencing clip tests meant to be run with pytest."""
import os
import sys

import pytest

from moviepy.video.io.ImageSequenceClip import ImageSequenceClip

from .test_helper import TMP_DIR


def test_1():
    images=[]
    durations=[]

    for i in range(5):
        durations.append(i)
        images.append("media/python_logo.png")
        durations.append(i)
        images.append("media/python_logo_upside_down.png")

    with ImageSequenceClip(images, durations=durations) as clip:
        assert clip.duration == sum(durations)
        clip.write_videofile(os.path.join(TMP_DIR, "ImageSequenceClip1.mp4"), 
fps=30)

def test_2():
    images=[]
    durations=[]

    durations.append(1)
    images.append("media/python_logo.png")
    durations.append(2)
    images.append("media/matplotlib_demo1.png")

    #images are not the same size..
    with pytest.raises(Exception):
         ImageSequenceClip(images, durations=durations).close()


if __name__ == '__main__':
   pytest.main()

and here's the test failure output:

____________________________________ test_1 ____________________________________

    def test_1():
        images=[]
        durations=[]
    
        for i in range(5):
            durations.append(i)
            images.append("media/python_logo.png")
            durations.append(i)
            images.append("media/python_logo_upside_down.png")
    
        with ImageSequenceClip(images, durations=durations) as clip:
            assert clip.duration == sum(durations)
>           clip.write_videofile(os.path.join(TMP_DIR, 
> "ImageSequenceClip1.mp4"), fps=30)

tests/test_ImageSequenceClip.py:25: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/gnu/store/zfw5y8356i5hmfghpix46qk3iaxg3i6y-python-decorator-5.0.9/lib/python3.9/site-packages/decorator.py:232:
 in fun
    return caller(func, *(extras + args), **kw)
moviepy/decorators.py:54: in requires_duration
    return f(clip, *a, **k)
/gnu/store/zfw5y8356i5hmfghpix46qk3iaxg3i6y-python-decorator-5.0.9/lib/python3.9/site-packages/decorator.py:232:
 in fun
    return caller(func, *(extras + args), **kw)
moviepy/decorators.py:135: in use_clip_fps_by_default
    return f(clip, *new_a, **new_kw)
/gnu/store/zfw5y8356i5hmfghpix46qk3iaxg3i6y-python-decorator-5.0.9/lib/python3.9/site-packages/decorator.py:232:
 in fun
    return caller(func, *(extras + args), **kw)
moviepy/decorators.py:22: in convert_masks_to_RGB
    return f(clip, *a, **k)
moviepy/video/VideoClip.py:300: in write_videofile
    ffmpeg_write_video(self, filename, fps, codec,
moviepy/video/io/ffmpeg_writer.py:213: in ffmpeg_write_video
    with FFMPEG_VideoWriter(filename, clip.size, fps, codec = codec,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <moviepy.video.io.ffmpeg_writer.FFMPEG_VideoWriter object at 
0x7fffd89ba160>
filename = '/tmp/guix-build-python-moviepy-1.0.3.drv-0/ImageSequenceClip1.mp4'
size = (260, 77), fps = None, codec = 'libx264', audiofile = None
preset = 'medium', bitrate = None, withmask = False, logfile = -1
threads = None, ffmpeg_params = None

    def __init__(self, filename, size, fps, codec="libx264", audiofile=None,
                 preset="medium", bitrate=None, withmask=False,
                 logfile=None, threads=None, ffmpeg_params=None):
    
        if logfile is None:
            logfile = sp.PIPE
    
        self.filename = filename
        self.codec = codec
        self.ext = self.filename.split(".")[-1]
    
        # order is important
        cmd = [
            get_setting("FFMPEG_BINARY"),
            '-y',
            '-loglevel', 'error' if logfile == sp.PIPE else 'info',
            '-f', 'rawvideo',
            '-vcodec', 'rawvideo',
            '-s', '%dx%d' % (size[0], size[1]),
            '-pix_fmt', 'rgba' if withmask else 'rgb24',
>           '-r', '%.02f' % fps,
            '-an', '-i', '-'
        ]
E       TypeError: must be real number, not NoneType

moviepy/video/io/ffmpeg_writer.py:88: TypeError

--

Here's the Guix package for the curious:

;;; GNU Guix --- Functional package management for GNU
;;;
;;; Copyright © 2022 jgart <jgart@dismail.de>
;;; This file is not part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (guixrus packages moviepy)
  #:use-module (guix build-system python)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (gnu packages)
  #:use-module (gnu packages check)
  #:use-module (gnu packages fonts)
  #:use-module (gnu packages python-check)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages python)
  #:use-module (gnu packages imagemagick)
  #:use-module (gnu packages video)
  #:use-module (gnu packages python-xyz))

(define-public python-proglog
  (package
    (name "python-proglog")
    (version "0.1.10")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "proglog" version))
        (sha256
          (base32 "1d6s9mg2fr3dr30x05cvsvw25kpakkzqyj2zyarawk1fr34ji335"))))
    (build-system python-build-system)
    (propagated-inputs (list python-tqdm))
    (home-page "")
    (synopsis "Log and progress bar manager for console, notebooks, web...")
    (description "Log and progress bar manager for console, notebooks, web...")
    (license license:expat)))

(define-public python-moviepy
  (package
    (name "python-moviepy")
    (version "1.0.3")
    (source
      (origin
        (method git-fetch)
        (uri (git-reference
               (url "https://github.com/Zulko/moviepy";)
               (commit (string-append "v" version))))
        (file-name (git-file-name name version))
        (sha256
          (base32 "088i5cms0bs0qcvfbbi8krgvllln62lb9rgnliz4as4j0b631c4p"))))
    (build-system python-build-system)
    (native-inputs
      (list python-coverage
            python-coveralls
            font-liberation
            python-pytest
            python-pytest-cov
            python-requests))
    (propagated-inputs
      (list python-decorator
            python-imageio
            python-imageio-ffmpeg
            python-proglog
            python-requests
            python-tqdm))
    (inputs (list ffmpeg imagemagick))
    (arguments
      `(#:phases
        (modify-phases %standard-phases
            (replace 'check
              (lambda* (#:key tests? inputs #:allow-other-keys)
                (when tests?
                  (invoke "pytest" "-vv")))))))
    (home-page "https://zulko.github.io/moviepy/";)
    (synopsis "Video editing with Python")
    (description "Video editing with Python")
    (license license:expat)))

(define-public python-imageio-ffmpeg
  (package
    (name "python-imageio-ffmpeg")
    (version "0.4.7")
    (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "imageio-ffmpeg" version))
        (sha256
          (base32 "0gkjkrmgbdcfqx010hp23ymrkp1zzmjbh88qliyf6qzkjy7q623s"))))
    (build-system python-build-system)
    (home-page "https://github.com/imageio/imageio-ffmpeg";)
    (synopsis "FFMPEG wrapper for Python")
    (description "FFMPEG wrapper for Python")
    (license license:bsd-2)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]