I have the following code and receiving no sound in the video output. I'm using MoviePy package.
from moviepy.editor import *
picture = VideoFileClip("/Users/name/Desktop/trial.jpg", audio=False).set_duration(50)
txt_clip = TextClip("Hey",fontsize = 150, color='white')
txt_clip = txt_clip.set_pos('center').set_duration(10)
audio = AudioFileClip("/Users/name/Desktop/music.mp3").subclip(0,50)
video_with_new_audio = picture.set_audio(audio)
final_video = CompositeVideoClip([video_with_new_audio,txt_clip])
final_video.write_videofile("trial.mp4")
What can be the issue?:c
Could it be a missing MP3 codec, "LAME" etc.? Your code worked on Windows:
That's the output: trial.mp4
Can you run
ffprobe trial.mp4orffmpeg -i trial.mp4and show the output?That's the output of ffprobe on my video:
That may be related, ffmpeg settings and version of moviepy: No audio on concatenating clips in MoviePy