I am getting a peculiar error while using PyMedia to convert video files (.avi) to audio files (.wav).
I get no error message - it just says python.exe has stopped working.
My code is here. The two sample video clips are here and here.
It works for the sample video s30_di_4.avi but not for the sample video s30_di_5.avi and fails with the above problem.
Can anyone please point out my mistake?
Related
I'm trying to set audio clip on image clip in moviepy. I read this page, then I wrote code like this.
from moviepy.editor import *
clip = ImageClip('img/output_1.png')
audio_clip = AudioFileClip('audio/output_1.mp3')
clip = clip.set_duration(audio_clip.duration)
clip = clip.set_audio(audio_clip)
Audio and duration are returns value.
>>> clip.audio
<moviepy.audio.io.AudioFileClip.AudioFileClip object at 0x1241dbd30>
>>> clip.duration
4.18
However when I write as file.
clip.write_videofile('mov/sample.mp4',fps=4)
I can't hear the sound. Are there any mistake on my code? I don't know how should I change my code... If you have any idea please help me!
My environment is
MacOS 11.3.1
python 3.9.5
moviepy 1.0.3
I had run same code on google colab, I got same problem. The video has 4.18 seconds, however it's no sound...
I downloaded audio file from ondoku3 and youtube as mp3
I found QuickTime can't play sound. When I play VLC, I can hear the sound.
And also when I merge audio and video with ffmpeg. I got same problem. So I think this problem from ffmpge convert problem or QuickTime problem.
I am trying to create a simple video of one image with audio with MoviePy. Working with the same code, sometimes MoviePy randomly produces greyed out and glitched videos like this: (opened with VLC Media Player)
The audio works fine in the final video, and the image used is also completely fine.
I tried searching but couldn't find anything that worked. I also re-downloaded FFMPEG, thinking it would solve the problem, but to no advantage.
The code I am using is:
# assume aud_path, vid_path and out_path are set and imports have been done
aud_clip = AudioFileClip(aud_path)
vid_clip = ImageClip(vid_path)
vid_clip = vid_clip.set_audio(aud_clip).set_duration(aud_clip.duration)
vid_clip.write_videofile(out_path, temp_audiofile='temp-audio.m4a', remove_temp=True, codec="libx264", audio_codec="aac", fps=24)
Any help will be appreciated.
I figured it out! For anyone having a similar problem, the problem was in the vid_clip.write_videfile() method in the codec argument.
I changed the codec to "mpeg4" and it is working fine now.
Background
I'm working on a music player, and want any sort of audio visualizer to be part of it. I've already made a previous post specifically targeting python-vlc, but I guess not too many people know about it. Here is the post in question: How to get audio samples from python-VLC
What I need
I need a way to listen to audio output, preferably by application although it is not completely necessary. It must be a python module.
What I found
A bunch of tutorials regarding audio input from the microphone, which is NOT what I need
Two swhardware.com tutorials with audio visualizers
https://swharden.com/blog/2016-07-19-realtime-audio-visualization-in-python/
Another one from 2013 but I can't find the link
PyAudio tutorials also using the microphone
Listening audio output with python
terminatorX on Linux; it uses the microphone
squishyball on Linux; it doesn't support all audio files
livefft; uses pyqt4 so I couldn't even test it
Alternatives
Any python module or linux terminal that can provide a list of audio samples from any audio file. Similar to pydub.AudioSegement.get_array_of_samples()
What I don't need
More suggestions to use pydub's get_array_of_samples()
Pydub doesn't read the audio file correctly and quickly gets out of sync from already playing audio
More tutorials of how to get audio from the microphone
Answers on how to strip audio from a video file with ffmpeg
I am using a RPi camera to capture video in a MJPEG format to file. However, when I attempt to do so, the application freezes up and requires me to manually kill it. I am not sure why it is freezing up, but any ideas to resolve this problem would appreciated.
This program entails the following code in accord to the documentation from the following website under the section "start_recording": https://picamera.readthedocs.org/en/release-1.10/api_camera.html#picamera.camera.PiCamera.start_recording
The actual program is as listed below:
start_recording('/home/pi/testVideo.mjpeg', format = 'mjpeg')
camera.wait_recording(5)
stop_recording()
I am looking for video call for my door intercom system. I followed the famous "pjproject" for audio calls. It is also mentioned that pjsip is video API supportable. I tried to make video call but couldn't figure out how to proceed with that. I tried to initiate video call in same "sample" file, that is used for audio call.
First I tried to switch auto transmission and auto start video on call but that didn't work. Then I tried to get the count and info of video device using commands vid_dev_count and vid_dev_get_info both didn't work.
ERROR AttributeError: Lib instance has no attribute 'vid_dev_count'
and same for other. Even I tried to access class "VideoDeviceInfo":
AttributeError: 'module' object has no attribute 'VideoDeviceInfo'
First of all whether pjsip API is supportable for Raspberry Pi or not? I read it is mostly supported on PC not portable devices(for video).
Did you follow the instructions for building PJSIP with video support like here, on the section video support? Because there is a big difference between the PJSIP build with and without video support. Further more i can't help you without any sourcecode.