Error when writing video file out
See original GitHub issueExpected Behavior
Using write_videofile("data/output.mp4", fps='30')
should produce a video file at data/output.mp4
Actual Behavior
Moviepy throws an error TypeError: must be real number, not str
from the file ffmpeg_writer.py
and exits the program.
Steps to Reproduce the Problem
Below I have included the section of code that is responsible for actually generating and saving the video file to the disk
clipData = []
for path in clipPaths:
newClip = VideoFileClip(path)
normalClip = audio_normalize(VideoFileClip(path))
clipData.append(newClip)
finalVideo = concatenate_videoclips(clipData, method='compose')
finalVideo.write_videofile("data/output.mp4", fps='30')
clipPaths
is a list of paths to the clips that I am using to make the video.
I have also included the full stack trace that I get when I run the code
Moviepy - Building video data/output.mp4.
MoviePy - Writing audio in outputTEMP_MPY_wvf_snd.mp3
MoviePy - Done.
Moviepy - Writing video data/output.mp4
Traceback (most recent call last):
File "src/videoEditor.py", line 60, in <module>
globals()[sys.argv[1]]()
File "src/videoEditor.py", line 51, in GenerateVideo
finalVideo.write_videofile("data/output.mp4", fps='30')
File "<decorator-gen-55>", line 2, in write_videofile
File "/home/mwollam/.local/lib/python3.8/site-packages/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "<decorator-gen-54>", line 2, in write_videofile
File "/home/mwollam/.local/lib/python3.8/site-packages/moviepy/decorators.py", line 135, in use_clip_fps_by_default
return f(clip, *new_a, **new_kw)
File "<decorator-gen-53>", line 2, in write_videofile
File "/home/mwollam/.local/lib/python3.8/site-packages/moviepy/decorators.py", line 22, in convert_masks_to_RGB
return f(clip, *a, **k)
File "/home/mwollam/.local/lib/python3.8/site-packages/moviepy/video/VideoClip.py", line 300, in write_videofile
ffmpeg_write_video(self, filename, fps, codec,
File "/home/mwollam/.local/lib/python3.8/site-packages/moviepy/video/io/ffmpeg_writer.py", line 213, in ffmpeg_write_video
with FFMPEG_VideoWriter(filename, clip.size, fps, codec = codec,
File "/home/mwollam/.local/lib/python3.8/site-packages/moviepy/video/io/ffmpeg_writer.py", line 88, in __init__
'-r', '%.02f' % fps,
TypeError: must be real number, not str
Specifications
- Python Version: Python 3.8.2
- Moviepy Version: moviepy 1.0.3
- Platform Name: Ubuntu 20.04.1 LTS
Issue Analytics
- State:
- Created 3 years ago
- Comments:11
Top Results From Across the Web
Error in writing video file using moviepy and ffmpeg
I have a list of start and end time. video = VideoFileClip("videoFile.mp4") clips = [] for cut in cuts: clip = video.
Read more >20 most common video errors & how to fix them
This article guide you how to fix all 20 problems or errors while playing videos like playback errors, audio video sync, issues, choppy, ......
Read more >Fix export issues in Premiere Pro - Adobe Support
Fix common export issues in 7 simple steps · Choose File > Project Settings > General. The Project Settings window opens. · In...
Read more >error in making video file - MATLAB Answers - MathWorks
step(videoFWriter, videoFrame); % write video to myFile.avi. end. release(videoFReader); % close the input file. release(videoFWriter); % close the output ...
Read more >Error at 17% exporting mp4 file - Help/How To - Shotcut Forum
[consumer avformat] error writing video frame: -28. I do not know why this occurred. Maybe you ran out of disk space?
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
This happens when
moviepy
anddecorator
modules are not compatible (e.g. after thedecorator
module was upgraded to the last version).This should solve the issue:
It worked after upgrading moviepy.
Thank you.