I want to get the volume of sound of a video so I use the following:
import numpy as np # for numerical operations
from moviepy.editor import VideoFileClip, concatenate
clip = VideoFileClip("soccer_game.mp4")
cut = lambda i: clip.audio.subclip(i,i+1).to_soundarray(fps=22000)
volume = lambda array: np.sqrt(((1.0*array)**2).mean())
volumes = [volume(cut(i)) for i in range(0,int(clip.audio.duration-2))]
But I get these errors:
Exception AttributeError: "VideoFileClip instance has no attribute 'reader'" in <bound method VideoFileClip.__del__ of <moviepy.video.io.VideoFileClip.VideoFileClip instance at 0x084C3198>> ignored
WindowsError: [Error 5] Access is denied
I am using IPython notebook and Python 2.7. I assume something doesn't have the appropriate permissions. I have changed run this program as an administrator for ffmpeg.exe, ffplay.exe, ffprobe.exe.
I fixed a bug today that may have caused your problem, would you mind upgrading and trying again ? If it still doesn't work, I'll need to know your windows version.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With