Concatenating subclips: "AttributeError: 'CompositeAudioClip' object has no attribute 'fps'"
See original GitHub issueExpected Behavior
Concatenates and plays composite video file.
Actual Behavior
Preview freezes on first frame with the following output:
pygame 1.9.4
Hello from the pygame community. https://www.pygame.org/contribute.html
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "<decorator-gen-100>", line 2, in preview
File "/usr/lib/python3.7/site-packages/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "/usr/lib/python3.7/site-packages/moviepy/audio/io/preview.py", line 49, in preview
sndarray = clip.to_soundarray(tt, nbytes=nbytes, quantize=True)
File "<decorator-gen-72>", line 2, in to_soundarray
File "/usr/lib/python3.7/site-packages/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "/usr/lib/python3.7/site-packages/moviepy/audio/AudioClip.py", line 110, in to_soundarray
fps = self.fps
AttributeError: 'CompositeAudioClip' object has no attribute 'fps'
Steps to Reproduce the Problem
#!/usr/bin/env python3
import moviepy.editor as mpy
clip=mpy.VideoFileClip("sample.mp4")
#clip=clip.without_audio()
subclip=mpy.concatenate_videoclips([clip.subclip((1,0),(2,0)),clip.subclip((3,0),(4,0)),clip.subclip((5,0),(6,0))])
subclip.preview()
Note that uncommenting the clip=clip.without_audio() removes the error.
Specifications
- Python Version: 3.7.0
- Moviepy Version: 0.2.3.5
- Platform Name: Arch Linux
- Platform Version: 4.18.12-arch1-1-ARCH
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:10 (1 by maintainers)
Top Results From Across the Web
How to combine 2 audio mp3s in moviepy? - Stack Overflow
I tried running the code bellow, but I get this error "AttributeError: 'CompositeAudioClip' object has no attribute 'fps'". How do I get this...
Read more >moviepy - Bountysource
I have a problem with videos with different FPS and TBR. I open a video and try to render it: video = movieEditor.VideoFileClip('video.mp4')...
Read more >CHANGELOG.md · Gitee 极速下载/moviepy - Gitee.com
... Fixed fps not defined in CompositeAudioClip at initialization #1462 ... with audio: AttributeError: 'NoneType' object has no attribute 'stdout' #1185 ...
Read more >Vfx does funky things with funky errors that I cannot understand.
When you don't set audio to none, it has the error 'CompositeAudioClip' object has no attribute 'fps'. When you set it to none,...
Read more >fix moviepy problem with pyinstaller - YouTube
AttributeError : module 'moviepy.audio.fx.all' has no attribute 'audio_fadein' ...
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

maybe this is a workaround 😃
I had the same problem as helasraizam when using ‘concatenate_videoclips’ and ‘preview’. His workaround didn’t work for me, but the following did: