Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No sound with an audio clip add to an video in quicktime #820

Closed
wayn opened this issue Jun 20, 2018 · 4 comments
Closed

No sound with an audio clip add to an video in quicktime #820

wayn opened this issue Jun 20, 2018 · 4 comments

Comments

@wayn
Copy link

wayn commented Jun 20, 2018

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')

Expected Behavior

Has sound in the video

Actual Behavior

Has no sound in the quicktime player but has in vlc,and same issue with any audio_codec.

pls help!

@wayn
Copy link
Author

wayn commented Jun 22, 2018

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
)

@wayn wayn closed this as completed Jun 22, 2018
@CranberryYam
Copy link

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?

@amantiwari1
Copy link

help me out
In Result Still no Sound, Cant Find Solution

@alessio-signorini
Copy link

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')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants