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

ffmpeg does not allow None as fps argument #2125

Open
BreuerChristian opened this issue Mar 2, 2024 · 2 comments
Open

ffmpeg does not allow None as fps argument #2125

BreuerChristian opened this issue Mar 2, 2024 · 2 comments
Labels
bug Issues that report (apparent) bugs. lib-FFmpeg Issues pertaining to dependency FFmpeg. needs-more-info Waiting for submitter's reply, feedback, updates,...

Comments

@BreuerChristian
Copy link

Expected Behavior

I combine mp4 and mp3 and get that error

Actual Behavior

File "C:\X\venv\Lib\site-packages\moviepy\video\VideoClip.py", line 300, in write_videofile
ffmpeg_write_video(self, filename, fps, codec,
File "C:\X\venv\Lib\site-packages\moviepy\video\io\ffmpeg_writer.py", line 212, in ffmpeg_write_video
with FFMPEG_VideoWriter(filename, clip.size, fps, codec = codec,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\X\venv\Lib\site-packages\moviepy\video\io\ffmpeg_writer.py", line 86, in init
'-r', '%.02f' % fps,
~~~~~~~~^~~~~
TypeError: must be real number, not NoneType

Steps to Reproduce the Problem

I am not familiar with the fps fancy stuff
but i found out that the none is not allowed for ffmpeg as fps
Thatfore i added the code in the function ffmpeg_write_video

if fps==None:
    fps=24

After that it worked

Specifications

  • Python Version: 3.12.2
  • MoviePy Version: 1.0.3
  • Platform Name: Windows 64
@BreuerChristian BreuerChristian added the bug Issues that report (apparent) bugs. label Mar 2, 2024
@keikoro
Copy link
Collaborator

keikoro commented Mar 5, 2024

Please always include code samples for reproducability and complete logs for errors where applicable (code-formatted text only, no screenshots).

The wording under "Steps to Reproduce the Problem" seems to suggest this was your attempt at a fix, not the original code that resulted in your issue. Either way, this is not how you'd check for the existence of fps, see the second bullet point in this section in PEP8 ("Comparisons to singletons like None...").

@keikoro keikoro added the lib-FFmpeg Issues pertaining to dependency FFmpeg. label Mar 5, 2024
@keikoro
Copy link
Collaborator

keikoro commented Mar 5, 2024

I'm assuming this is a duplicate of #2041 #1986, in which case this issue should be closed in favour of the older one.

@keikoro keikoro added the needs-more-info Waiting for submitter's reply, feedback, updates,... label Mar 5, 2024
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. lib-FFmpeg Issues pertaining to dependency FFmpeg. needs-more-info Waiting for submitter's reply, feedback, updates,...
Projects
None yet
Development

No branches or pull requests

2 participants