all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "jgart" <jgart@dismail.de>
To: "Wojtek Kosior" <koszko@koszko.org>
Cc: guix-devel@gnu.org
Subject: Re: debug moviepy with jgart
Date: Sat, 28 Jan 2023 06:18:58 +0000	[thread overview]
Message-ID: <9dd71da234dba6db4b11a2f96d82c322@dismail.de> (raw)
In-Reply-To: <20230128061642.1ef7790d.koszko@koszko.org>

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)))


      parent reply	other threads:[~2023-01-28  6:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-28  4:12 debug moviepy with jgart jgart
2023-01-28  5:16 ` Wojtek Kosior via Development of GNU Guix and the GNU System distribution.
2023-01-28  6:18 ` jgart [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9dd71da234dba6db4b11a2f96d82c322@dismail.de \
    --to=jgart@dismail.de \
    --cc=guix-devel@gnu.org \
    --cc=koszko@koszko.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.