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

'coreader' methods of 'VideoFileClip' and 'AudioFileClip' are buggy #1441

Closed
mondeja opened this issue Jan 14, 2021 · 1 comment · Fixed by #1442
Closed

'coreader' methods of 'VideoFileClip' and 'AudioFileClip' are buggy #1441

mondeja opened this issue Jan 14, 2021 · 1 comment · Fixed by #1442
Assignees
Labels
bug Issues that report (apparent) bugs.

Comments

@mondeja
Copy link
Collaborator

mondeja commented Jan 14, 2021

These methods were created at #1332 and fdc51d2, but IMHO I think that are a misunderstanding of how copy.copy and copy.deepcopy works in Python.

  • coreader methods currently does a shallow copy (like copy.copy) but only taking into account filename parameter.
  • Clip.copy method is working like copy.deepcopy, but even for AudioClip the mask and audio attributes are checked in the instance.

Actual Behavior

The coreader functionality is not working. It's implemented as return AudioFileClip(self.filename, self.buffersize), but AudioFileClip accepts buffersize as a kwarg argument, so it's not taking the buffersize. The same applies to VideoFileClip.

The documentation of coreader methods are very poor, what are they supposed to do? I think that should be added an example, if they are really implemented and are not bad copy.copy-like code.

Steps to Reproduce the Problem

>>> from moviepy.editor import *
>>> clip = AudioFileClip('media/crunching.mp3', buffersize=1000)
>>> clip_2 = clip.coreader()
>>> clip.buffersize
1000
>>> clip_2.buffersize
200000

Expected behaviour

I'm not sure, are a failed copy, I'm thinking in two possible cases:

  • New instance with only filename as the same argument
  • New instance with filename and buffersize as same arguments

I suspect that are just weird copy code, and copy method should be used instead (ovewriting it in AudioClip to because a deepcopy in those are not needed).

Specifications

  • Python Version: 3.8.5
  • Moviepy Version: master
  • Platform Name: Ubuntu
  • Platform Version: 20.04
@mondeja mondeja added the bug Issues that report (apparent) bugs. label Jan 14, 2021
@mondeja mondeja changed the title 'coreader' methods of 'VideoFileClip' and 'AudioFileClip' not working 'coreader' methods of 'VideoFileClip' and 'AudioFileClip' buggy Jan 14, 2021
@tburrows13
Copy link
Collaborator

I have no opinion on the coreader methods. Feel free to scrap them, fix them, rename them, or implement proper copy methods if you like.

I've never used .coreader(), and I don't really know when I would.

@mondeja mondeja changed the title 'coreader' methods of 'VideoFileClip' and 'AudioFileClip' buggy 'coreader' methods of 'VideoFileClip' and 'AudioFileClip' are buggy Jan 14, 2021
@mondeja mondeja self-assigned this Jan 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that report (apparent) bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants