This is my code
from moviepy.editor import *
import moviepy.video.fx.all as vfx
import os
def create(self):
base_dir = os.path.realpath("./assets")
img = [
base_dir + '/2.jpg',
base_dir + '/3.jpg',
base_dir + '/4.jpg'
]
audioclip = AudioFileClip(base_dir+'/demo.mp3')
clips = [ImageClip(m).fx(vfx.resize, newsize=(520,300)).fx(vfx.scroll, h=280, w=480, x_speed=12).set_duration(2) for m in img]
videoclip = concatenate_videoclips(clips, method="compose")
finalclip = videoclip.set_audio(audioclip.set_duration(videoclip.duration))
finalclip.write_videofile("demo.mp4", fps=25, codec="mpeg4", audio_codec='libmp3lame')
Has sound in the video
Has no sound in the quicktime player but has in vlc锛宎nd same issue with any audio_codec.
pls help!
I found the solution in other issue
clip.write_videofile(out_path,
codec='libx264',
audio_codec='aac',
temp_audiofile='temp-audio.m4a',
remove_temp=True
)
I found the solution in other issue
clip.write_videofile(out_path, codec='libx264', audio_codec='aac', temp_audiofile='temp-audio.m4a', remove_temp=True )
How do I know my temp_audiofile?
help me out
In Result Still no Sound, Cant Find Solution
Specifying an audio_codec while writing the file was sufficient to make it work for me, e.g.,
video.write_videofile(edit, audio_codec='aac')
Most helpful comment
I found the solution in other issue